From: Andrew Cagney <ac131313@cygnus.com>
To: jimb@cygnus.com, Michael Snyder <msnyder@redhat.com>
Cc: Eli Zaretskii <eliz@is.elta.co.il>, gdb-patches@sources.redhat.com
Subject: Re: RFA: Elaborate on new overlay support
Date: Sat, 09 Feb 2002 09:34:00 -0000 [thread overview]
Message-ID: <3C655DAD.3040706@cygnus.com> (raw)
In-Reply-To: <1858-Sat09Feb2002184407+0200-eliz@is.elta.co.il>
> From: Jim Blandy <jimb@zwingli.cygnus.com>
>> Date: 09 Feb 2002 11:17:46 -0500
>>
>> Are you sure this is the right thing? How breakpoints are implemented
>> is usually completely hidden from the user.
>
>
> Not completely: we have the "hbreak" command, for example.
>
> If you meant to tell that even "break" sometimes sets a hardware
> breakpoint, then I agree that it's an internal GDB matter, but if
> those are the cases you refer to here, there's no need to explain at
> length what hardware breakpoints are, just make a cross-reference to
> the "Breakpoints" node, where the detailed explanation should live.
Er, yes. I think there is something more basic going on here.
The hbreak VS break command question comes up irregularly. Should
``break'' be allowed to set hardware breakpoints? My memory of the
rationale for separate break and hbreak commands is that the hardware
breakpoint is (at least traditionally) very scarce. Consequently the
user is given complete and explicit control over them. This allowing
the user to carefully allocate those valueable resources to things like
a breakpoint on that ROM.
Software breakpoints on the other hand were cheap. They do come with
certain implied semantics. They work by modifying memory in the target
and hence move around when the target moves their memory around. If
this isn't happening then I would argue it isn't a software breakpoint.
I get the feeling that there are two issues lurking here:
--
Firstly there looks to be a bug in the software-breakpoint packet.
Consider the sequence:
set software breakpoint at 0xdead
program resumes
program copies *0xdead to *0xbeef
program stops
GDB knows (via the overlay table) that there is a breakpoint at both FOO
and BAR. Removing the breakpoint at foo is easy:
z0,dead,4
Removing the breakpoint at ``beef'' though is impossible. GDB knows
what memory should be at that location. The target doesn't - the target
can't track where the breakpoint is (that is unless the target also
starts tracking overlays).
I guess this suggests that when a software breakpoint is set, it returns
the original memory value, and when cleared, that original memory value
is included in the packet. I remember this being suggested at the time
(I think so that the target didn't need to record the replaced memory?),
sigh.
--
Secondly it looks like there is a broken target. As noted above, a
software breakpoint has certain implied semantics (it works by modifying
target memory). A target implementing software breakpoints using a
hardware breakpoint mechanisms, I think, is broken - it has broken the
contract it made with GDB.
Presumably such a target has an infinite (or nearly so) number of
hardware breakpoints and so doesn't see any point in using
software-breakpoints. While OK, this decision needs to be communicated
back to GDB so that GDB knows what is really going on. The old ``never
lie'' rule applies.
enjoy,
Andrew
next prev parent reply other threads:[~2002-02-09 17:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-08 11:26 Jim Blandy
2002-02-08 23:46 ` Eli Zaretskii
2002-02-09 8:16 ` Jim Blandy
2002-02-09 8:45 ` Eli Zaretskii
2002-02-09 9:34 ` Andrew Cagney [this message]
2002-02-09 10:05 ` Andrew Cagney
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=3C655DAD.3040706@cygnus.com \
--to=ac131313@cygnus.com \
--cc=eliz@is.elta.co.il \
--cc=gdb-patches@sources.redhat.com \
--cc=jimb@cygnus.com \
--cc=msnyder@redhat.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