classification
Title: python-gdb.py fails with TypeError("'FakeRepr' object is not subscriptable") is gdb fails to read debug symbols
Type: Stage: resolved
Components: Demos and Tools Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2018-10-15 11:11 by vstinner, last changed 2018-10-16 10:38 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9889 merged vstinner, 2018-10-15 11:23
PR 9897 merged miss-islington, 2018-10-15 21:21
PR 9898 merged miss-islington, 2018-10-15 21:21
PR 9899 merged vstinner, 2018-10-15 21:30
Messages (7)
msg327742 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-15 11:11
On Fedora 28, gdb fails to read (some?) debug symbols:
"Dwarf Error: could not find partial DIE containing offset 0x316 [in module /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug]"
https://bugzilla.redhat.com/show_bug.cgi?id=1613614

In this case, the "py-bt" command of python-gdb.py fails with a TypeError:

(gdb) py-bt
Traceback (most recent call first):
  <unknown at remote 0x7ffff7e5f7e0>
Python Exception <class 'TypeError'> 'FakeRepr' object is not subscriptable: 
Error occurred in Python command: 'FakeRepr' object is not subscriptable


python-gdb.py shouldn't fail on such case, but handle the error.

Attached PR fix this issue.
msg327744 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-15 11:26
The bug can be reproduced using this change:


diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index bf4047419e..f973d4d4bd 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -402,6 +402,7 @@ class PyObjectPtr(object):
         the pointer accordingly.
         '''
         try:
+            raise RuntimeError
             p = PyObjectPtr(gdbval)
             cls = cls.subclass_from_type(p.type())
             return cls(gdbval, cast_to=cls.get_gdb_type())


(Don't forget to run "make" again to copy Tools/gdb/libpython.py to python-gdb.py.)
msg327788 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-15 21:20
New changeset 2e438cc2554495b28480a3ffe5cdf41b6ab823a0 by Victor Stinner in branch 'master':
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)
https://github.com/python/cpython/commit/2e438cc2554495b28480a3ffe5cdf41b6ab823a0
msg327791 - (view) Author: miss-islington (miss-islington) Date: 2018-10-15 21:48
New changeset fcea3ddc4a7e756fa8f182789e886ccd3d524484 by Miss Islington (bot) in branch '3.7':
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)
https://github.com/python/cpython/commit/fcea3ddc4a7e756fa8f182789e886ccd3d524484
msg327792 - (view) Author: miss-islington (miss-islington) Date: 2018-10-15 21:50
New changeset 71e601eb0857fb03c1dd3c349afb030ef84f95d0 by Miss Islington (bot) in branch '3.6':
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)
https://github.com/python/cpython/commit/71e601eb0857fb03c1dd3c349afb030ef84f95d0
msg327796 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-15 22:06
New changeset aadb44ee98bc73bc5132acea5848ac6aef1ff8c0 by Victor Stinner in branch '2.7':
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) (GH-9899)
https://github.com/python/cpython/commit/aadb44ee98bc73bc5132acea5848ac6aef1ff8c0
msg327818 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-16 10:38
Thanks Łukasz Langa for the review!
History
Date User Action Args
2018-10-16 10:38:22vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg327818

stage: patch review -> resolved
2018-10-15 22:06:34vstinnersetmessages: + msg327796
2018-10-15 21:50:45miss-islingtonsetmessages: + msg327792
2018-10-15 21:48:01miss-islingtonsetnosy: + miss-islington
messages: + msg327791
2018-10-15 21:30:07vstinnersetpull_requests: + pull_request9261
2018-10-15 21:21:58miss-islingtonsetpull_requests: + pull_request9260
2018-10-15 21:21:23miss-islingtonsetpull_requests: + pull_request9259
2018-10-15 21:20:01vstinnersetmessages: + msg327788
2018-10-15 11:26:28vstinnersetmessages: + msg327744
2018-10-15 11:23:29vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request9252
2018-10-15 11:11:42vstinnercreate