thumb.cpp revision 7341494707810f709855ea85ce03a8ec3ac8dbaf
1#include <stdio.h>
2#include <unwind.h>
3
4extern "C" void arm_function_3(int*p);
5extern "C" void thumb_function_1(int*p);
6extern "C" void thumb_function_2(int*p);
7
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
16void thumb_function_1(int*p)
17{
18    int a = 0;
19    arm_function_3(&a);
20}
21
22void thumb_function_2(int*p)
23{
24    int a = 0;
25    printf("unwinding...\n");
26    _Unwind_Backtrace(trace_function, (void*)"backtrace!");
27}
28