How do I set a software breakpoint on an ARM processor?

前端 未结 8 925
北恋
北恋 2021-02-12 14:40

How do I do the equivalent of an x86 software interrupt:

asm( \"int $3\" )

on an ARM processor (specifically a Cortex A8) to generate an event

8条回答
  •  情深已故
    2021-02-12 14:57

    On my armv7hl (i.MX6q with linux 4.1.15) system, to set a breakpoint in another process, I use :

    ptrace(PTRACE_POKETEXT, pid, address, 0xe7f001f0)

    I choose that value after strace'ing gdb :)

    This works perfectly : I can examine the traced process, restore the original instruction, and restart the process with PTRACE_CONT.

提交回复
热议问题