summaryrefslogtreecommitdiff
path: root/Tools/gdb/libpython.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2017-01-27 13:05:09 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2017-01-27 13:05:09 +0000
commitd45d8652710e51576367db00b226b8465e6c5ce6 (patch)
treeeeb12605abc98507852e82848382c2e739991708 /Tools/gdb/libpython.py
parent6ccbbb38caa79f9eb9b93b5767f3787fc80cbac1 (diff)
parentbbbab3c96168cea9f872f90da0a385b50f62ca70 (diff)
downloadcpython-d45d8652710e51576367db00b226b8465e6c5ce6.tar.gz
Closes #28784: Merged update from 3.6.
Diffstat (limited to 'Tools/gdb/libpython.py')
-rwxr-xr-xTools/gdb/libpython.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index cc1afbe16d..0903c01766 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,17 +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 == '_PyCFunction_FastCallDict':
- 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