Sunday, October 17, 2010

How to find the crash point in mipsandroid platform/C/C++ program

How to find the crash point in mipsandroid platform:


ps  - to list down all the processes


ps id : 568 for /system/bin/mediaserver.

 

It is best to put the following command while the application is executing/try to play streaming.

Issues I observed:
         librtsp.so is not loaded without try streaming. rtsp.so is loaded at runtime, so it has to be

 

cat /proc/568/maps


00080000-00082000 rwxp 00000000 08:05 64767      /system/bin/mediaserver
00082000-000a0000 rwxp 00082000 00:00 0          [heap]
10000000-10100000 rw-p 10000000 00:00 0
2aaa8000-2aab0000 r--s 00000000 00:07 160        /system_properties (deleted)
2aab0000-2abae000 r--p 00000000 08:05 56876      /dev/binder
5060d000-50611000 rwxp 5060d000 00:00 0
50700000-50778000 rwxp 00000000 08:05 64939      /system/lib/librtsp.so
50800000-50880000 rwxp 00000000 08:05 64873      /system/lib/libhttp.so

69f00000-69f39000 rwxp 00000000 08:05 64875      /system/lib/libbinder.so
6d800000-6d80f000 rwxp 00000000 08:05 64892      /system/lib/libdrm1.so
6d80f000-6d810000 rwxp 6d80f000 00:00 0
76180000-762e6000 rwxp 00000000 08:05 64905      /system/lib/libopencore_common.so
78400000-7859b000 rwxp 00000000 08:05 64933      /system/lib/libopencore_player.so
78700000-78706000 rwxp 00000000 08:05 64919      /system/lib/libopencore_mp4localreg.so

