0

In Android shared library that heavily protected against debugging, I found following code:

CODE32
ldr pc, [pc, #-4]

For me, this instruction looks like NOP; it just jumps to next instruction in ARM mode. The debugged process crashes on this command, however. I use IDA to debug the process.

Can anyone explain why?

  • "crashes" how, exactly? – Igor Skochinsky Sep 3 '19 at 10:47
  • Raises SIGSEGV. – Vitalii Sep 3 '19 at 11:34
  • IDA itself or the process being debugged? – Igor Skochinsky Sep 3 '19 at 14:12
  • The debugged process. – Vitalii Sep 3 '19 at 14:58
1

This instruction is not a NOP. It reads memory and jumps to the address loaded. If the memory is inaccessible or the loaded address is invalid/non-executable, you will get an exception, so the debugger's behavior is correct.

a NOP-like instruction involving PC in ARM mode would be something like

ADD PC, PC, #-4

(likely disassembled as sub pc, pc, #4 or maybe even ADR PC, next_addr )

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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