How to traceback call stack on MIPS arch?

Andrew Haley
Wed Jan 9 14:08:00 GMT 2008

David Daney writes:
 > Andrew Haley wrote:
 > > PRC writes:
 > >
 > >  > Gcc saves the frame pointer to fp(s8) register at the beginning of
 > >  > each function if compiling source with -O0.  But it won't do so if
 > >  > compiling source with -O2. Without frame pointers, can I trace back
 > >  > call stacks in current function context? Or is there any option
 > >  > which forces gcc to save frame pointers for MIPS arch?
 > >
 > > You need to use the unwinder.
 > >   
 > For that to work, you must compile all the code with -fexceptions.

Or just -funwind-tables.  Yes, I should have mentioned that.  It's
kinda lame that we break the old way of doing backtraces but don't
compile the minimum unwinder data by default.  Sigh.

 > You could also try compiling all the code with -fno-omit-framepointer
 > and writing your own unwinder.  I posted such an unwinder to
 > several years ago.  Later versions of GCC are
 > starting to do optimizations in the function prolog that make unwinding
 > without the unwinder meta-data very difficult.

Right, which as far as I can see is the OP's problem.


Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903

More information about the Gcc-help mailing list