This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: gdb/libpython.py does not work with gdb 7.2
Type: behavior Stage: patch review
Components: Demos and Tools Versions: Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: belopolsky Nosy List: Mariatta, belopolsky, vstinner
Priority: normal Keywords:

Created on 2017-03-01 02:36 by belopolsky, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 363 merged belopolsky, 2017-03-01 02:48
PR 363 merged belopolsky, 2017-03-01 02:48
PR 534 merged Mariatta, 2017-03-07 04:00
Messages (7)
msg288730 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2017-03-01 02:36
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'
...
msg288752 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-03-01 09:52
It's a regression introduced in Python 3.6 by CPython change:
https://github.com/python/cpython/commit/d7d2bc8798da3b083e383e949ba01d61b78e4e4d

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
msg288757 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2017-03-01 14:59
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
msg290279 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-03-24 22:44
New changeset 23b26c4e206427a9e0a1d39240c17a049cf8c732 by Mariatta in branch '3.6':
Fixes bpo-29680: Older gdb does not have gdb.error. (GH-363) (GH-534)
https://github.com/python/cpython/commit/23b26c4e206427a9e0a1d39240c17a049cf8c732
msg290286 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-03-24 22:49
PR has been merged and backported into 3.6.

If there is nothing else, please close this :)

Thanks.
msg290352 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2017-03-24 23:30
New changeset 661ca8843fed1183e38db06e52d59ac300bf1c2a by Lev Abalkin in branch 'master':
Fixes bpo-29680: Older gdb does not have gdb.error. (#363)
https://github.com/python/cpython/commit/661ca8843fed1183e38db06e52d59ac300bf1c2a
msg290587 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-03-27 11:21
@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 610f5d739dd22bce352bde59dce3985c73aaefab. Should we change this line as well?
History
Date User Action Args
2022-04-11 14:58:43adminsetgithub: 73866
2017-03-27 11:21:30vstinnersetmessages: + msg290587
2017-03-24 23:30:24belopolskysetmessages: + msg290352
2017-03-24 22:49:03Mariattasetmessages: + msg290286
2017-03-24 22:44:01Mariattasetnosy: + Mariatta
messages: + msg290279
2017-03-07 04:00:00Mariattasetpull_requests: + pull_request442
2017-03-01 14:59:32belopolskysetmessages: + msg288757
2017-03-01 09:52:05vstinnersetmessages: + msg288752
versions: + Python 3.7
2017-03-01 03:49:36belopolskysetcomponents: + Demos and Tools
stage: patch review
2017-03-01 02:48:36belopolskysetpull_requests: + pull_request309
2017-03-01 02:48:36belopolskysetpull_requests: + pull_request308
2017-03-01 02:47:39belopolskysetnosy: + vstinner
2017-03-01 02:36:44belopolskycreate