-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
BUG: spin gdb
: launch Python directly so that breakpoint is caught
#24123
Conversation
It seems gdb has an option to follow fork to child processes. The following patch seems to work and it retains that it uses
Fine with the approach in this PR too if you don't think using |
Also my Python install seems to complain about the
|
Yeah, |
OK, take another look please. I have to manipulate the sys.path a bit on Python <3.11 to make it work. Another question about interface: will you always want to run Python code snippets, or should the command allow for arbitrary commands? |
04f9d49
to
6c24303
Compare
For me, I'd want first to check if the argument is a path that exists and then assume that path is a python script, and then don't pass |
482fc0e
to
a752408
Compare
spin gdb
: launch Python directly so that breakpoint is caught
I think the interface is now a bit more intuitive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it would be nice to have a mode where you just do spin gdb my_script.py
and spin
handles constructing the appropriate arguments to do gdb --args python my_script.py
.
My reason for that is admittedly a little niche: with pyenv I need to do things like gdb --args $(pyenv which python) my_script.py
since the python
executable in my path is a shim that delegates to the real python executable and gdb needs the real executable. Having a stronger guarantee that the python
being executed is the same one executing spin
is also nice.
OK, done. |
afaf7c4
to
44bacd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, with the substantive change I suggested spin gdb test.py
"just works" on my setup for a script that imports numpy, then calls os.kill()
on itself. 🎉
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Let's see! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s let someone else test with a different setup before we merge
spin gdb
: launch Python directly so that breakpoint is caughtspin gdb
: launch Python directly so that breakpoint is caught
Possible follow-ups I noticed:
We could extend the help to give tips about setting break-points and start things (maybe even slash down the developer help on it and just say to check Anyway, just noting in case this might spread across many projects really. I might follow-up with running |
Closes #24121