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.

Title: Some gdb macros are broken in 3.6
Type: Stage: resolved
Components: Versions: Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Dormouse759, belopolsky, cstratak, ned.deily, vstinner
Priority: normal Keywords: patch

Created on 2017-02-28 00:02 by belopolsky, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6126 merged Dormouse759, 2018-03-16 16:20
PR 6399 merged miss-islington, 2018-04-06 21:22
PR 6400 merged miss-islington, 2018-04-06 21:23
Messages (10)
msg288684 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2017-02-28 00:02
Some gdb macros defined in Misc/gdbinit got broken when _PyUnicode_AsString was renamed to PyUnicode_AsUTF8.

(gdb) pystack
No symbol "_PyUnicode_AsString" in current context.
msg288685 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2017-02-28 00:19
I tried to simply replace  _PyUnicode_AsString with PyUnicode_AsUTF8, but it looks like code structure has changed and the pyframe and pystack macros don't work anymore.
msg288687 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2017-02-28 01:59
Note that these macros were always expected to be fragile. They depend to a great extent on the layout of the functions in Python/ceval.c. I've had to tweak them a couple times over the years.

I'm pretty sure the gdb instance I have available to me at work wasn't configured --with-python, and corporate policies would prevent me from downloading the source and building my own private version. For me, Misc/gdbinit is likely to be the best I can do for the foreseeable future. 

If the layout of ceval.c has changed sufficiently between Python 2.x and 3.x, perhaps two versions of gdbinit are warranted, with the version delivered for Python 3 being appropriate for the current release.
msg313954 - (view) Author: Marcel Plch (Dormouse759) * Date: 2018-03-16 16:36
I have created a PR here -

The problem was, indeed, change in the code structure. The macro checked for presence inside of PyEval_EvalFrame() using address of a neighbouring function.
Also, arguments to PyEval_EvalFrame() were changed, so the macro responsible for printing of the frame needed a little tweak.
msg314935 - (view) Author: Charalampos Stratakis (cstratak) * Date: 2018-04-04 14:32
A PR has been filed, could someone take a look?
msg314947 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-04-04 18:14
Thanks for the PR and the ping.  I've sent an email to the python-dev list requesting review help for gdb issues including this one.
msg315033 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-04-06 21:22
New changeset 3a9ccee0e5dbf7d67f5ab79f6095755969db117c by Ned Deily (Marcel Plch) in branch 'master':
bpo-29673: fix gdb scripts pystack and pystackv (GH-6126)
msg315037 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-04-06 22:14
New changeset 3c193cf8afce525b1283986f113de0e16f23e115 by Ned Deily (Miss Islington (bot)) in branch '3.7':
[3.7] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) (GH-6399)
msg315038 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-04-06 22:15
New changeset 3468a05f6a7d730a656d254730a3f5b6b7e85983 by Ned Deily (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) (GH-6400)
msg315039 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-04-06 22:17
Thanks, Marcel, for the fix and thanks, Skip, for the review.  Merged for release in 3.6.6 and 3.7.0.
Date User Action Args
2022-04-11 14:58:43adminsetgithub: 73859
2020-11-11 19:22:04iritkatriellinkissue25460 superseder
2018-04-06 22:17:40ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg315039

stage: patch review -> resolved
2018-04-06 22:15:37ned.deilysetmessages: + msg315038
2018-04-06 22:14:31ned.deilysetmessages: + msg315037
2018-04-06 21:23:16miss-islingtonsetpull_requests: + pull_request6106
2018-04-06 21:22:44miss-islingtonsetpull_requests: + pull_request6105
2018-04-06 21:22:13ned.deilysetmessages: + msg315033
2018-04-04 18:14:24ned.deilysetnosy: + ned.deily

messages: + msg314947
versions: + Python 3.8
2018-04-04 14:32:17cstrataksetmessages: + msg314935
2018-04-04 14:31:22cstrataksetnosy: + cstratak
2018-03-18 21:00:04skip.montanarosetnosy: - skip.montanaro
2018-03-16 16:36:55Dormouse759setnosy: + Dormouse759
messages: + msg313954
2018-03-16 16:20:53Dormouse759setkeywords: + patch
stage: patch review
pull_requests: + pull_request5888
2017-02-28 08:58:55vstinnersetnosy: + vstinner
2017-02-28 02:00:00skip.montanarosetnosy: + skip.montanaro
messages: + msg288687
2017-02-28 00:19:10belopolskysetmessages: + msg288685
2017-02-28 00:02:47belopolskycreate