blob: 386fba1b132e673c886e20a111fe7320b57ade30 [file] [log] [blame]
digit@chromium.org434eeea2012-07-09 19:02:17 +00001Google Breakpad for Android
2===========================
3
4This document explains how to use the Google Breakpad client library
5on Android, and later generate valid stack traces from the minidumps
6it generates.
7
digit@chromium.org8c88c3e2013-09-25 13:47:44 +00008This release supports ARM, x86 and MIPS based Android systems.
digit@chromium.org434eeea2012-07-09 19:02:17 +00009
10I. Building the client library:
11===============================
12
13The Android client is built as a static library that you can
14link into your own Android native code. There are two ways to
15build it:
16
17I.1. Building with ndk-build:
18-----------------------------
19
20If you're using the ndk-build build system, you can follow
21these simple steps:
22
23 1/ Include android/google_breakpad/Android.mk from your own
24 project's Android.mk
25
26 This can be done either directly, or using ndk-build's
27 import-module feature.
28
29 2/ Link the library to one of your modules by using:
30
31 LOCAL_STATIC_LIBRARIES += breakpad_client
32
33NOTE: The client library requires a C++ STL implementation,
34 which you can select with APP_STL in your Application.mk
35
36 It has been tested succesfully with both STLport and GNU libstdc++
37
38
39II.1. Building with a standalone Android toolchain:
40---------------------------------------------------
41
42All you need to do is configure your build with the right 'host'
43value, and disable the processor and tools, as in:
44
45 $GOOGLE_BREAKPAD_PATH/configure --host=arm-linux-androideabi \
46 --disable-processor \
47 --disable-tools
48 make -j4
49
50The library will be under src/client/linux/libbreakpad_client.a
51
digit@chromium.orge542fe22012-08-31 17:07:25 +000052You can also use 'make check' to run the test suite on a connected
53Android device. This requires the Android 'adb' tool to be in your
54path.
digit@chromium.org434eeea2012-07-09 19:02:17 +000055
56II. Using the client library in Android:
57========================================
58
59The usage instructions are very similar to the Linux ones that are
60found at http://code.google.com/p/google-breakpad/wiki/LinuxStarterGuide
61
621/ You need to include "client/linux/handler/exception_handler.h" from a C++
63 source file.
64
652/ If you're not using ndk-build, you also need to:
66
digit@chromium.orge542fe22012-08-31 17:07:25 +000067 - add the following to your compiler include search paths:
68 $GOOGLE_BREAKPAD_PATH/src
69 $GOOGLE_BREAKPAD_PATH/src/common/android/include
70
digit@chromium.org434eeea2012-07-09 19:02:17 +000071 - add -llog to your linker flags
72
73 Note that ndk-build does that for your automatically.
74
753/ Keep in mind that there is no /tmp directory on Android.
76
77 If you use the library from a regular Android applications, specify a
78 path under your app-specific storage directory. An alternative is to
79 store them on the SDCard, but this requires a specific permission.
80
81For a concrete example, see the sample test application under
82android/sample_app. See its README for more information.
83
84
85III. Getting a stack trace on the host:
86=======================================
87
88This process is similar to other platforms, but here's a quick example:
89
901/ Retrieve the minidumps on your development machine.
91
922/ Dump the symbols for your native libraries with the 'dump_syms' tool.
93 This first requires building the host version of Google Breakpad, then
94 calling:
95
96 dump_syms $PROJECT_PATH/obj/local/$ABI/libfoo.so > libfoo.so.sym
97
983/ Create the symbol directory hierarchy.
99
100 The first line of the generated libfoo.so.sym will have a "MODULE"
101 entry that carries a hexadecimal version number, e.g.:
102
103 MODULE Linux arm D51B4A5504974FA6ECC1869CAEE3603B0 test_google_breakpad
104
105 Note: The second field could be either 'Linux' or 'Android'.
106
107 Extract the version number, and a 'symbol' directory, for example:
108
109 $PROJECT_PATH/symbols/libfoo.so/$VERSION/
110
111 Copy/Move your libfoo.sym file there.
112
1134/ Invoke minidump_stackwalk to create the stack trace:
114
115 minidump_stackwalk $MINIDUMP_FILE $PROJECT_PATH/symbols
116
117Note that various helper scripts can be found on the web to automate these
118steps.
119
120IV. Verifying the Android build library:
121========================================
122
123If you modify Google Breakpad and want to check that it still works correctly
digit@chromium.orge542fe22012-08-31 17:07:25 +0000124on Android, please run the android/run-checks.sh script which will do all
digit@chromium.org434eeea2012-07-09 19:02:17 +0000125necessary verifications for you. This includes:
126
digit@chromium.orge542fe22012-08-31 17:07:25 +0000127 - Rebuilding the full host binaries.
128 - Rebuilding the full Android binaries with configure/make.
129 - Rebuilding the client library unit tests, and running them on a device.
130 - Rebuilding the client library with ndk-build.
131 - Building, installing and running a test crasher program on a device.
digit@chromium.org434eeea2012-07-09 19:02:17 +0000132 - Extracting the corresponding minidump, dumping the test program symbols
133 and generating a stack trace.
digit@chromium.orge542fe22012-08-31 17:07:25 +0000134 - Checking the generated stack trace for valid source locations.
digit@chromium.org434eeea2012-07-09 19:02:17 +0000135
136For more details, please run:
137
digit@chromium.orge542fe22012-08-31 17:07:25 +0000138 android/run-checks.sh --help-all