This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: software breakpoint in gdb


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]