summaryrefslogtreecommitdiffstats
path: root/Tools/gdb/libpython.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-06-14 12:46:37 (GMT)
committerGitHub <noreply@github.com>2023-06-14 12:46:37 (GMT)
commit7199584ac8632eab57612f595a7162ab8d2ebbc0 (patch)
treeeda3183876d2ce6805796d5c8f7b0cd8abadc22e /Tools/gdb/libpython.py
parentad56340b665c5d8ac1f318964f71697bba41acb7 (diff)
downloadcpython-7199584ac8632eab57612f595a7162ab8d2ebbc0.zip
cpython-7199584ac8632eab57612f595a7162ab8d2ebbc0.tar.gz
cpython-7199584ac8632eab57612f595a7162ab8d2ebbc0.tar.bz2
GH-100987: Allow objects other than code objects as the "executable" of an internal frame. (GH-105727)
* Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
Diffstat (limited to 'Tools/gdb/libpython.py')
-rwxr-xr-xTools/gdb/libpython.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index 6225d31..78b0c08 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -1009,14 +1009,18 @@ class PyFramePtr:
self._gdbval = gdbval
if not self.is_optimized_out():
- self.co = self._f_code()
- self.co_name = self.co.pyop_field('co_name')
- self.co_filename = self.co.pyop_field('co_filename')
-
- self.f_lasti = self._f_lasti()
- self.co_nlocals = int_from_int(self.co.field('co_nlocals'))
- pnames = self.co.field('co_localsplusnames')
- self.co_localsplusnames = PyTupleObjectPtr.from_pyobject_ptr(pnames)
+ try:
+ self.co = self._f_code()
+ self.co_name = self.co.pyop_field('co_name')
+ self.co_filename = self.co.pyop_field('co_filename')
+
+ self.f_lasti = self._f_lasti()
+ self.co_nlocals = int_from_int(self.co.field('co_nlocals'))
+ pnames = self.co.field('co_localsplusnames')
+ self.co_localsplusnames = PyTupleObjectPtr.from_pyobject_ptr(pnames)
+ self._is_code = True
+ except:
+ self._is_code = False
def is_optimized_out(self):
return self._gdbval.is_optimized_out
@@ -1051,7 +1055,10 @@ class PyFramePtr:
return self._f_special("f_builtins")
def _f_code(self):
- return self._f_special("f_code", PyCodeObjectPtr.from_pyobject_ptr)
+ return self._f_special("f_executable", PyCodeObjectPtr.from_pyobject_ptr)
+
+ def _f_executable(self):
+ return self._f_special("f_executable")
def _f_nlocalsplus(self):
return self._f_special("nlocalsplus", int_from_int)