Forums

Debugger question

Started by Tom June 9, 2004
Hi,

when using the powerpc-eabi-gdb debugger. To set breakpoints, gdb uses
memory read and write commands to nondestructively replace a source
instruction with a trap instruction. If you replace a source instruction,
isn't the memory at that moment changing ? So are the memory locations in
that case still correct ?

Tom


Tom wrote:

> when using the powerpc-eabi-gdb debugger. To set breakpoints, gdb uses > memory read and write commands to nondestructively replace a source > instruction with a trap instruction. If you replace a source instruction, > isn't the memory at that moment changing ? So are the memory locations in > that case still correct ?
I am not familiar with gdb, but I expect that it probably restores the code on entry (breakpoint trap, for example), and reinserts the trap instructions before starting execution of your code. This is done for other debuggers, at least. That is normally transparent to you and the running program, but if your program reads its own code during execution, it could detect the trap instructions. Thad