Getting Stack Trace on segfault

bernhard.voigt at gmail.com bernhard.voigt at gmail.com
Fri Apr 13 09:22:30 EDT 2007


GDB would could work. Here's how I use it to track down problems in a C
++ program controlled by python.

$ gdb python
GDB starts up, now at the gdb prompt, set the program args

(gdb) set arg testscript.py
(gdb) run
... program running until crash
(gdb) where
gives you the backtrace if you compiled you're module code with debug
options

Cheers! Bernhard


On Apr 11, 10:51 pm, j... at pobox.com (John J. Lee) wrote:
> James Stroud <jstr... at mbi.ucla.edu> writes:
> > Hello All,
>
> > The built-in mac osx vecLib is segfaulting in some cases--A very fun
> > fact to find out the hard way over two nights of work. I also spent an
> > embarrassing amount of time figuring out just where. Although I'm in
> > quite a self-congratulatory mood right now, in the future, I feel like
> > I could save a lot of time by coercing the interpreter to spew forth
> > method calls to stderr. Is this possible?
>
> > I would hope to produce something hauntingly reminiscent of
>
> > [] my_function
> > [my_function] another_function
> > [my_function -> another_function] yet_a_deeper_function
>
> [...]
>
> I remember David Beazley (of SWIG fame) wrote something called WAD
> that claimed to turn segfaults into Python exceptions (hence
> tracebacks).  IIRC it was Linux-specific, and I have no idea how it
> worked.  I guess it could be ported to Windows with SEH, but no idea
> about OS X.
>
> John





More information about the Python-list mailing list