This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: How to traceback call stack on MIPS arch?


-fno-omit-frame-pointer may be what I want, since the programs are running
in a native embeded system without glibc.
I have read the gcc manual and noticed the option -fomit-frame-pointer. But
the manual says nothing about -fno-omit-frame-pointer. Is it a default 
convention that each -fxxx option has a -fno-xxx counterpart?
----------------------------------------------------------
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.

You could also try compiling all the code with -fno-omit-framepointer
and writing your own unwinder.  I posted such an unwinder to
java-patches@gcc.gnu.org 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.

David Daney


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]