From: Hannes Domani <ssbssa@yahoo.de>
To: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Prevent downgrading of hardware watchpoints if possible
Date: Fri, 3 Jul 2026 19:18:31 +0000 (UTC) [thread overview]
Message-ID: <2003489748.2238776.1783106311866@mail.yahoo.com> (raw)
In-Reply-To: <87a4s8oj60.fsf@linaro.org>
Am Freitag, 3. Juli 2026 um 05:18:19 MESZ hat Thiago Jung Bauermann <thiago.bauermann@linaro.org> Folgendes geschrieben:
> Hannes Domani <ssbssa@yahoo.de> writes:
>
> > The lazy flag of a value can tell us if the value contents are available.
> > But this could be either because it was simply never actually accessed,
> > or it tried to be accessed, and failed.
> > The latter are interesting for watchpoints, the former are not.
> >
> > Currently it only uses lazy values if they are at the head of the value
> > chain, but this is fragile logic, and degrades some watchpoints to
> > software watchpoints where it's actually not necessary.
> >
> > So this adds a new value flag 'm_fetch_lazy_failed' which tells if the
> > watchpoint expression actually tried to access the value and failed.
> > And this is used instead of the value chain location to tell if a lazy
> > value should be used as a watchpoint location.
> >
> > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27423
> > ---
> > gdb/breakpoint.c | 11 ++--
> > .../gdb.base/watchpoint-hw-no-degradation.c | 51 +++++++++++++++++++
> > .../gdb.base/watchpoint-hw-no-degradation.exp | 38 ++++++++++++++
> > gdb/value.c | 3 ++
> > gdb/value.h | 12 ++++-
> > 5 files changed, 108 insertions(+), 7 deletions(-)
> > create mode 100644 gdb/testsuite/gdb.base/watchpoint-hw-no-degradation.c
> > create mode 100644 gdb/testsuite/gdb.base/watchpoint-hw-no-degradation.exp
>
> I like the solution, thanks!
>
> Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
>
> Just one nit in the testcase:
>
> > diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-no-degradation.exp b/gdb/testsuite/gdb.base/watchpoint-hw-no-degradation.exp
> > new file mode 100644
> > index 00000000000..94ef335c77f
> > --- /dev/null
> > +++ b/gdb/testsuite/gdb.base/watchpoint-hw-no-degradation.exp
> > @@ -0,0 +1,38 @@
> > +# Copyright 2009-2026 Free Software Foundation, Inc.
> > +
> > +# This program is free software; you can redistribute it and/or modify
> > +# it under the terms of the GNU General Public License as published by
> > +# the Free Software Foundation; either version 3 of the License, or
> > +# (at your option) any later version.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> > +
> > +# Test if watchpoint doesn't degrade to a software watchpoint if part of
> > +# expression isn't accessible at time of watchpoint creation.
> > +
> > +require allow_hw_watchpoint_access_tests
> > +
> > +standard_testfile
> > +
> > +if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
> > + return -1
> > +}
> > +
> > +if {![runto_main]} {
> > + return -1
> > +}
>
> There's no need to return a value from the top-level. Please change the
> returns above to just "return".
I've made these changes.
Hannes
prev parent reply other threads:[~2026-07-03 19:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260109194839.1598134-1-ssbssa.ref@yahoo.de>
2026-01-09 19:48 ` Hannes Domani
2026-06-26 14:58 ` Hannes Domani
2026-06-29 20:39 ` Guinevere Larsen
2026-07-02 15:03 ` Hannes Domani
2026-07-03 3:18 ` Thiago Jung Bauermann
2026-07-03 19:18 ` Hannes Domani [this message]
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=2003489748.2238776.1783106311866@mail.yahoo.com \
--to=ssbssa@yahoo.de \
--cc=gdb-patches@sourceware.org \
--cc=thiago.bauermann@linaro.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