From: Kevin Pouget <kevin.pouget@gmail.com>
To: Robert Dewar <dewar@adacore.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
Xin Tong <xerox.time.tech@gmail.com>,
gdb@sourceware.org
Subject: Re: software breakpoint in gdb
Date: Mon, 30 Jan 2012 05:54:00 -0000 [thread overview]
Message-ID: <CAPftXUJ8qb7BLeE+U6jn67T=27eoGn8E6MgaqhBSkCGbV70yqQ@mail.gmail.com> (raw)
In-Reply-To: <4F25EA26.8020901@adacore.com>
On Mon, Jan 30, 2012 at 1:53 AM, Robert Dewar <dewar@adacore.com> wrote:
> On 1/29/2012 11:53 AM, Jan Kratochvil wrote:
>>
>> On Sun, 29 Jan 2012 17:48:30 +0100, Xin Tong wrote:
>>>
>>> What if the interrupt instruction is bigger than breakpointed
>>> instruction ?
>>
>>
>> I do not know about such architecture, it probably does not exist.
>
>
> It sure would be a disastrous mistake to make in any architectural
> design. the x86 of course has a one byte interrupt instruction
> precisely for this purpose.
Hello,
I would be curious about why it would be "a disastrous mistake".
Please correct me if I'm wrong in my understanding:
- gdb sets a breakpoint at a given PC, save corresponding instruction,
instructionS or part of instruction,
- when the OS hits the breakpoint, GDB receives a SIGTRAP,
- GDB rewrites the original memory content and moves back the PC to
the BP address
- GDB continues the inferior step-by-step, *until the PCs steps out of
the breakpoint area* -- one step only if not(interrupt instruction is
bigger than breakpointed instruction)
- GDB re-set the breakpoint inst at the BP address, and continues the execution
so, is it doing 2 steps to jump over the breakpoint which is complicated?
Thnaks,
Kevin
next prev parent reply other threads:[~2012-01-30 5:54 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 [this message]
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='CAPftXUJ8qb7BLeE+U6jn67T=27eoGn8E6MgaqhBSkCGbV70yqQ@mail.gmail.com' \
--to=kevin.pouget@gmail.com \
--cc=dewar@adacore.com \
--cc=gdb@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=xerox.time.tech@gmail.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).