Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ad817abb
Commit
ad817abb
authored
Nov 22, 2016
by
INADA Naoki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28023: Fix python-gdb.py didn't support new dict implementation
parent
c0eb6e93
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
Lib/test/test_gdb.py
Lib/test/test_gdb.py
+3
-6
Misc/NEWS
Misc/NEWS
+5
-0
Tools/gdb/libpython.py
Tools/gdb/libpython.py
+26
-2
No files found.
Lib/test/test_gdb.py
View file @
ad817abb
...
@@ -11,9 +11,6 @@ import sysconfig
...
@@ -11,9 +11,6 @@ import sysconfig
import
unittest
import
unittest
import
locale
import
locale
# FIXME: issue #28023
raise
unittest
.
SkipTest
(
"FIXME: issue #28023, compact dict (issue #27350) broke python-gdb.py"
)
# Is this Python configured to support threads?
# Is this Python configured to support threads?
try
:
try
:
import
_thread
import
_thread
...
@@ -296,9 +293,8 @@ class PrettyPrintTests(DebuggerTests):
...
@@ -296,9 +293,8 @@ class PrettyPrintTests(DebuggerTests):
'Verify the pretty-printing of dictionaries'
'Verify the pretty-printing of dictionaries'
self
.
assertGdbRepr
({})
self
.
assertGdbRepr
({})
self
.
assertGdbRepr
({
'foo'
:
'bar'
},
"{'foo': 'bar'}"
)
self
.
assertGdbRepr
({
'foo'
:
'bar'
},
"{'foo': 'bar'}"
)
# PYTHONHASHSEED is need to get the exact item order
# Python preserves insertion order since 3.6
if
not
sys
.
flags
.
ignore_environment
:
self
.
assertGdbRepr
({
'foo'
:
'bar'
,
'douglas'
:
42
},
"{'foo': 'bar', 'douglas': 42}"
)
self
.
assertGdbRepr
({
'foo'
:
'bar'
,
'douglas'
:
42
},
"{'douglas': 42, 'foo': 'bar'}"
)
def
test_lists
(
self
):
def
test_lists
(
self
):
'Verify the pretty-printing of lists'
'Verify the pretty-printing of lists'
...
@@ -819,6 +815,7 @@ id(42)
...
@@ -819,6 +815,7 @@ id(42)
)
)
self
.
assertIn
(
'Garbage-collecting'
,
gdb_output
)
self
.
assertIn
(
'Garbage-collecting'
,
gdb_output
)
@
unittest
.
skip
(
"FIXME: builtin method is not shown in py-bt and py-bt-full"
)
@
unittest
.
skipIf
(
python_is_optimized
(),
@
unittest
.
skipIf
(
python_is_optimized
(),
"Python was compiled with optimizations"
)
"Python was compiled with optimizations"
)
# Some older versions of gdb will fail with
# Some older versions of gdb will fail with
...
...
Misc/NEWS
View file @
ad817abb
...
@@ -13,6 +13,11 @@ Core and Builtins
...
@@ -13,6 +13,11 @@ Core and Builtins
Library
Library
-------
-------
Tools/Demos
-----------
- Issue #28023: Fix python-gdb.py didn'
t
support
new
dict
implementation
.
What
's New in Python 3.6.0 beta 4
What
's New in Python 3.6.0 beta 4
=================================
=================================
...
...
Tools/gdb/libpython.py
View file @
ad817abb
...
@@ -666,8 +666,9 @@ class PyDictObjectPtr(PyObjectPtr):
...
@@ -666,8 +666,9 @@ class PyDictObjectPtr(PyObjectPtr):
'''
'''
keys
=
self
.
field
(
'ma_keys'
)
keys
=
self
.
field
(
'ma_keys'
)
values
=
self
.
field
(
'ma_values'
)
values
=
self
.
field
(
'ma_values'
)
for
i
in
safe_range
(
keys
[
'dk_size'
]):
entries
,
nentries
=
self
.
_get_entries
(
keys
)
ep
=
keys
[
'dk_entries'
].
address
+
i
for
i
in
safe_range
(
nentries
):
ep
=
entries
[
i
]
if
long
(
values
):
if
long
(
values
):
pyop_value
=
PyObjectPtr
.
from_pyobject_ptr
(
values
[
i
])
pyop_value
=
PyObjectPtr
.
from_pyobject_ptr
(
values
[
i
])
else
:
else
:
...
@@ -707,6 +708,29 @@ class PyDictObjectPtr(PyObjectPtr):
...
@@ -707,6 +708,29 @@ class PyDictObjectPtr(PyObjectPtr):
pyop_value
.
write_repr
(
out
,
visited
)
pyop_value
.
write_repr
(
out
,
visited
)
out
.
write
(
'}'
)
out
.
write
(
'}'
)
def
_get_entries
(
self
,
keys
):
dk_size
=
int
(
keys
[
'dk_size'
])
try
:
# <= Python 3.5
return
keys
[
'dk_entries'
],
dk_size
except
gdb
.
error
:
# >= Python 3.6
pass
if
dk_size
<=
0xFF
:
offset
=
dk_size
elif
dk_size
<=
0xFFFF
:
offset
=
2
*
dk_size
elif
dk_size
<=
0xFFFFFFFF
:
offset
=
4
*
dk_size
else
:
offset
=
8
*
dk_size
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'
])
class
PyListObjectPtr
(
PyObjectPtr
):
class
PyListObjectPtr
(
PyObjectPtr
):
_typename
=
'PyListObject'
_typename
=
'PyListObject'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment