[英]How to debug the android native crash by the trace?
I got the following trace on Android. 我在Android上获得以下跟踪。
Question 1: What's the meaning of the r0 ... r9 and sl , fp , ip , sp , lr , sl , pc , cpsr . 问题1: r0 ... r9和sl , fp , ip , sp , lr , sl , pc , cpsr的含义是什么。 I'm trying to debug acrroding to the fault addr 0xb0
info. 我正在尝试调试添加到fault addr 0xb0
信息。
The code snippet like this: 这样的代码片段:
memcpy(mAudioFrameBuffers[write_pos]->data, audioFrame->data, audioFrame->frameSize);
The trace: 跟踪:
12-13 13:33:19.182 I/DEBUG (19867): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-13 13:33:19.183 I/DEBUG (19867): Build fingerprint: 'motorola/shamu_retcn/shamu_t:5.0.2/LXG22.67-7.1/2:user/release-keys'
12-13 13:33:19.183 I/DEBUG (19867): Revision: 'p2b0'
12-13 13:33:19.183 I/DEBUG (19867): ABI: 'arm'
12-13 13:33:19.183 I/DEBUG (19867): pid: 22064, tid: 22137, name: AsyncTask #1 >>> com.jerikc.mediastreamerdemo <<<
12-13 13:33:19.183 I/DEBUG (19867): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xb0
12-13 13:33:19.205 I/DEBUG (19867): r0 00000003 r1 a2dc2bb0 r2 00125365 r3 000000b0
12-13 13:33:19.205 I/DEBUG (19867): r4 a3507160 r5 a35090e8 r6 a2dc6ddc r7 a2dc2bb0
12-13 13:33:19.205 I/DEBUG (19867): r8 a2dc6ef4 r9 a2dc3ce6 sl d00bff18 fp 148fb9e5
12-13 13:33:19.205 I/DEBUG (19867): ip a1303810 sp a1303cd8 lr a2c9d96b pc a2c9d97a cpsr 200f0030
12-13 13:33:19.205 I/DEBUG (19867):
12-13 13:33:19.205 I/DEBUG (19867): backtrace:
12-13 13:33:19.205 I/DEBUG (19867): #00 pc 0001897a /data/app/com.jerikc.mediastreamerdemo-2/lib/arm/libMediaStreamer.so (AudioFrameBufferPool::push(AudioFrame*)+205)
12-13 13:33:19.205 I/DEBUG (19867): #01 pc 0001f5fb /data/app/com.jerikc.mediastreamerdemo-2/lib/arm/libMediaStreamer.so (AudioStreamer::mixThread()+330)
12-13 13:33:19.205 I/DEBUG (19867): #02 pc 0001f777 /data/app/com.jerikc.mediastreamerdemo-2/lib/arm/libMediaStreamer.so
12-13 13:33:19.205 I/DEBUG (19867): #03 pc 0001666b /system/lib/libc.so (__pthread_start(void*)+30)
12-13 13:33:19.205 I/DEBUG (19867): #04 pc 00014643 /system/lib/libc.so (__start_thread+6)
Question 2: Is there any efficient debug method? 问题2:是否有任何有效的调试方法?
r0 to r9 as well as sl, fp etc are your registers. r0至r9以及sl,fp等都是您的寄存器。 It just shows you the values of the registers when your code 'segfaulted'. 它仅在代码“段错误”时向您显示寄存器的值。
If it crashing during the memcpy(), it is very likely that you are accessing out-of-bounds memory (either reading or writing past the boundaries of your buffers) 如果在memcpy()期间崩溃,则很可能您正在访问越界内存(读取或写入越过缓冲区的边界)
As for debugging, here's what you could try: 至于调试,可以尝试以下方法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.