diff options
Diffstat (limited to 'Tools/gdb/libpython.py')
-rwxr-xr-x | Tools/gdb/libpython.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index a105e58..a0a95e3 100755 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -83,7 +83,8 @@ def _sizeof_void_p(): # value computed later, see PyUnicodeObjectPtr.proxy() _is_pep393 = None -Py_TPFLAGS_HEAPTYPE = (1 << 9) +Py_TPFLAGS_MANAGED_DICT = (1 << 4) +Py_TPFLAGS_HEAPTYPE = (1 << 9) Py_TPFLAGS_LONG_SUBCLASS = (1 << 24) Py_TPFLAGS_LIST_SUBCLASS = (1 << 25) Py_TPFLAGS_TUPLE_SUBCLASS = (1 << 26) @@ -507,7 +508,6 @@ class HeapTypeObjectPtr(PyObjectPtr): tsize = -tsize size = _PyObject_VAR_SIZE(typeobj, tsize) dictoffset += size - assert dictoffset > 0 assert dictoffset % _sizeof_void_p() == 0 dictptr = self._gdbval.cast(_type_char_ptr()) + dictoffset @@ -523,12 +523,11 @@ class HeapTypeObjectPtr(PyObjectPtr): def get_keys_values(self): typeobj = self.type() - values_offset = int_from_int(typeobj.field('tp_inline_values_offset')) - if values_offset == 0: + has_values = int_from_int(typeobj.field('tp_flags')) & Py_TPFLAGS_MANAGED_DICT + if not has_values: return None - charptr = self._gdbval.cast(_type_char_ptr()) + values_offset PyDictValuesPtrPtr = gdb.lookup_type("PyDictValues").pointer().pointer() - valuesptr = charptr.cast(PyDictValuesPtrPtr) + valuesptr = self._gdbval.cast(PyDictValuesPtrPtr) - 4 values = valuesptr.dereference() if long(values) == 0: return None |