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

gdb/libpython.py does not work with gdb 7.2 #73866

Closed
abalkin opened this issue Mar 1, 2017 · 8 comments
Closed

gdb/libpython.py does not work with gdb 7.2 #73866

abalkin opened this issue Mar 1, 2017 · 8 comments
Assignees
Labels
3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error

Comments

@abalkin
Copy link
Member

abalkin commented Mar 1, 2017

BPO 29680
Nosy @abalkin, @vstinner, @Mariatta
PRs
  • bpo-29680: Older gdb does not have gdb.error. #363
  • bpo-29680: Older gdb does not have gdb.error. #363
  • [3.6] Fixes bpo-29680: Older gdb does not have gdb.error. (#363) #534
  • 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 = 'https://github.com/abalkin'
    closed_at = None
    created_at = <Date 2017-03-01.02:36:44.303>
    labels = ['type-bug', '3.7']
    title = 'gdb/libpython.py does not work with gdb 7.2'
    updated_at = <Date 2017-03-27.11:21:30.157>
    user = 'https://github.com/abalkin'

    bugs.python.org fields:

    activity = <Date 2017-03-27.11:21:30.157>
    actor = 'vstinner'
    assignee = 'belopolsky'
    closed = False
    closed_date = None
    closer = None
    components = ['Demos and Tools']
    creation = <Date 2017-03-01.02:36:44.303>
    creator = 'belopolsky'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 29680
    keywords = []
    message_count = 7.0
    messages = ['288730', '288752', '288757', '290279', '290286', '290352', '290587']
    nosy_count = 3.0
    nosy_names = ['belopolsky', 'vstinner', 'Mariatta']
    pr_nums = ['363', '363', '534']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29680'
    versions = ['Python 3.6', 'Python 3.7']

    @abalkin
    Copy link
    Member Author

    abalkin commented Mar 1, 2017

    Printing the backtrace in gdb results in Python errors:

    (gdb) bt
    ...
    #6  0x00007ffff7ba9745 in _PyEval_EvalCodeWithName (_co=<code at remote 0x7ffff1983f40>, globals=Traceback (most recent call last):
      File "/home/a/.virtualenvs/3.6g/bin/python3.6-gdb.py", line 1358, in to_string
        return pyop.get_truncated_repr(MAX_OUTPUT_LEN)
      File "/home/a/.virtualenvs/3.6g/bin/python3.6-gdb.py", line 243, in get_truncated_repr
        self.write_repr(out, set())
      File "/home/a/.virtualenvs/3.6g/bin/python3.6-gdb.py", line 702, in write_repr
        for pyop_key, pyop_value in self.iteritems():
      File "/home/a/.virtualenvs/3.6g/bin/python3.6-gdb.py", line 669, in iteritems
        entries, nentries = self._get_entries(keys)
      File "/home/a/.virtualenvs/3.6g/bin/python3.6-gdb.py", line 717, in _get_entries
        except gdb.error:
    AttributeError: 'module' object has no attribute 'error'
    ...

    @abalkin abalkin self-assigned this Mar 1, 2017
    @abalkin abalkin added the type-bug An unexpected behavior, bug, or error label Mar 1, 2017
    @vstinner
    Copy link
    Member

    vstinner commented Mar 1, 2017

    It's a regression introduced in Python 3.6 by CPython change:
    d7d2bc8

    gdb.error was introduced in gdb 7.3 by the commit 07ca107c2d958b45633ef0cdcce7219a95f0cf01:
    https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;f=gdb/python/python.c;h=07ca107c2d958b45633ef0cdcce7219a95f0cf01

    @vstinner vstinner added the 3.7 (EOL) end of life label Mar 1, 2017
    @abalkin
    Copy link
    Member Author

    abalkin commented Mar 1, 2017

    Victor, the gdb commit that you mentioned introduced gdb.GdbError which is different from gdb.error. [1] The correct commit is 621c83642d17cf523c20f55f2ed945a7ec95ea6a. [2]

    [1] https://sourceware.org/gdb/current/onlinedocs/gdb/Exception-Handling.html#Exception-Handling
    [2] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=621c83642d17cf523c20f55f2ed945a7ec95ea6a

    @Mariatta
    Copy link
    Member

    New changeset 23b26c4 by Mariatta in branch '3.6':
    Fixes bpo-29680: Older gdb does not have gdb.error. (GH-363) (GH-534)
    23b26c4

    @Mariatta
    Copy link
    Member

    PR has been merged and backported into 3.6.

    If there is nothing else, please close this :)

    Thanks.

    @abalkin
    Copy link
    Member Author

    abalkin commented Mar 24, 2017

    New changeset 661ca88 by Lev Abalkin in branch 'master':
    Fixes bpo-29680: Older gdb does not have gdb.error. (#363)
    661ca88

    @vstinner
    Copy link
    Member

    @belopolsky: Tools/gdb/libpython.py still uses gdb.error in gdb.selected_frame():

        try:
            frame = cls.get_selected_frame()
        except gdb.error:
            # No frame: Python didn't start yet
            return None
    

    See my commit 610f5d7. Should we change this line as well?

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @kumaraditya303
    Copy link
    Contributor

    Fixed by #363

    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 type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants