[Python-Dev] Re: Mixed Python/C debugging
"Debugging a Mixed Python and C Language Stack" (2023) https://developer.nvidia.com/blog/debugging-mixed-python-and-c-language-stack/ https://news.ycombinator.com/item?id=35706687 On Mon, Dec 2, 2019, 10:59 AM Skip Montanaro wrote: > Thanks for the responses. I know there are multiple tools out there (to > wit, Wes's response), but I'm really after what people actually use and > find works. I apologize that wasn't clear. I did neglect to mention that my > environment is Linux (specifically Ubuntu 18.04), so Windows-based > solutions aren't likely to be workable for me. > > For the time being, I've been working through one or two of the > docs/tutorials about the parsing/compiler internals which focus on the C > side, so gdb with curses display enabled (Ctrl-X a) and built-in PyObject > support has been sufficient. I will eventually need mixed language > debugging though. And, as an Emacs user, how this might play in that > sandbox is of interest. > > Skip > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/IZRJX3YYOBJWJ6UAE5PIAJBPKB7IOHS2/ > Code of Conduct: http://python.org/psf/codeofconduct/ > ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/WSJWVGLZKF3JD7Y6LDHWYKAT3AJ7LETS/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Mixed Python/C debugging
Thanks for the responses. I know there are multiple tools out there (to wit, Wes's response), but I'm really after what people actually use and find works. I apologize that wasn't clear. I did neglect to mention that my environment is Linux (specifically Ubuntu 18.04), so Windows-based solutions aren't likely to be workable for me. For the time being, I've been working through one or two of the docs/tutorials about the parsing/compiler internals which focus on the C side, so gdb with curses display enabled (Ctrl-X a) and built-in PyObject support has been sufficient. I will eventually need mixed language debugging though. And, as an Emacs user, how this might play in that sandbox is of interest. Skip ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/IZRJX3YYOBJWJ6UAE5PIAJBPKB7IOHS2/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Mixed Python/C debugging
Same here, I do Pycharm and it is possible to add clion plugin and go through C code ... On Mon, Dec 2, 2019 at 8:34 AM Fabio Zadrozny wrote: > Hi Skip, > > I just wanted to note that what I usually do in this case is having 2 > debuggers attached. > > i.e.: start one any way you want and then do an attach to from the other > debugger -- in my case as I'm usually on the Python side I usually start > the Python debugger and then do an attach to from the C++ IDE, but you can > probably do it the other way around too :) > > On Sun, Dec 1, 2019 at 1:57 PM Skip Montanaro > wrote: > >> Having tried comp.lang.python with no response, I turn here... >> >> After at least ten years away from Python's run-time interpreter & >> byte code compiler, I'm getting set to familiarize myself with that >> again. This will, I think, entail debugging a mixed Python/C >> environment. I'm an Emacs user and am aware that GDB since 7.0 has >> support for debugging at the Python code level. Is Emacs+GDB my best >> bet? Are there any Python IDEs which support C-level breakpoints and >> debugging? >> >> Thanks, >> >> Skip >> ___ >> Python-Dev mailing list -- python-dev@python.org >> To unsubscribe send an email to python-dev-le...@python.org >> https://mail.python.org/mailman3/lists/python-dev.python.org/ >> Message archived at >> https://mail.python.org/archives/list/python-dev@python.org/message/L2KBZM64MYPXIITN4UU3X6L4PZS2YRTB/ >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/ZJOFXW2K42YUMP3MQY6POBLRJKMU2BLU/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- Aleksandar Kacanski ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/AJ2CBQDHOALBBK3F6YCJ42V34SF6HH3K/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Mixed Python/C debugging
Hi Skip, I just wanted to note that what I usually do in this case is having 2 debuggers attached. i.e.: start one any way you want and then do an attach to from the other debugger -- in my case as I'm usually on the Python side I usually start the Python debugger and then do an attach to from the C++ IDE, but you can probably do it the other way around too :) On Sun, Dec 1, 2019 at 1:57 PM Skip Montanaro wrote: > Having tried comp.lang.python with no response, I turn here... > > After at least ten years away from Python's run-time interpreter & > byte code compiler, I'm getting set to familiarize myself with that > again. This will, I think, entail debugging a mixed Python/C > environment. I'm an Emacs user and am aware that GDB since 7.0 has > support for debugging at the Python code level. Is Emacs+GDB my best > bet? Are there any Python IDEs which support C-level breakpoints and > debugging? > > Thanks, > > Skip > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/L2KBZM64MYPXIITN4UU3X6L4PZS2YRTB/ > Code of Conduct: http://python.org/psf/codeofconduct/ > ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/ZJOFXW2K42YUMP3MQY6POBLRJKMU2BLU/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Mixed Python/C debugging
Your question is specifically about IDEs with support for mixed-mode debugging (with gdb), so I went looking for an answer: https://wiki.python.org/moin/DebuggingWithGdb (which is not responsive and almost unreadable on a mobile device) links to https://fedoraproject.org/wiki/Features/EasierPythonDebugging , which mentions the py-list, py-up and py-down, py-bt, py-print, and py-locals GDB commands that are also described in ** https://devguide.python.org/gdb/ ** https://wiki.python.org/moin/PythonDebuggingTools Ctrl-F "gdb" mentions: DDD, pyclewn (vim), trepan3k (which is gdb-like and supports breaking at c-line and also handles bytecode disassembly) Apparently, GHIDRA does not have a debugger but there is a plugin for following along with gdb in ghidra called https://github.com/Comsecuris/gdbghidra , which may or may not be useful. https://github.com/Mistobaan/pyclewn hasn't been updated in years, but may have useful bits for implementing mixed-mode debugging in other non-vim IDEs. https://reverseengineering.stackexchange.com/questions/1392/decent-gui-for-gdb lists a number of GUIs for GDB; including voltronnn: > There's Voltron, which is an extensible Python debugger UI that supports LLDB, GDB, VDB, and WinDbg/CDB (via PyKD) and runs on macOS, Linux and Windows. For the first three it supports x86, x86_64, and arm with even arm64 support for lldb while adding even powerpc support for gdb. https://github.com/snare/voltron https://developers.redhat.com/blog/2017/11/10/gdb-python-api/ describes the GDB Python API. https://pythonextensionpatterns.readthedocs.io/en/latest/debugging/debug_in_ide.html#writing-a-c-function-to-call-any-python-unit-test may be helpful. Does DDD support mixed-mode debugging? https://www.gnu.org/software/ddd/manual/html_mono/ddd.html Essentially, for IDE support, AFAIU, the basic functionality is: - set breakpoints: `b c-file.c:123` - step through them while seeking-to and highlighting the current breakpoint - provide one or more panes for executing GDB commands within the current or other frames The GDB Python API docs: https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html The devguide gdb page may be the place to list IDEs with support for mixed-mode debugging of Python and C/C++/Cython specifically with gdb? On Sunday, December 1, 2019, Skip Montanaro wrote: > Having tried comp.lang.python with no response, I turn here... > > After at least ten years away from Python's run-time interpreter & > byte code compiler, I'm getting set to familiarize myself with that > again. This will, I think, entail debugging a mixed Python/C > environment. I'm an Emacs user and am aware that GDB since 7.0 has > support for debugging at the Python code level. Is Emacs+GDB my best > bet? Are there any Python IDEs which support C-level breakpoints and > debugging? > > Thanks, > > Skip > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/L2KBZM64MYPXIITN4UU3X6L4PZS2YRTB/ > Code of Conduct: http://python.org/psf/codeofconduct/ > ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/Z3S2RAXRIHAWT6JEOXEBPPBTPUTMDZI7/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: Mixed Python/C debugging
Python Tools for Visual Studio has supported mixed mode debugging for a while... I'm not sure if that support would have ever ended up in VS Code Python extension so it might be a windows only solution which might not help you much. On Sun, Dec 1, 2019, 9:04 AM Skip Montanaro wrote: > Having tried comp.lang.python with no response, I turn here... > > After at least ten years away from Python's run-time interpreter & > byte code compiler, I'm getting set to familiarize myself with that > again. This will, I think, entail debugging a mixed Python/C > environment. I'm an Emacs user and am aware that GDB since 7.0 has > support for debugging at the Python code level. Is Emacs+GDB my best > bet? Are there any Python IDEs which support C-level breakpoints and > debugging? > > Thanks, > > Skip > ___ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/L2KBZM64MYPXIITN4UU3X6L4PZS2YRTB/ > Code of Conduct: http://python.org/psf/codeofconduct/ > ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/6YC4WHAEQH556FNFZRDVO2IIJ37GRHCG/ Code of Conduct: http://python.org/psf/codeofconduct/