You are not logged in.
I try to debug a python script with gdb and found plenty of resources online.
The problem is that with arch you have to recompile packages and their dependencies:
https://wiki.archlinux.org/index.php/De … ing_Traces
What i tried:
I replaced my python with python-dbg, installed cython, ran my python script.
Then 'sudo gdb -p $PID' and '<gdb> py-bt'
I get the command 'py-bt' is undefined.
I don't know what packages I should recompile. I think gdb has python support enabled by default.
According to the instructions there should be some scripts in
/usr/share/gdb/auto-load/usr/bin
but there's only a ../lib folder containing four unrelated python scripts (glib, gobject, gstreamer, stdc++)
I wish there was a simple solution like 'debuginfo-install' ![]()
https://www.podoliaka.org/2016/04/10/de … ython-gdb/
https://www.reddit.com/r/archlinux/comm … _packages/
https://bbs.archlinux.org/viewtopic.php?id=194461
Last edited by pyatsinot (2020-07-22 09:21:21)
Offline
Could you give some information about what sort of script is the target of debugging?
My understanding is that those debugging symbols are needed to get meaningful backtraces in case of compiled binaries. As long as pure-python modules are involved, the standard "pdb" should be quite straightforward. Also, ipython and spyder could help during development.
Offline
I tested with a minimal plain python script. You are right, pdb is easier.
But when it comes to cython I need gdb.
The arch way seems quite hard when it comes to debug symbols.
Offline
But when it comes to cython I need gdb.
The arch way seems quite hard when it comes to debug symbols.
I am not sure that I follow. To debug code generated by cython (in gdb), it should have debug information generated by cython itself. According to the cython docs: "The debugger will need debug information that the Cython compiler can export. This can be achieved from within the setup script by passing gdb_debug=True to cythonize():".
If the problem occurs in code which you compile via cython, then it should be possible to add the symbols. Of course, in that case you may also be able to debug the problem in the pure python version (without compiling via cython).
On the other hand, if the problem is in some Arch-provided module compiled with cython, then the easiest may be to identify the offending input with try/catch around those function calls that cannot be debugged. Similarly, when using a library without debugging symbols in C++ I was able to trap the issue before it went "into a dark pit" (alternatively, one may always take the official PKGBUILD and generate a debugging version). As for python, I have been doing some numerical analysis with pandas and numpy, and so far did not run into any limitation coming from debugging.
Offline