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]

software breakpoint in gdb


Hello

I have 2 questions on how software breakpoint is done in gdb.

One of the most commonly used feature is breakpoint. Breakpoint can be
implemented in two ways, hardware breakpoint and software breakpoint.

Hardware breakpoint requires hardware support. Typically, x86
processors come with some debugging register and when a breakpoint is
required, the pc of the instruction is stored into the debug register
and checked whenever an instruction executes.

Software breakpoint, on x86 if no hardware breakpoint register is
supported or the machine runs out of hardware registers. It will fall
back to software breakpoint. Software breakpoint involves replacing
the breakpointed instruction with an interrupt instruction.

What if the interrupt instruction is bigger than breakpointed
instruction ? Where is the breakpointed instruction kept after it is
overwritten by an interrupt instruction in gdb ?


Thanks


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