Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

objdump of a .so file? need help to understand the messages

I am developing a native application related to streaming, i am facing some problems in my c module... and what i have is some message from Logcat


Here is the Logcat message

INFO/DEBUG(28): Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
11-17 12:40:07.550: INFO/DEBUG(28): pid: 5957, tid: 5957  >>> com.mmstwo <<<
11-17 12:40:07.561: INFO/DEBUG(28): signal 11 (SIGSEGV), fault addr deadd00d
11-17 12:40:07.561: INFO/DEBUG(28):  r0 00000354  r1 00129100  r2 0000000c  r3 deadd00d
11-17 12:40:07.561: INFO/DEBUG(28):  r4 00000026  r5 ad07ff50  r6 00000000  r7 fffe72f8
11-17 12:40:07.579: INFO/DEBUG(28):  r8 afe3bdfc  r9 4509f020  10 00000000  fp 00135a40
11-17 12:40:07.590: INFO/DEBUG(28):  ip ad080160  sp bef28f90  lr afe14cf7  pc ad035452  cpsr 20000030
11-17 12:40:07.840: INFO/DEBUG(28):          #00  pc 00035452  /system/lib/libdvm.so
11-17 12:40:07.850: INFO/DEBUG(28):          #01  pc 00027a98  /system/lib/libdvm.so
11-17 12:40:07.869: INFO/DEBUG(28):          #02  pc 00027bba  /system/lib/libdvm.so
11-17 12:40:07.879: INFO/DEBUG(28):          #03  pc 0002d98e  /system/lib/libdvm.so

11-17 12:40:07.901: INFO/DEBUG(28):          #04  pc 0000142e  /data/data/com.mmstwo/lib/libnstreamer.so

this is the line that represents the c class which i use.


as per comments on my previous question i followed url given by rahul and dumped my .so file to a text file.

here is that text file

 141e:  4a2d        ldr r2, [pc, #180]  (14d4 <Java_com_mmstwo_NativeParser_stringFromJNI+0x408>)
    1420:   4b2d        ldr r3, [pc, #180]  (14d8 <Java_com_mmstwo_NativeParser_stringFromJNI+0x40c>)
    1422:   2184        movs    r1, #132
    1424:   5846        ldr r6, [r0, r1]
    1426:   18aa        adds    r2, r5, r2
    1428:   18eb        adds    r3, r5, r3
    142a:   4651        mov r1, sl
    142c:   1c38        adds    r0, r7, #0
    142e:   47b0        blx r6
    1430:   4b2a        ldr r3, [pc, #168]  (14dc <Java_com_mmstwo_NativeParser_stringFromJNI+0x410>)
    1432:   4669        mov r1, sp

so as per the post in google groups and specially suggested by Nicklas Ansman i had shown the snippet which is around my desired line 142e.

Now can anyone here who can tell what does 47b0 blx r6 means?

What i knew is it is something written in assembly language that i don't know. So I need your help in understanding that line.

Thanks in advance

like image 256
Prasham Avatar asked Oct 25 '22 02:10

Prasham


1 Answers

blx jumps to the address given by the argument; here, to the address which is currently loaded in register r6. Also, the return address (namely the address of the ldr opcode which is located immediately after the blx) is written in the special-purpose register lr (as "link register").

This corresponds to an indirect call. In C it would look like a call through a function pointer. on some platforms with dynamic linking, a simple function call to a function can also become something like what you see here.

Anyway, the register dump shows r6 to be 0 at that point, hence the segfault. r6 was loaded from the ldr opcode on address 1424. This loads r6 from what was at address r0+r1, r1 being set to 132 just above. r0 is the conventional register for the first argument to a C function.

like image 142
Thomas Pornin Avatar answered Nov 03 '22 00:11

Thomas Pornin