blob: 816f57a9eff5bf9b68c15b7e4237ed7af4c7925d [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
8Note that this release only supports ARM-based Android systems.
9We're working on adding support for x86 and MIPS, but that might
10require an udpated NDK release.
11
12
13I. Building the client library:
14===============================
15
16The Android client is built as a static library that you can
17link into your own Android native code. There are two ways to
18build it:
19
20I.1. Building with ndk-build:
21-----------------------------
22
23If you're using the ndk-build build system, you can follow
24these simple steps:
25
26 1/ Include android/google_breakpad/Android.mk from your own
27 project's Android.mk
28
29 This can be done either directly, or using ndk-build's
30 import-module feature.
31
32 2/ Link the library to one of your modules by using:
33
34 LOCAL_STATIC_LIBRARIES += breakpad_client
35
36NOTE: The client library requires a C++ STL implementation,
37 which you can select with APP_STL in your Application.mk
38
39 It has been tested succesfully with both STLport and GNU libstdc++
40
41
42II.1. Building with a standalone Android toolchain:
43---------------------------------------------------
44
45All you need to do is configure your build with the right 'host'
46value, and disable the processor and tools, as in:
47
48 $GOOGLE_BREAKPAD_PATH/configure --host=arm-linux-androideabi \
49 --disable-processor \
50 --disable-tools
51 make -j4
52
53The library will be under src/client/linux/libbreakpad_client.a
54
55
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
67 - add $GOOGLE_BREAKPAD_PATH to your compiler include path
68 - add -llog to your linker flags
69
70 Note that ndk-build does that for your automatically.
71
723/ Keep in mind that there is no /tmp directory on Android.
73
74 If you use the library from a regular Android applications, specify a
75 path under your app-specific storage directory. An alternative is to
76 store them on the SDCard, but this requires a specific permission.
77
78For a concrete example, see the sample test application under
79android/sample_app. See its README for more information.
80
81
82III. Getting a stack trace on the host:
83=======================================
84
85This process is similar to other platforms, but here's a quick example:
86
871/ Retrieve the minidumps on your development machine.
88
892/ Dump the symbols for your native libraries with the 'dump_syms' tool.
90 This first requires building the host version of Google Breakpad, then
91 calling:
92
93 dump_syms $PROJECT_PATH/obj/local/$ABI/libfoo.so > libfoo.so.sym
94
953/ Create the symbol directory hierarchy.
96
97 The first line of the generated libfoo.so.sym will have a "MODULE"
98 entry that carries a hexadecimal version number, e.g.:
99
100 MODULE Linux arm D51B4A5504974FA6ECC1869CAEE3603B0 test_google_breakpad
101
102 Note: The second field could be either 'Linux' or 'Android'.
103
104 Extract the version number, and a 'symbol' directory, for example:
105
106 $PROJECT_PATH/symbols/libfoo.so/$VERSION/
107
108 Copy/Move your libfoo.sym file there.
109
1104/ Invoke minidump_stackwalk to create the stack trace:
111
112 minidump_stackwalk $MINIDUMP_FILE $PROJECT_PATH/symbols
113
114Note that various helper scripts can be found on the web to automate these
115steps.
116
117IV. Verifying the Android build library:
118========================================
119
120If you modify Google Breakpad and want to check that it still works correctly
121on Android, please run the android/run-test-program.sh script which will do all
122necessary verifications for you. This includes:
123
124 - Rebuilding the full host package
125 - Rebuilding the client library with configure/make
126 - Rebuilding the client library with ndk-build
127 - Building, installing and running a test crasher program on a device
128 - Extracting the corresponding minidump, dumping the test program symbols
129 and generating a stack trace.
130 - Checking the stack trace for valid source locations.
131
132For more details, please run:
133
134 android/run-test-program.sh --help-all