https://sourceware.org/bugzilla/show_bug.cgi?id=16396
--- Comment #2 from DongBiao <dongbiao830415 at foxmail dot com> --- #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/ldr.h> #include <errno.h> typedef struct stackFrame { struct stackFrame *back; /* -> previous stack.*/ void *savedCR; void *savedLR; /* Saved link address.*/ } stackFrame; void GetBackTrace() { /*Get current stack pointer*/ ucontext_t u; if(0 != getcontext(&u)) return; stackFrame* sp = (stackFrame *)u.uc_mcontext.jmp_context.gpr[1]; while(sp) { printf("%p\n", sp->savedLR); sp=sp->back; } } void func1() { GetBackTrace(); } void func2() { func1(); } /*cc -qtbtable=full -qlinedebug -q64 -g -o stack stack.c*/ int main() { func2(); return 0; } -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils