public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Xin Tong <xerox.time.tech@gmail.com>
To: gdb@sourceware.org
Subject: software breakpoint in gdb
Date: Sun, 29 Jan 2012 16:48:00 -0000	[thread overview]
Message-ID: <CALKntY0W-HiSUS5jeMveKRnutAntC0y8yPCGAnrZgP=_TrRULg@mail.gmail.com> (raw)

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

             reply	other threads:[~2012-01-29 16:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-29 16:48 Xin Tong [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALKntY0W-HiSUS5jeMveKRnutAntC0y8yPCGAnrZgP=_TrRULg@mail.gmail.com' \
    --to=xerox.time.tech@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).