comparison README.android @ 4973:067b6ec8b751

Added information about decoding native stack traces
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jan 2011 12:31:51 -0800
parents f74a3f94c408
children 1cd0a891b69a
comparison
equal deleted inserted replaced
4972:0a9a77f3d552 4973:067b6ec8b751
121 adb push local_file remote_path_and_file 121 adb push local_file remote_path_and_file
122 122
123 You can push files to the SD Card at /sdcard, for example: 123 You can push files to the SD Card at /sdcard, for example:
124 adb push moose.dat /sdcard/moose.dat 124 adb push moose.dat /sdcard/moose.dat
125 125
126 You can see the complete command line that ndk-build is using by passing V=1 on the command line:
127 ndk-build V=1
128
129 If your application crashes in native code, you can use addr2line to convert the addresses in the stack trace to lines in your code.
130
131 For example, if your crash looks like this:
132 I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
133 I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4
134 I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
135 I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c
136 I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030
137 I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so
138 I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so
139 I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so
140 I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so
141
142 You can see that there's a crash in the C library being called from the main code. I run addr2line with the debug version of my code:
143 arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
144 and then paste in the number after "pc" in the call stack, from the line that I care about:
145 000014bc
146
147 I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
148
149 You can add logging to your code to help show what's happening:
150
151 #include <android/log.h>
152
153 __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
154
126 155
127 ================================================================================ 156 ================================================================================
128 Known issues 157 Known issues
129 ================================================================================ 158 ================================================================================
130 159