Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-gdb.py fails with TypeError("'FakeRepr' object is not subscriptable") is gdb fails to read debug symbols #79170

Closed
vstinner opened this issue Oct 15, 2018 · 7 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes

Comments

@vstinner
Copy link
Member

BPO 34989
Nosy @vstinner, @miss-islington
PRs
  • bpo-34989: python-gdb.py: fix current_line_num() #9889
  • [3.7] bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) #9897
  • [3.6] bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) #9898
  • [2.7] bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) #9899
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-10-16.10:38:22.027>
    created_at = <Date 2018-10-15.11:11:42.908>
    labels = ['3.7', '3.8']
    title = 'python-gdb.py fails with TypeError("\'FakeRepr\' object is not subscriptable") is gdb fails to read debug symbols'
    updated_at = <Date 2018-10-16.10:38:22.008>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2018-10-16.10:38:22.008>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-10-16.10:38:22.027>
    closer = 'vstinner'
    components = ['Demos and Tools']
    creation = <Date 2018-10-15.11:11:42.908>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34989
    keywords = ['patch']
    message_count = 7.0
    messages = ['327742', '327744', '327788', '327791', '327792', '327796', '327818']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'miss-islington']
    pr_nums = ['9889', '9897', '9898', '9899']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue34989'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @vstinner
    Copy link
    Member Author

    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.

    @vstinner vstinner added 3.7 (EOL) end of life 3.8 only security fixes labels Oct 15, 2018
    @vstinner
    Copy link
    Member Author

    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.)

    @vstinner
    Copy link
    Member Author

    New changeset 2e438cc by Victor Stinner in branch 'master':
    bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)
    2e438cc

    @miss-islington
    Copy link
    Contributor

    New changeset fcea3dd by Miss Islington (bot) in branch '3.7':
    bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)
    fcea3dd

    @miss-islington
    Copy link
    Contributor

    New changeset 71e601e by Miss Islington (bot) in branch '3.6':
    bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)
    71e601e

    @vstinner
    Copy link
    Member Author

    New changeset aadb44e by Victor Stinner in branch '2.7':
    bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) (GH-9899)
    aadb44e

    @vstinner
    Copy link
    Member Author

    Thanks Łukasz Langa for the review!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants