[Python-checkins] cpython (3.6): Issue #28023: Fix python-gdb.py on old GDB versions

victor.stinner python-checkins at python.org
Tue Nov 22 07:11:40 EST 2016


https://hg.python.org/cpython/rev/9b974f988c95
changeset: 105333:9b974f988c95
branch: 3.6
parent: 105331:4f6fb9e47f6b
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Nov 22 13:09:39 2016 +0100
summary:
 Issue #28023: Fix python-gdb.py on old GDB versions
Replace int(value.address)+offset with value.cast(unsigned char*)+offset.
It seems like int(value.address) fails on old versions of GDB.
files:
 Tools/gdb/libpython.py | 8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -709,6 +709,7 @@
 out.write('}')
 
 def _get_entries(self, keys):
+ dk_nentries = int(keys['dk_nentries'])
 dk_size = int(keys['dk_size'])
 try:
 # <= Python 3.5
@@ -726,9 +727,12 @@
 else:
 offset = 8 * dk_size
 
+ ent_addr = keys['dk_indices']['as_1'].address
+ ent_addr = ent_addr.cast(_type_unsigned_char_ptr()) + offset
 ent_ptr_t = gdb.lookup_type('PyDictKeyEntry').pointer()
- ent_addr = int(keys['dk_indices']['as_1'].address) + offset
- return gdb.Value(ent_addr).cast(ent_ptr_t), int(keys['dk_nentries'])
+ ent_addr = ent_addr.cast(ent_ptr_t)
+
+ return ent_addr, dk_nentries
 
 
 class PyListObjectPtr(PyObjectPtr):
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /