From: Eli Zaretskii <eliz@gnu.org>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: uweigand@de.ibm.com, gdb-patches@sourceware.org
Subject: Re: [RFA 2/3] Demote to sw watchpoint only in update_watchpoint
Date: Tue, 03 May 2011 06:05:00 -0000 [thread overview]
Message-ID: <E1QH8jn-0001Wm-64@fencepost.gnu.org> (raw)
In-Reply-To: <1304398546.2245.80.camel@hactar> (message from Thiago Jung Bauermann on Tue, 03 May 2011 01:55:46 -0300)
> From: Thiago Jung Bauermann <bauerman@br.ibm.com>
> Cc: gdb-patches ml <gdb-patches@sourceware.org>
> Date: Tue, 03 May 2011 01:55:46 -0300
>
> I hardcoded bp_hardware_watchpoint in an attempt to make read and access
> watchpoints also count as hardware watchpoints when determining the
> number of used and available debug resources (otherwise only watchpoints
> of the same type as the one being created are taken into account when
> counting how many debug resources are used).
>
> I just realised it doesn't work, and to fix it I'd have to slightly
> change the meaning of the other_type_used argument to be the number of
> other types of watchpoints, instead of just one or zero indicated
> whether there is any watchpoint of another type being used.
>
> I didn't make the change because I don't know if there's any target
> which would break. I couldn't find anywhere what other_type_used
> actually means...
>
> On the other hand, the current code is already broken in that regard,
> and creating several read and access watchpoints on today's GDB will
> confuse it and allow creating more hardware watchpoints (read, access or
> regular) than possible. Thus, this patch doesn't make the situation any
> worse. So now I just use b->type.
Sorry, but I object. This kind of changes just adds kludges upon
kludges on what is a fundamentally broken design to begin with. It
was originally designed and implemented for a single platform (which
we no longer support, btw), and doesn't scale well, or not at all, to
other platforms, not even to x86.
The problem with the meaning of the other_type_used argument is the
telltale sign: it only made sense for that single platform for which
hardware watchpoints were originally implemented in GDB. It no longer
makes any sense with today's platforms, and actually cannot be used at
all with most of them (at least those I'm familiar with), for a very
simple reason: a single `int' parameter doesn't provide a way to
report enough information about the consumption of related resources.
It doesn't matter if that parameter is a boolean or not; it simply
isn't up to this job. Much more information is needed about the
related resources to decide whether another watchpoint can or cannot
be set.
The fundamental design problem here is this: there's no way GDB
application level can know whether the target can accommodate an
additional hardware watchpoint of a given type and attributes. Only
the target itself can tell that accurately, because the information
needed to answer that question is extremely target-dependent. OTOH,
it is bad UI design to let the user set a hardware watchpoint, then
demote it to a software watchpoint (or even refuse to insert a
watchpoint at all) at "resume" time. So on the one hand, we _want_
the GDB application level to know if a hardware watchpoint is
possible, to tell the user it cannot, and OTOH there's a problem
knowing this at that level.
We should resolve this conflict in the most direct way: introduce a
method, to be implemented by each target, that will answer these
questions. It should accept the exact spec of the new watchpoint, and
it should have access to the watchpoints and breakpoints already set,
including their full specs. With that information in hand, a target
can reliably produce a definitive response, at least in the vast
majority of cases, when the corresponding resources are under GDB
control.
To avoid breaking too many targets, the default implementation should
be what we do now. This will make the result no worse than the
current code.
Let's solve this problem once and for all. Any other way of treating
this problem will only sweep it under the carpet for a few more months
or years, until some other advanced platform comes out that needs more
kludgeying. The result will be (already is) code that is hard to
maintain and that is in real danger of breaking platforms other than
the one which needs the patch. When will it stop?
> The real fix IMHO would be to make the -tdep code manage the creation
> and deletion of bp_locations, so that it could always make an informed
> decision about what can and cannot be done with the available hardware
> debug resources.
Exactly!
> But that's out of the scope of this patch series.
I say, let's stop postponing this to some other patch series. I've
been to that movie enough to know that it's a polite form of saying
"never".
Sorry for being so blunt, but I think this problem is well past the
time we should have solved it for good.
next prev parent reply other threads:[~2011-05-03 6:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-13 20:55 [RFA] Implement support for PowerPC BookE masked watchpoints Thiago Jung Bauermann
2011-01-31 20:09 ` Thiago Jung Bauermann
2011-02-17 15:10 ` Ulrich Weigand
2011-04-18 21:22 ` [RFA 2/3] Demote to sw watchpoint only in update_watchpoint Thiago Jung Bauermann
2011-04-29 17:26 ` Ulrich Weigand
2011-05-03 4:56 ` Thiago Jung Bauermann
2011-05-03 6:05 ` Eli Zaretskii [this message]
2011-05-03 9:58 ` Pedro Alves
2011-05-03 16:57 ` Eli Zaretskii
2011-05-03 17:41 ` Pedro Alves
2011-05-03 18:03 ` Eli Zaretskii
2011-05-03 18:12 ` Pedro Alves
2011-05-03 20:30 ` Eli Zaretskii
2011-05-04 0:03 ` Thiago Jung Bauermann
2011-05-04 3:07 ` Eli Zaretskii
2011-05-04 22:21 ` Thiago Jung Bauermann
2011-05-05 3:09 ` Eli Zaretskii
2011-05-05 8:15 ` Pedro Alves
2011-05-05 10:28 ` Eli Zaretskii
2011-05-05 15:27 ` Pedro Alves
2011-05-05 16:27 ` Eli Zaretskii
2011-05-05 11:10 ` Ulrich Weigand
2011-05-05 15:21 ` Pedro Alves
2011-05-04 19:12 ` Thiago Jung Bauermann
2011-05-04 20:31 ` Eli Zaretskii
2011-05-04 22:22 ` Thiago Jung Bauermann
2011-05-05 11:04 ` Ulrich Weigand
2011-04-18 21:22 ` [RFA 1/3] Change watchpoint's enable state in do_enable_breakpoint Thiago Jung Bauermann
2011-04-29 17:21 ` Ulrich Weigand
2011-05-04 0:11 ` Thiago Jung Bauermann
2011-04-18 21:24 ` [RFA 3/3] Implement support for PowerPC BookE masked watchpoints Thiago Jung Bauermann
2011-04-29 17:46 ` Ulrich Weigand
2011-05-03 4:56 ` [needs doc review] " Thiago Jung Bauermann
2011-05-03 6:24 ` Eli Zaretskii
2011-05-05 21:57 ` Thiago Jung Bauermann
2011-05-06 10:28 ` Eli Zaretskii
2011-05-06 20:35 ` Thiago Jung Bauermann
2011-05-05 11:07 ` Ulrich Weigand
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=E1QH8jn-0001Wm-64@fencepost.gnu.org \
--to=eliz@gnu.org \
--cc=bauerman@br.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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