public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* software breakpoint in gdb
@ 2012-01-29 16:48 Xin Tong
  2012-01-29 16:53 ` Jan Kratochvil
  0 siblings, 1 reply; 7+ messages in thread
From: Xin Tong @ 2012-01-29 16:48 UTC (permalink / raw)
  To: 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-01-30 15:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29 16:48 software breakpoint in gdb Xin Tong
2012-01-29 16:53 ` Jan Kratochvil
2012-01-30  0:54   ` Robert Dewar
2012-01-30  5:54     ` Kevin Pouget
2012-01-30  6:17       ` Yao Qi
2012-01-30 15:51         ` Marc Khouzam
2012-01-30 13:19       ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).