I/DEBUG   (  484): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  484): Build fingerprint: 'generic/generic/generic/:2.1-update1/ECLAIR/eng.root.20100819.121118:eng/test-keys'
I/DEBUG   (  484): pid: 568, tid: 842  >>> /system/bin/mediaserver <<<
I/DEBUG   (  484): signal 11 (SIGSEGV), fault addr 00000000
I/DEBUG   (  484):  zr 00000000  at 00091d65  v0 00000000  v1 00000000
I/DEBUG   (  484):  a0 00000000  a1 00091d65  a2 00000025  a3 00000000
I/DEBUG   (  484):  t0 00000000  t1 00000000  t2 00000000  t3 00000000
I/DEBUG   (  484):  t4 203e3e20  t5 00000001  t6 00000000  t7 79616c50
I/DEBUG   (  484):  s0 785a1ab0  s1 7859a248  s2 7855f060  s3 00093f24
I/DEBUG   (  484):  s4 00000000  s5 761b4e78  s6 762e5594  s7 762e5590
I/DEBUG   (  484):  t8 00000008  t9 7ef0fca0  k0 00091d65  k1 00000000
I/DEBUG   (  484):  gp 7ef6fd60  sp 2b0aecc8  s8 2b0aee28  ra 78552da4
I/DEBUG   (  484):  hi 30bb3c31  lo 718c07e0 bva 00000000 epc 78552da8
I/DEBUG   (  484):          #00  pc 78552da8  /system/lib/libopencore_player.so
I/DEBUG   (  484):          #01  ra 78552da4  /system/lib/libopencore_player.so
I/DEBUG   (  484):
I/DEBUG   (  484): code around pc:
I/DEBUG   (  484): 78552d98 8f999dc8 0320f809 8e048788 8e24000c
I/DEBUG   (  484): 78552da8 8c8b0000 8d790024 0320f809 00000000
I/DEBUG   (  484): 78552db8 8fbc0010 144000fd ae620000 240d0008
I/DEBUG   (  484):
I/DEBUG   (  484): code around lr:
I/DEBUG   (  484): 78552d94 8fbc0010 8f999dc8 0320f809 8e048788
I/DEBUG   (  484): 78552da4 8e24000c 8c8b0000 8d790024 0320f809
I/DEBUG   (  484): 78552db4 00000000 8fbc0010 144000fd ae620000
I/DEBUG   (  484):
I/DEBUG   (  484): stack:
I/DEBUG   (  484):     2b0aec88  00000000
I/DEBUG   (  484):     2b0aec8c  00000000
I/DEBUG   (  484):     2b0aec90  00000000
I/DEBUG   (  484):     2b0aec94  00000000
I/DEBUG   (  484):     2b0aec98  00000000
I/DEBUG   (  484):     2b0aec9c  00000000
I/DEBUG   (  484):     2b0aeca0  2b0aec98
I/DEBUG   (  484):     2b0aeca4  00000001
I/DEBUG   (  484):     2b0aeca8  00000000
I/DEBUG   (  484):     2b0aecac  00095c14  [heap]
I/DEBUG   (  484):     2b0aecb0  00000025
I/DEBUG   (  484):     2b0aecb4  761b4e78  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aecb8  785a1ab0
I/DEBUG   (  484):     2b0aecbc  7859a248  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecc0  7855f060  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecc4  78552da4  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecc8  0009ba70  [heap]
I/DEBUG   (  484):     2b0aeccc  00000000
I/DEBUG   (  484):     2b0aecd0  00000000
I/DEBUG   (  484):     2b0aecd4  00000001
I/DEBUG   (  484):     2b0aecd8  7859f4b0
I/DEBUG   (  484):     2b0aecdc  761b62d8  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aece0  785a1ab0
I/DEBUG   (  484):     2b0aece4  0009ba70  [heap]
I/DEBUG   (  484):     2b0aece8  00095bb8  [heap]
I/DEBUG   (  484):     2b0aecec  00095c14  [heap]
I/DEBUG   (  484):     2b0aecf0  00000000
I/DEBUG   (  484):     2b0aecf4  7853e094  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aecf8  00095c14  [heap]
I/DEBUG   (  484):     2b0aecfc  7853c9e8  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aed00  00093d90  [heap]
I/DEBUG   (  484):     2b0aed04  00000006
I/DEBUG   (  484):     2b0aed08  00093f24  [heap]
I/DEBUG   (  484):     2b0aed0c  00095c14  [heap]
I/DEBUG   (  484):     2b0aed10  7859f4b0
I/DEBUG   (  484):     2b0aed14  761b4e78  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed18  00094038  [heap]
I/DEBUG   (  484):     2b0aed1c  00000006
I/DEBUG   (  484):     2b0aed20  00093d90  [heap]
I/DEBUG   (  484):     2b0aed24  785454e4  /system/lib/libopencore_player.so
I/DEBUG   (  484):     2b0aed28  00093d90  [heap]
I/DEBUG   (  484):     2b0aed2c  0009ba70  [heap]
I/DEBUG   (  484):     2b0aed30  7ef6fd60
I/DEBUG   (  484):     2b0aed34  00095c64  [heap]
I/DEBUG   (  484):     2b0aed38  00000000
I/DEBUG   (  484):     2b0aed3c  00095c68  [heap]
I/DEBUG   (  484):     2b0aed40  00095c14  [heap]
I/DEBUG   (  484):     2b0aed44  00000000
I/DEBUG   (  484):     2b0aed48  761b4e78  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed4c  762e5594  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed50  762e5590  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed54  7ef52a7c  /system/lib/libc.so
I/DEBUG   (  484):     2b0aed58  2b0aedd0
I/DEBUG   (  484):     2b0aed5c  00000000
I/DEBUG   (  484):     2b0aed60  00095bc4  [heap]
I/DEBUG   (  484):     2b0aed64  761a441c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aed68  7ef6fd60
I/DEBUG   (  484):     2b0aed6c  00000001
I/DEBUG   (  484):     2b0aed70  fffffffb
I/DEBUG   (  484):     2b0aed74  00000000
I/DEBUG   (  484):     2b0aed78  7859f4b0
I/DEBUG   (  484):     2b0aed7c  00000000
I/DEBUG   (  484):     2b0aed80  00000001
I/DEBUG   (  484):     2b0aed84  7ef52b4c  /system/lib/libc.so
I/DEBUG   (  484):     2b0aed88  7ef6fd60
I/DEBUG   (  484):     2b0aed8c  2b0aed90
I/DEBUG   (  484):     2b0aed90  00000000
I/DEBUG   (  484):     2b0aed94  00000000
I/DEBUG   (  484):     2b0aed98  00000000
I/DEBUG   (  484):     2b0aed9c  00000000
I/DEBUG   (  484):     2b0aeda0  00000000
I/DEBUG   (  484):     2b0aeda4  00095bb8  [heap]
I/DEBUG   (  484):     2b0aeda8  00095c14  [heap]
I/DEBUG   (  484):     2b0aedac  00095c60  [heap]
I/DEBUG   (  484):     2b0aedb0  7ef6fd60
I/DEBUG   (  484):     2b0aedb4  7ef118ac  /system/lib/libc.so
I/DEBUG   (  484):     2b0aedb8  00095c14  [heap]
I/DEBUG   (  484):     2b0aedbc  761b8e04  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedc0  762eac70
I/DEBUG   (  484):     2b0aedc4  00095c14  [heap]
I/DEBUG   (  484):     2b0aedc8  7ef6fd60
I/DEBUG   (  484):     2b0aedcc  00093d94  [heap]
I/DEBUG   (  484):     2b0aedd0  00095c7c  [heap]
I/DEBUG   (  484):     2b0aedd4  761b4f3c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedd8  00093d94  [heap]
I/DEBUG   (  484):     2b0aeddc  00095c54  [heap]
I/DEBUG   (  484):     2b0aede0  00095c14  [heap]
I/DEBUG   (  484):     2b0aede4  761b7e9c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aede8  00093f98  [heap]
I/DEBUG   (  484):     2b0aedec  761a441c  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedf0  762eac70
W/ActivityManager(  661): Activity pause timeout for HistoryRecord{2e933808 com.player.mp/.MediaPlayer}
I/DEBUG   (  484):     2b0aedf4  761a4974  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aedf8  00094038  [heap]
I/DEBUG   (  484):     2b0aedfc  762e5494  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aee00  00093d94  [heap]
I/DEBUG   (  484):     2b0aee04  00095c7c  [heap]
I/DEBUG   (  484):     2b0aee08  00095bb8  [heap]
I/DEBUG   (  484):     2b0aee0c  761b5104  /system/lib/libopencore_common.so
I/DEBUG   (  484):     2b0aee10  00095bb8  [heap]
I/DEBUG   (  484):     2b0aee14  00093d94  [heap]
I/DEBUG   (  484):     2b0aee18  7ef6fd60
I/DEBUG   (  484):     2b0aee1c  00000000
I/DEBUG   (  484):     2b0aee20  762eac70
I/DEBUG   (  484):     2b0aee24  00000000
I/DEBUG   (  484):     2b0aee28  00000000
I/DEBUG   (  484):     2b0aee2c  00000000
I/DEBUG   (  484):     2b0aee30  00000000
I/DEBUG   (  484):     2b0aee34  00093f80  [heap]
I/DEBUG   (  484):     2b0aee38  2b0aee2c
I/DEBUG   (  484):     2b0aee3c  00095c00  [heap]
I/DEBUG   (  484):     2b0aee40  00093f80  [heap]

 


Crash library address range:

78400000-7859b000 rwxp 00000000 08:05 64933      /system/lib/libopencore_player.so


PC :
-------
#00  pc 78552da8  /system/lib/libopencore_player.so


Diff/Lookup Address: (78552da8-78400000) =  0x152DA8

How to calculate lookup address:

Lookup Address = (Crash address  - loadingAddress of a library)

Find crash point address Using addr2line along with Lookup address:

root@laptop:/opt/mips-4.3/bin# ./mips-linux-gnu-addr2line -e

/home/Streaming/mipsandroid/out/target/product/generic/symbols/system/lib/libopencore_player.so 0x152da8
/home/Streaming/mipsandroid/external/opencore/android/MediaControl.cpp:415
root@laptop:/opt/mips-4.3/bin#

The crash is at 415 th line in /home/Streaming/mipsandroid/external/opencore/android/MediaControl.cpp file.

Reason: Null pointer in mStack that is the reason for the crash.
The code is as below without NULL check
aResult = mStack->stackStop();

To resolve this issue, I added the below code:

 if(!mStack)
 {
  return; 
 }
 aResult = mStack->stackStop();

1 Comments:

Anonymous Chaitral Purkar said...

how did you calculate Crash library address range? I am facing a similar issue.
Any pointer towards this would be helpful.

Thanks and regards,
Chaitral Purkar

10:26 AM  

Post a Comment

<< Home