software breakpoint in gdb

Yao Qi
Mon Jan 30 06:17:00 GMT 2012

On 01/30/2012 01:54 PM, Kevin Pouget wrote:
> I would be curious about why it would be "a disastrous mistake".
> Please correct me if I'm wrong in my understanding:

The real disaster is interrupt instruction may corrupt the following
instruction of breakpointed instruction, if interrupt instruction is
longer than breakpointed instruction.  For example,

   JMP L1:
   INSN1 (1-byte)
L1:INSN2 (2-byte)

Supposing the length of interrupt instruction is 2-byte, when setting
breakpoint on INSN1, the INSN2 is corrupted.  If the program runs JMP
instruction to L1 directly, something wrong will be executed.

Yao (齐尧)

More information about the Gdb mailing list