조회 수 11085 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print
?

단축키

Prev이전 문서

Next다음 문서

+ - Up Down Comment Print

http://stackoverflow.com/questions/5314036/how-to-use-addr2line-in-android



Let's say that logcat show you the following crash log (this is from one of my projects):

I/DEBUG   (   31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (   31): Build fingerprint: 'generic/sdk/generic:2.3/GRH55/79397:eng/test-keys'
I/DEBUG   (   31): pid: 378, tid: 386  >>> com.example.gltest <<<
I/DEBUG   (   31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG   (   31):  r0 001dbdc0  r1 00000001  r2 00000000  r3 00000000
I/DEBUG   (   31):  r4 00000000  r5 40a40000  r6 4051a480  r7 42ddbee8
I/DEBUG   (   31):  r8 43661b24  r9 42ddbed0  10 42ddbebc  fp 41e462d8
I/DEBUG   (   31):  ip 00000001  sp 436619d0  lr 83a12f5d  pc 8383deb4  cpsr 20000010
I/DEBUG   (   31):          #00  pc 0003deb4  /data/data/com.example.gltest/lib/libnativemaprender.so
I/DEBUG   (   31):          #01  pc 00039b76  /data/data/com.example.gltest/lib/libnativemaprender.so
I/DEBUG   (   31):          #02  pc 00017d34  /system/lib/libdvm.so

Look at the last 3 lines; this is your callstack. 'pc' is the program counter, and the pc for stack frame #00 gives you the address where the crash occurred. This is the number to pass to addr2line.

I'm using NDK r5, so the executable I'm using is located at $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin; make sure that is in your $PATH. The command to use looks like

arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libXXX.so <address>

Or, for the case above:

arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libnativemaprender.so 0003deb4

Which gives you the location of the crash.

Note:

  • The -C flag is to demangle C++ code
  • Use the .so file under obj/local/armeabi, since this is the non-stripped version

Also, when using NDK r5 with a 2.3 AVD, it is actually possible to debug multithreaded code.




NDK addr2line 사용방법

FFmpeg프로젝트 중에 계속해서 build fingerprint 라는 알수없는 로그가 발생하면서
실행중인 앱이 죽어 버리는 증상이 발생하고 있다.

뭔가 알아 볼수 없는 주소값인건 알겠는데 어찌 읽어야 하나 방법을 찾다가 발견했다.

아래와 같이 로그가 발생 했다면

06-11 13:27:17.275: I/DEBUG(1435): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-11 13:27:17.275: I/DEBUG(1435): Build fingerprint: 'generic/broadcom_cmp/cmp/:2.2/FRF91/132:jp/release'
06-11 13:27:17.275: I/DEBUG(1435): pid: 9504, tid: 9504  >>> net.jbong.FFmpegBasic <<<
06-11 13:27:17.275: I/DEBUG(1435): signal 11 (SIGSEGV), fault addr 00000008
06-11 13:27:17.275: I/DEBUG(1435):  r0 00000000  r1 bef68370  r2 00000000  r3 00000001
06-11 13:27:17.275: I/DEBUG(1435):  r4 00000000  r5 bef68370  r6 00000c60  r7 81a50e20
06-11 13:27:17.275: I/DEBUG(1435):  r8 00000680  r9 4410eac8  10 4410eab4  fp 452090f4
06-11 13:27:17.275: I/DEBUG(1435):  ip 00000003  sp bef68370  lr 810b6624  pc 810b65dc  cpsr 60000010
06-11 13:27:17.425: I/DEBUG(1435):          #00  pc 000b65dc  /data/data/net.jbong.FFmpegBasic/lib/libbasicplayer.so
이하 생략


arm-linux-androideabi-addr2line.exe -f -e libbasicplayer.so 000b65dc
위와 같이 실행하면
다음과 같은 결과를 출력한다.

av_interleave_packet
D:\workspace2\FFmpegBasic/jni/ffmpeg/libavformat/utils.c:3239

위처럼 실행할때 so파일은 libs폴더가 아니고 obj/local/armeabi 아래 있는 파일을 사용해야 한다.





Dreamy의 코드 스크랩

내가 모으고 내가 보는

List of Articles
번호 분류 제목 날짜 조회 수 추천 수
341 Pi ftp 포트 변경하기 2015.10.01 9876 0
340 Pi 무선랜 wifi 설정 2015.10.01 6761 0
339 Pi ftp 설정하기 2015.10.01 7002 0
338 LINUX 리눅스 시스템 시작시에 자동 실행할 파일 등록하기 2015.09.30 10091 0
337 LINUX 리눅스 부팅시 명령스크립트 실행하기 2015.09.30 10331 0
336 LINUX 커맨드라인에서 url 접근 - wget 사용법 2015.09.30 12003 0
335 PHP 파일 데이터 저장하고 불러오기(파일 입출력) 2015.09.30 8389 0
334 C# ArrayList를 string[] 배열로 변환하는 방법 2015.09.23 12888 0
333 C# TreeView의 rootnode(TreeNode)에서 하위 항목 찾기 2015.09.21 15012 0
332 일반 VP9 코덱 2015.09.01 7537 0
331 LINUX 내 .bashrc 설정 secret 2015.08.31 0 0
330 C# Web URL로부터 파일 다운로드 하기 2015.08.20 19690 0
329 Android Android sdk 번호(Api level)와 버전 정리 2015.08.05 36442 0
328 C# 윈도우 App 설정값 유지하기 (Properties.Settings.Default. , Settings.settings 이용) 2015.08.03 16134 0
327 Android Fake Incoming Call Android 2015.07.23 6568 0
목록
Board Pagination ‹ Prev 1 ... 7 8 9 10 11 12 13 14 15 16 ... 34 Next ›
/ 34

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소

Designed by sketchbooks.co.kr / sketchbook5 board skin

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5

Sketchbook5, 스케치북5