From: Marc Khouzam <marc.khouzam@ericsson.com>
To: "'Yao Qi'" <yao@codesourcery.com>,
"'Kevin Pouget'" <kevin.pouget@gmail.com>
Cc: "'Robert Dewar'" <dewar@adacore.com>,
"'Jan Kratochvil'" <jan.kratochvil@redhat.com>,
"'Xin Tong'" <xerox.time.tech@gmail.com>,
"'gdb@sourceware.org'" <gdb@sourceware.org>
Subject: RE: software breakpoint in gdb
Date: Mon, 30 Jan 2012 15:51:00 -0000 [thread overview]
Message-ID: <F7CE05678329534C957159168FA70DEC578E9F2E3A@EUSAACMS0703.eamcs.ericsson.se> (raw)
In-Reply-To: <4F2635DA.3060805@codesourcery.com>
> -----Original Message-----
> From: gdb-owner@sourceware.org
> [mailto:gdb-owner@sourceware.org] On Behalf Of Yao Qi
> Sent: Monday, January 30, 2012 1:17 AM
> To: Kevin Pouget
> Cc: Robert Dewar; Jan Kratochvil; Xin Tong; gdb@sourceware.org
> Subject: 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.
In fact, I believe fast tracepoints in GDB had to deal with this very
limitation. Fast tracepoints don't use an interrupt instruction (too slow)
but instead use a jump instruction; that jump takes the execution to another
location to execute the tracepoint directly in the program. Because we
cannot replace more than one instruction, fast tracepoints are only allowed
on 5-byte instructions (actually, 4-byte instructions starting with GDB 7.4).
Marc
next prev parent reply other threads:[~2012-01-30 15:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-29 16:48 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 [this message]
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=F7CE05678329534C957159168FA70DEC578E9F2E3A@EUSAACMS0703.eamcs.ericsson.se \
--to=marc.khouzam@ericsson.com \
--cc=dewar@adacore.com \
--cc=gdb@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=kevin.pouget@gmail.com \
--cc=xerox.time.tech@gmail.com \
--cc=yao@codesourcery.com \
/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).