This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/13326] Need support for C++ method call for a gdb.Value object from within python


https://sourceware.org/bugzilla/show_bug.cgi?id=13326

Phil Muldoon <pmuldoon at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pmuldoon at redhat dot com

--- Comment #2 from Phil Muldoon <pmuldoon at redhat dot com> ---
I looked at the code and, indeed, class method invocation is barred. I suspect
the reason for this is two-fold. Currently, in GDB we evaluate all the hairy
C++ stuff in the evaluation parser. The Python inferior function call stuff
just calls "call_function_by_hand". This causes, firstly, the separation from
the "this" reference which is passed as a parameter to the function. If you
remove the restriction in the code, GDB will complain about an incorrect number
of arguments because the hidden "this" argument is missing. Secondly, all of
the extra "shaping" for the function call is missing like overload resolution. 

So feature missing confirmed. I'm not sure when it will be worked on as it is a
non-trivial issue. Perhaps when the C++ification progresses to the evaluation
parser it might be possible without duplicating large amounts of code.

There is a workaround available. You can use gdb.parse_and_eval to get the
value by using it to call the function in question. This uses the evaluation
parser and correctly sets up for the C++ function call. So something like:

python f = gdb.parse_and_eval("someObject.someFunction()") 

This will call that function and return the value back to GDB as a Python
value.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]