This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/13326] Need support for C++ method call for a gdb.Value object from within python
- From: "pmuldoon at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 07 Aug 2017 10:35:11 +0000
- Subject: [Bug python/13326] Need support for C++ method call for a gdb.Value object from within python
- Auto-submitted: auto-generated
- References: <bug-13326-4717@http.sourceware.org/bugzilla/>
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.