Re: Debugging Python scripts with GDB on OSX

Wes Turner <[email protected]>
Newsgroups gmane.comp.python.devel,gmane.comp.gdb.devel
Message-ID <CACfEFw_gRmK8+EU90+oCo3bityaDty+ryioxHL5=PpumQQ7arA@mail.gmail.com>
On Friday, October 14, 2016, Alexandru Croitor <[email protected]>
wrote:

> Hi,
>
> pdb is fine for pure python scripts.
>
> I was interested in things like getting the python back trace or local
> variables from inside GDB, when used in conjunction with c++, so that I
> know which parts of C++ calls python functions, and which parts of python
> call c++ functions. You can't do that with pdb.
>

From https://westurner.org/wiki/awesome-python-testing#advanced-debugging :

- https://hg.python.org/cpython/file/tip/Tools/gdb/libpython.py

- https://github.com/lmacken/pyrasite/blob/develop/README.rst mentions
something about codesigned GDB and OSX.
 - https://sourceware.org/gdb/wiki/BuildingOnDarwin

- https://github.com/google/pyringe doesnt mention OSX.

- dtrace probably doesn't help with stack traces or local variables:
  -
https://github.com/benesch/python-dtrace-tracker/blob/master/dtrace-osx-apple.27.patch

Are there error messages?



>
> On 13 Oct 2016, at 19:12, Christian Tismer <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
> Hi Alexandru,
>
> I stumbled over this question a little late by chance.
>
> There is the possibility to use GDB, but it is most likely that you want
> to use python's pdb module, instead.
>
> Only in rare cases, when debugging the interpreter itself, you use gdb.
> For debugging Python code, use pdb or something better.
>
> Sent from my Ei4Steve
>
> On Jul 6, 2016, at 18:14, Alexandru Croitor <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
> Hello,
>
> I'm interested to find out if debugging Python scripts with GDB is
> supported on OSX at all?
>
> I'm referring to the functionality described on https://wiki.python.org/
> moin/DebuggingWithGdb and on http://fedoraproject.org/wiki/Features/
> EasierPythonDebugging.
>
> I've tried so far various combinations of pre-compiled GDB from the
> homebrew package manager, locally-compiled GDB from homebrew, as well as
> locally compiled GDB from MacPorts, together with a pre-compiled Python
> 2.7, homebrew-compiled 2.7, and custom compiled Python 2.7 from the
> official source tarball.
>
> My results so far were not successful. The legacy GDB commands to show a
> python stack trace or the local variables - do not work. And the new GDB
> commands (referenced on the Fedora project page) are not present at all in
> any of the GDB versions.
>
> I've checked the python CI build bot tests, and it seems the new GDB
> commands are only successfully tested on Linux machines, and are skipped on
> FreeBSD, OS X, and Solaris machines.
>
> Are the new python <-> GDB commands specific to Linux?
> Are there any considerations to take in regards to debug symbols for
> Python / GDB on OSX?
>
> Has anyone attempted what I'm trying to do?
>
> I would be grateful for any advice.
>
> And I apologize if my choice of the mailing lists is not the best.
>
> Regards, Alex.
>
>
> _______________________________________________
> Python-Dev mailing list
> [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> tismer%40stackless.com
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.