File: thumb.cpp

package info (click to toggle)
android-platform-system-extras 7.0.0%2Br33-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,136 kB
  • sloc: cpp: 28,180; ansic: 14,543; python: 5,376; sh: 2,441; java: 908; asm: 299; makefile: 19; xml: 12
file content (22 lines) | stat: -rw-r--r-- 538 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <unwind.h>

extern "C" void arm_function_3(int* p);
extern "C" void thumb_function_1(int* p);
extern "C" void thumb_function_2(int* p);

extern "C" _Unwind_Reason_Code trace_function(_Unwind_Context* context, void *) {
    printf("0x%x\n", _Unwind_GetIP(context));
    fflush(stdout);
    return _URC_NO_REASON;
}

void thumb_function_1(int*) {
    int a = 0;
    arm_function_3(&a);
}

void thumb_function_2(int*) {
    printf("unwinding...\n");
    _Unwind_Backtrace(trace_function, (void*) "backtrace!");
}