I'm debugging android jni with gdb. There's a jni function A(), I need to set breakpoint there and step through. I calculated the address with module_base+offset, which is 0x99B62C7A, then I tried to verify if it's the right address, with gdb command:

display /5i 0x99B62C7A

It prints some unexpected instructions, which is different from IDA: enter image description here

And if I put a breakpoint there and click on the UI to trigger the breakpoint, the process crashes with SIGSEGV.

So why gdb displays different instructions? Is the crash has something to do with the bad instruction?

1 Answer 1


Your instructions shown by Ida are Thumb-mode instructions. The easiest way to verify this is by checking the addresses - each instruction has 2 bytes. Gdb doesn't know this however, and assumes 4 byte arm instructions. When an object has a symbol table, gdb can detect the instruction mode from that, but will fallback to a default mode when it can't. You can change this fallback mode; set arm fallback-mode thumb should do the trick.

This explains the SIGSEGV as well as breakpoints use different opcodes in arm and thumb mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.