From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id b6YoEQV+RmoGiSIAWB0awg (envelope-from ) for ; Thu, 02 Jul 2026 11:04:37 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=yahoo.de header.i=@yahoo.de header.a=rsa-sha256 header.s=s2048 header.b=fjfOVz9d; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 339C81E098; Thu, 02 Jul 2026 11:04:37 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C41941E024 for ; Thu, 02 Jul 2026 11:04:34 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BD664BAD160 for ; Thu, 2 Jul 2026 15:04:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BD664BAD160 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=yahoo.de header.i=@yahoo.de header.a=rsa-sha256 header.s=s2048 header.b=fjfOVz9d Received: from sonic308-18.consmr.mail.ir2.yahoo.com (sonic308-18.consmr.mail.ir2.yahoo.com [77.238.178.146]) by sourceware.org (Postfix) with ESMTPS id 732024BAD161 for ; Thu, 2 Jul 2026 15:04:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 732024BAD161 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=yahoo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 732024BAD161 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=77.238.178.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783004641; cv=none; b=kJRlZzu8ns0BdL300zoGh0bZplbiCLe3m8iBByvkLTg9MPj9bwtAhYj+ktsd2LIAfFL7s9IgncFAZFaZvhvyaZ4hw6ZTRd5dsDsdWT6upXc2Rz4M+kdI7ekw7UXN4HXj6Per9ynrFahjCb1uShQHeyDs+ftb3ZuEHe+5Sxcb6WM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783004641; c=relaxed/simple; bh=yZ+mBX12QGhbRlULrnRUf0nCidmQcxIy5ndyDa7l76E=; h=DKIM-Signature:Date:From:To:Message-ID:Subject:MIME-Version; b=i9FcjDZwFBmlwTxD2cTJv3g+m7TGu5R5Yarn6tMRMt2mi++mL85MHqF/n/8zup8eGxzyb8BZ9g81IxUxvJLdp9RyJ/mjJ/oK/6eEYFflIpq+ihieW/hvu+QuT2lER5qHrHI7lO0KhP0WEdmDBizlSrnYpvox+UCEOFRMpxUPIrA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=yahoo.de header.i=@yahoo.de header.a=rsa-sha256 header.s=s2048 header.b=fjfOVz9d DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 732024BAD161 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1783004637; bh=yZ+mBX12QGhbRlULrnRUf0nCidmQcxIy5ndyDa7l76E=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject:Reply-To; b=fjfOVz9df9760HYXf5hHzxuh9v0J3MCTCqkKQFQ/4Q+8hbOe8uPA5vOl/SxlzoiVezcUvyw6SMx/aWdMkknQLC5JziG7Rx1VNRl8o+E+AU7dGR00MI2XCH69QzCjmUrUNVRsCI8LMbFXtVB245zm87darfCGzdYfNP5L26keSkex4FNjQZDeJOnRJvR8R9CbP/hsvH/52HJfekW5qFhEHqgOsYFA+VGhRNYke6wUsLy9AJaNoAKf+MZcOtji+YbzblvWAkXD09gS+CBz9d9+sdNE+LtfutWGvkFa6ZQsSjuaQOZkBgQi/iK/D0sM38991VlnhcTHGd22cdtYsBWPZA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1783004637; bh=7ae6YJqByooq3ISaxiqKOcFVtMl8rNvuTR2iPqJkeXp=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=Hh0RQJ2s1wc2titPFXjrKWLwicrURl8Say+NgE+R71qCmAGv7xagw8RumbqhG3bPduspHPy6R85q7cIokBS+otxK0QWw48JNOXHdi9AFsPp7POKFLpNf8nu0cygr3OuZeVc/DrpKXTiV6kKVFvJRUkM4RrwcEhZyOuYoqgBZZVk5/epICIa/k3xXFG070TJBZ6Q391bRV4oqyUHMiFNhjFdxcU8JV0HWUK0Vve2I1YnpP2WVnNElleeK1zMB9jSuXj5E3IShFEVuHxApelAUOWAqAVKSwJZHJm+K4S82rNw1VvOyqMfy36vNol0xa1MyWfGpxMfB16IcSwzn78zbNQ== X-YMail-OSG: 6qVRJRcVM1luXWSnmJWvQSWlyxmHLFTFKRdE6u3HofAACkVlTa74Cuq6SeSqSp3 yTBFvEeLf7b6QITgtI8GGbug1E9zoTLVlu3S.Ix4a_O_SfGhXmNh9vm0kgy8.9dZ1QkQcyePdS6H CAlEfoRUZioheTdldl4Owp7.BLIU.A59Qvof6h7BJSggRSPFOX9EJt4Tdy1MfHxKqxnyvkAxXlKy v5FuLYsS6ZukNmLY1nsIK49lKwVOumHVAFeTLCHIM7RB1fqlsORZujlrJmAiuJPDD56K5O.I65ci ByIMedG6JNXGranpHcPxGxKbfnRFgENT3D7Xg7L8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bkaGBURO4rhoVmrUpwHa4nmz_LTrZpaGFavDgxvEef4XX4XVBWi OEoLsUw5bHnNjDCVpkubPl5BqSTbQzibt3yTa5kIM58oLnZN4h_Bjt1napNsiyrU_cRwgvRhHcUD TbWdv9zMX5azNytVN4F0YYyNBL2aconzjhc0Y.P2Vmi4PyogeYiFHbY4GPkxvFaRpByrJJKFo6wd LNM1OfWiMCo.2tORzhJpgatcRp58Z0t1ydH6MzG5nGWviQjf7utGb1QfQ.s8zdEsq9JLRWzx5_Qh O.j8xffD4BruJF7KGasG.fE9m2VY6K55hAYByd_r1EqDU7Kbk_d7.TJkaAyTvOHdYS4zZMUBuOXl xROg1Ldnop82IXV40XT9Ry7s5h.OMcKMz2nlZsG_FBlTFhs4sLd2eUT6CHAasVLVeH9iYIIp_t1. _Q_je_kYk_glMrMiEwzWYsoF2XbTibfuz4LyoZ9XSsQplglaV2VoTJRFNV.WQlcy0quTtQzU3AK8 jdT_rJyMjBNp791iV87uOM7aRCrclkasszHvIXNi.LotAR.f1KHBYjWgUWnNFBVdFuDfjLoe9mAf YkdUkp8ghh9pP1EAt5koQsdIM8M2WyKivmTotQnqysw8kHGXDASNg7JI1kA2kUQ01VayJ5C0PcJV siRfPiZlBqrlr1_ugeGIc0QmPNdMGeXwHPtVjbVLdrMKGnUnKgbLgn1ZE5cZ8GcDzD7Tbfz8L_d8 5lzITK3YydGESIXJyhj5s1YcS3wCK.GpRLMSV3TsYKhhe.RxDPBzJ03bZUh6gLhjJMkQlD7eaSJ9 1GXqnBCkDtxL3zUwTymQp1doF2I88Whn_kczQQkAx2bWDG22SZrKrNExKAHZhVeXo.ur8KxXGX4z ynZaHvPss3Kgs4bu.jfMDUM4ZZwIiHsZ7UyRTl9WCUoAVd5cJAleM X-Sonic-MF: X-Sonic-ID: e01cf895-85aa-4013-80e0-4c7d630cd646 Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ir2.yahoo.com with HTTP; Thu, 2 Jul 2026 15:03:57 +0000 Date: Thu, 2 Jul 2026 15:03:52 +0000 (UTC) From: Hannes Domani To: "gdb-patches@sourceware.org" , Guinevere Larsen Message-ID: <1163934045.1592524.1783004632246@mail.yahoo.com> In-Reply-To: <7703d72c-faec-4792-84c9-3ed71fad4024@redhat.com> References: <20260109194839.1598134-1-ssbssa.ref@yahoo.de> <20260109194839.1598134-1-ssbssa@yahoo.de> <7703d72c-faec-4792-84c9-3ed71fad4024@redhat.com> Subject: Re: [PATCH] Prevent downgrading of hardware watchpoints if possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.26086 YMailNorrin X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Am Montag, 29. Juni 2026 um 22:39:21 MESZ hat Guinevere Larsen Folgendes geschrieben: > On 1/9/26 4:48 PM, Hannes Domani wrote: > > The lazy flag of a value can tell us if the value contents are availabl= e. > > 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=3D27423 > > --- >=C2=A0 > Hi Hannes! >=C2=A0 > I took a look over this test, and I can't really review the technical > parts, but I tested locally and the test does cause the bug before the > change, and the code changes do solve the test, so I'm happy to add my > tested tag. >=C2=A0 > Tested-By: Guinevere Larsen >=C2=A0 > That said, I have one question and the pre-commit.exp test did point out > an issue, inlined. > > 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. > Shouldn't the copyright year just be 2026? Yes. > > + > > +# 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.=C2=A0 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.=C2=A0 If not, see . > > + > > +# 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]= } { > > +=C2=A0 =C2=A0 return -1 > > +} > > + > > +if {![runto_main]} { > > +=C2=A0 =C2=A0 return -1 > > +} > > + > > +gdb_breakpoint [gdb_get_line_number "mmap (p, len"] > > +gdb_continue_to_breakpoint "mmap" > > + > > +gdb_test "eval \"watch *(int *)%p =3D=3D 0\",p" \ > > +=C2=A0 =C2=A0 "Hardware watchpoint $decimal: .*" > > + > > +gdb_test "continue" \ > > +=C2=A0 =C2=A0 "Old value =3D .*New value =3D 0.*" > > diff --git a/gdb/value.c b/gdb/value.c > > index a52d4a6742c..c076617d102 100644 > > diff --git a/gdb/value.h b/gdb/value.h > > index 8dc3192f637..77919082fe3 100644 > > --- a/gdb/value.h > > +++ b/gdb/value.h > > @@ -138,6 +138,7 @@ struct value > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 m_stack (false), > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 m_is_zero (false), > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 m_in_history (false), > > +=C2=A0 =C2=A0 =C2=A0 m_fetch_lazy_failed (false), > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 m_type (type_), > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 m_enclosing_type (type_) > >=C2=A0 =C2=A0 { > > @@ -279,7 +280,13 @@ struct value > >=C2=A0 =C2=A0 { return m_lazy; } > >=C2=A0 > >=C2=A0 =C2=A0 void set_lazy (bool val) > > -=C2=A0 { m_lazy =3D val; } > > +=C2=A0 { > > +=C2=A0 =C2=A0 m_lazy =3D val; > > +=C2=A0 =C2=A0 m_fetch_lazy_failed =3D false; > > +=C2=A0 } > > + > > +=C2=A0 bool fetch_lazy_failed () const > > +=C2=A0 { return m_fetch_lazy_failed; } > >=C2=A0 > >=C2=A0 =C2=A0 /* If a value represents a C++ object, then the `type' fie= ld gives the > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 object's compile-time type.=C2=A0 If the obj= ect actually belongs to some > > @@ -681,6 +688,9 @@ struct value > >=C2=A0 =C2=A0 /* True if this a value recorded in value history; false o= therwise.=C2=A0 */ > >=C2=A0 =C2=A0 bool m_in_history : 1; > >=C2=A0 > > +=C2=A0 /* True if fetch_lazy() did not finish sucessfully.=C2=A0 */ > sucessfully =3D=3D> successfully Fixed locally as well. Since then I've enabled pre-commit as well, so I shouldn't miss these problems any more. Hannes