1 #include <stdio.h> 2 #include <unwind.h> 3 4 extern "C" void arm_function_3(int*p); 5 extern "C" void thumb_function_1(int*p); 6 extern "C" void thumb_function_2(int*p); 7 trace_function(_Unwind_Context * context,void * arg)8extern "C" _Unwind_Reason_Code trace_function(_Unwind_Context *context, void *arg) 9 { 10 int i = 0; 11 printf("0x%x\n", _Unwind_GetIP(context)); 12 fflush(stdout); 13 return _URC_NO_REASON; 14 } 15 thumb_function_1(int * p)16void thumb_function_1(int*p) 17 { 18 int a = 0; 19 arm_function_3(&a); 20 } 21 thumb_function_2(int * p)22void thumb_function_2(int*p) 23 { 24 int a = 0; 25 printf("unwinding...\n"); 26 _Unwind_Backtrace(trace_function, (void*)"backtrace!"); 27 } 28