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 section is not up to date #1056

Closed
ogrisel opened this issue Feb 22, 2023 · 6 comments
Closed

GDB section is not up to date #1056

ogrisel opened this issue Feb 22, 2023 · 6 comments
Labels

Comments

@ogrisel
Copy link

ogrisel commented Feb 22, 2023

The section about configuring gdb to enable python-aware debugging does not seem up to date:

In particular it assumes that there exists a file named python-gdb.py at the root of a checkout of the CPython source tree and that it is therefore enough to add add-auto-load-safe-path /path/to/checkout to the $HOME/.gdbinit file to get the py-bt command working for instance.

However, I cannot locate the python-gdb.py file in the cpython repo. Instead I found:

so I assume, that the correct way to enable the python specific commands is to do:

gdb python --args my_python_script.py
source /path/to/cpython/Tools/gdb/libpython.py

or maybe, the Tools/gdb/libpython.py file should be symlinked as python-gdb.py somewhere and then add the add-auto-load-safe-path directive pointing to the parent folder of the symlink for gdb to automatically load it (but apparently this does not seem to work).

I am not familiar enough with gdb to know how to fix the documentation.

@ogrisel ogrisel changed the title GDB section GDB section is not up to date Feb 22, 2023
@CAM-Gerlach
Copy link
Member

Thanks for the detailed report, and sorry for the trouble! I've pinged our GDB subject matter experts to take a look at this and recommend what to do about it.

@ogrisel
Copy link
Author

ogrisel commented Feb 22, 2023

Note: maybe turning the filename(s) into links would make it possible to automatically detect such problems in the future (as done in #1003).

@markshannon
Copy link
Member

When building CPython with make, python-gdb.py will be installed for you.
If you are debugging a CPython that you haven't built yourself, just copy /Tools/gdb/libpython.py to python-gdb.py.

@carljm
Copy link
Member

carljm commented Feb 22, 2023

Specifically, see the gdbhooks target in the Makefile, which is a dependency of the default target.

@carljm carljm closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2023
@CAM-Gerlach
Copy link
Member

I see the docs do currently imply this:

When CPython is built you will notice a python-gdb.py file in the root directory of your checkout.

Perhaps it could use a brief note or a more explicit mention, though, if users are getting confused here?

@carljm
Copy link
Member

carljm commented Feb 23, 2023

Perhaps it could use a brief note or a more explicit mention, though, if users are getting confused here?

I wouldn't stand in the way, but personally I'd wait for n>1 before spending time on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants