Archive for May, 2013

Debugging of Adobe Reader in Android (Part II)

To follow up on the debugging of the Adobe Reader (https://tthtlc.wordpress.com/2013/04/24/how-do-debug-the-runtime-behavior-of-adobe-reader-in-android):

First, start up the Adobe Reader on the Android device, and then use “adb shell” to attach to the Android device.

Next inside the Android device, running inside “adb shell”, use “tcpdump” or “netstat” to find out the Android device IP address (ifconfig does not gives IP address?):

netstat -nat
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.1.110:46121 173.194.38.131:443 ESTABLISHED

Now knowing the IP address, we will do a gdbserver to attach to the “com.adobe.reader” process:

Within the device, finding out the pid:

# ps |grep com.adobe
u0_a85 21128 126 698144 139752 ffffffff 400daee4 S com.adobe.reader

so pid is 21182, and then using “gdbserver” to attach (also inside the Android device):

gdbserver :4646 --attach 21128
Attached; pid = 21128
Listening on port 4646

Now, using another terminal, we will use the arm toolchain from Android NDK to attach to the gdbserver (running inside the Android device):

cd /opt/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin

./arm-linux-androideabi-gdb
GNU gdb (GDB) 7.3.1-gg2

(gdb) target remote 192.168.1.110:4646
Remote debugging using 192.168.1.110:4646
0x400daee4 in ?? ()

(gdb) bt
#0 0x400daee4 in ?? ()
#1 0x4012fb0c in ?? ()
#2 0x4012fb0c in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

(gdb) info sharedlibrary
warning: while parsing target library list (at line 2): No segment defined for com.adobe.reader

No shared libraries loaded at this time.

(gdb) x /100i $pc
=> 0x400daee4: pop {r4, r7}
0x400daee8: movs r0, r0
0x400daeec: bxpl lr
0x400daef0: b 0x400fef74
0x400daef4: push {r4, r7}
0x400daef8: mov r7, #316 ; 0x13c
0x400daefc: svc 0x00000000
0x400daf00: pop {r4, r7}
0x400daf04: movs r0, r0
0x400daf08: bxpl lr
0x400daf0c: b 0x400fef74
0x400daf10: push {r4, r7}
0x400daf14: ldr r7, [pc, #16] ; 0x400daf2c
0x400daf18: svc 0x00000000
0x400daf1c: pop {r4, r7}
0x400daf20: movs r0, r0
0x400daf24: bxpl lr
0x400daf28: b 0x400fef74
0x400daf2c: andeq r0, r0, sp, lsr r1
0x400daf30: push {r4, r7}
0x400daf34: ldr r7, [pc, #16] ; 0x400daf4c
0x400daf38: svc 0x00000000
0x400daf3c: pop {r4, r7}

Outstanding problem:

info sharedlibrary
warning: while parsing target library list (at line 2): No segment defined for com.adobe.reader
No shared libraries loaded at this time.
(gdb)

%d bloggers like this: