diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-01-18 16:20:01 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-01-18 16:20:01 (GMT) |
commit | fa025f112f7467b124f7ac4be5e9c7bb3cc05ad8 (patch) | |
tree | c5259e9fa0022c79c98adf30a53d16d7111ec32c /Tools | |
parent | e69f0e6111facf751b75f6c73bb6dee2207af366 (diff) | |
download | cpython-fa025f112f7467b124f7ac4be5e9c7bb3cc05ad8.zip cpython-fa025f112f7467b124f7ac4be5e9c7bb3cc05ad8.tar.gz cpython-fa025f112f7467b124f7ac4be5e9c7bb3cc05ad8.tar.bz2 |
Update and enhance python-gdb.py
Issue #29259:
* Detect PyCFunction is the current frame, not only in the older frame
* Ignore PyCFunction_Call() since it now calls _PyCFunction_FastCallDict(), and
_PyCFunction_FastCallDict() is already detected
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/gdb/libpython.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index 5c59b99..0903c01 100755 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1497,15 +1497,17 @@ class Frame(object): return 'Garbage-collecting' # Detect invocations of PyCFunction instances: - older = self.older() - if not older: - return False - - caller = older._gdbframe.name() + frame = self._gdbframe + caller = frame.name() if not caller: return False - if caller == 'PyCFunction_Call': + if caller in ('_PyCFunction_FastCallDict', + '_PyCFunction_FastCallKeywords'): + if caller == '_PyCFunction_FastCallKeywords': + arg_name = 'func_obj' + else: + arg_name = 'func' # Within that frame: # "func" is the local containing the PyObject* of the # PyCFunctionObject instance @@ -1513,18 +1515,10 @@ class Frame(object): # "self" is the (PyObject*) of the 'self' try: # Use the prettyprinter for the func: - func = older._gdbframe.read_var('func') - return str(func) - except RuntimeError: - return 'PyCFunction invocation (unable to read "func")' - - elif caller in ('_PyCFunction_FastCallDict', - '_PyCFunction_FastCallKeywords'): - try: - func = older._gdbframe.read_var('func_obj') + func = frame.read_var(arg_name) return str(func) except RuntimeError: - return 'PyCFunction invocation (unable to read "func_obj")' + return 'PyCFunction invocation (unable to read %s)' % arg_name # This frame isn't worth reporting: return False |