简体   繁体   中英

Crash (SIGILL) loading native lib on Android: how to get ARM instruction?

I compiled v8 for ARM and it loads fine on the majority of arm6/7 phones. Some specific devices like the HTC Wildfire S crash when loading the native library.

This is the SIGILL (invalid instruction) I get:

31-31/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
31-31/? I/DEBUG﹕ Build fingerprint: 'generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys'
31-31/? I/DEBUG﹕ pid: 312, tid: 312  >>> org.myapp <<<
31-31/? I/DEBUG﹕ signal 4 (SIGILL), fault addr 81494f98
31-31/? I/DEBUG﹕ r0 00000001  r1 00000003  r2 81494f8e  r3 81494f8c
31-31/? I/DEBUG﹕ r4 8198a26c  r5 00000003  r6 00000004  r7 00000000
31-31/? I/DEBUG﹕ r8 42189eac  r9 00000374  10 0000ce04  fp bef6765c
31-31/? I/DEBUG﹕ ip 8124695c  sp bef67658  lr b0001169  pc 81494f98  cpsr 80000010
31-31/? I/DEBUG﹕ #00  pc 00494f98  /data/data/org.myapp/lib/libjv8.so

I could use ndk-stack to get the specific line in v8 that's crashing, but it actually refers to a macro so I don't know which specific instruction is being executed.

I tried to connect to the device with gdb-server , but it doesn't give me more details about the instruction:

Program received signal SIGILL, Illegal instruction.
0x81494f98 in ?? ()

So I'm a bit lost. Is there a way to translate 0x81494f98 to a specific ARM instruction?

Thanks to @ChrisStratton, this is how I was able to find the specific ARM instructions that causes a SIGILL:

$ arm-whatever-objdump -d <lib_path> | grep <pc_address>

or in my case:

$ arm-whatever-objdump -d libjv8.so | grep 494f98

It produced the following line:

494f98: e30f1fff movw   r1, #65535  ; 0xffff

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM