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. #include <unwind.h> #include <stdio.h> static _Unwind_Reason_Code backtrace_helper (struct _Unwind_Context *ctx, void *a) { void *ip = (void*)_Unwind_GetIP (ctx); fprintf (stdout, " %p\n", ip); return _URC_NO_REASON; } void print_backtrace (void) { _Unwind_Backtrace (backtrace_helper, NULL); } int main (int argc, char **argv) { print_backtrace (); return 0; } -- Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK Registered in England and Wales No. 3798903