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

Some gdb macros are broken in 3.6 #73859

Closed
abalkin opened this issue Feb 28, 2017 · 10 comments
Closed

Some gdb macros are broken in 3.6 #73859

abalkin opened this issue Feb 28, 2017 · 10 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes

Comments

@abalkin
Copy link
Member

abalkin commented Feb 28, 2017

BPO 29673
Nosy @abalkin, @vstinner, @ned-deily, @stratakis, @Dormouse759
PRs
  • bpo-29673: Some gdb macros are broken in 3.6 #6126
  • [3.7] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) #6399
  • [3.6] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) #6400
  • 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-04-06.22:17:40.069>
    created_at = <Date 2017-02-28.00:02:47.045>
    labels = ['3.7', '3.8']
    title = 'Some gdb macros are broken in 3.6'
    updated_at = <Date 2018-04-06.22:17:40.068>
    user = 'https://github.com/abalkin'

    bugs.python.org fields:

    activity = <Date 2018-04-06.22:17:40.068>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-04-06.22:17:40.069>
    closer = 'ned.deily'
    components = []
    creation = <Date 2017-02-28.00:02:47.045>
    creator = 'belopolsky'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 29673
    keywords = ['patch']
    message_count = 10.0
    messages = ['288684', '288685', '288687', '313954', '314935', '314947', '315033', '315037', '315038', '315039']
    nosy_count = 5.0
    nosy_names = ['belopolsky', 'vstinner', 'ned.deily', 'cstratak', 'Dormouse759']
    pr_nums = ['6126', '6399', '6400']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue29673'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @abalkin
    Copy link
    Member Author

    abalkin commented Feb 28, 2017

    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.

    @abalkin abalkin added the 3.7 (EOL) end of life label Feb 28, 2017
    @abalkin
    Copy link
    Member Author

    abalkin commented Feb 28, 2017

    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.

    @smontanaro
    Copy link
    Contributor

    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.

    @Dormouse759
    Copy link
    Mannequin

    Dormouse759 mannequin commented Mar 16, 2018

    I have created a PR here - #6126

    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.

    @stratakis
    Copy link
    Mannequin

    stratakis mannequin commented Apr 4, 2018

    A PR has been filed, could someone take a look?

    @ned-deily
    Copy link
    Member

    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.

    @ned-deily ned-deily added the 3.8 only security fixes label Apr 4, 2018
    @ned-deily
    Copy link
    Member

    New changeset 3a9ccee by Ned Deily (Marcel Plch) in branch 'master':
    bpo-29673: fix gdb scripts pystack and pystackv (GH-6126)
    3a9ccee

    @ned-deily
    Copy link
    Member

    New changeset 3c193cf by Ned Deily (Miss Islington (bot)) in branch '3.7':
    [3.7] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) (GH-6399)
    3c193cf

    @ned-deily
    Copy link
    Member

    New changeset 3468a05 by Ned Deily (Miss Islington (bot)) in branch '3.6':
    [3.6] bpo-29673: fix gdb scripts pystack and pystackv (GH-6126) (GH-6400)
    3468a05

    @ned-deily
    Copy link
    Member

    Thanks, Marcel, for the fix and thanks, Skip, for the review. Merged for release in 3.6.6 and 3.7.0.

    @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

    3 participants