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

doc: Add debugging tips? #1690

Open
eacousineau opened this issue Feb 12, 2019 · 7 comments
Open

doc: Add debugging tips? #1690

eacousineau opened this issue Feb 12, 2019 · 7 comments

Comments

@eacousineau
Copy link
Contributor

Doing a quick search of "debugging" doesn't bring up too much in the pybind11 docs.

For the repo that I work on, we've found it useful to document some debugging tips that are relevant to Python C extensions:
https://drake.mit.edu/python_bindings.html#debugging-with-the-python-bindings

Perhaps some mention of using trace, perhaps a small example with GDB would go a long ways?
For GDB, it'd be nice to show (a) debugging a module and (b) debugging a C++ binary with an embedded interpreter.
I find that for hacking directly on pybind11 (in things like #1325 and #1146), it's uber useful to plop into Python via an embedded interpreter, rather than debugging through the python executable itsefl.

@SuperShinyEyes
Copy link

I'd like to know how to debug the C++ code that are invoked by Python code in a similar fashion to pdb. Is there any canonical way of doing this?

@jdumas
Copy link

jdumas commented Oct 15, 2019

Would love to see some examples as well. Currently I'm running some C++ code through python, a std:runtime_error() is thrown in C++, but when I type bt in gdb it shows No stack, so I'm a bit stuck on what to do.

@EricCousineau-TRI
Copy link
Collaborator

Low-speed follow-up, but I added some basic stuff in our fork here:
RobotLocomotion#33 (comment)

Will PR some of it here, but not sure where exactly to put the docs.

@bstaletic
Copy link
Collaborator

Here's an idea. Why not put the debugging tips in the community-editable github wiki?

@wjakob
Copy link
Member

wjakob commented Jul 7, 2020

I've turned the Wiki on just now, let's see if people find it useful.

@EricCousineau-TRI
Copy link
Collaborator

Hm... Concern about the Wiki is it's kinda unclear when to add to docs vs. Wiki; but yeah, I'll do a first pass on Wiki!

@EricCousineau-TRI
Copy link
Collaborator

Made a first low-effort pass 😅
https://github.com/pybind/pybind11/wiki/Debugging-segfaults-and-hard-to-decipher-pybind11-bugs

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

No branches or pull requests

6 participants