From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id DE7743858D20 for ; Thu, 14 Sep 2023 12:20:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE7743858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694694053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FvqYnka0Kq8oJVM2MUC1raivx46dA+8hgKV++wdrOeg=; b=CJb1h6YPyqcaAJ1x4S0SeTQe73HuAZD5e0B+J5DB5rs0WXnJW/LlcZXizQA5kACV5Nxlqc na+BBlXLg8OTul6XvTW3QXm57LansoZXk6OPyed6WM1UpRDZKSwKVSt+ZvDHTt0KzB0K99 oVvKOD8Cfp1ti9qeV0MGLAr4jkd3Z34= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-kPXhKykLPYiF95e50DkgWQ-1; Thu, 14 Sep 2023 08:20:52 -0400 X-MC-Unique: kPXhKykLPYiF95e50DkgWQ-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9a9d7a801a3so66856366b.2 for ; Thu, 14 Sep 2023 05:20:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694694051; x=1695298851; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FvqYnka0Kq8oJVM2MUC1raivx46dA+8hgKV++wdrOeg=; b=Adzor7mTtFvHbI+td/QrRO6O4Vb2IsuPseINKqqMNRZfwYBvoTX0uUDAqSZf5eCpln Y4LtavHJmeGfxaFCZTIRsH2IsAR+fo0BcO6WWgk5U74GsAQas7kHhpnpSFHKWsYQvNvC VAs80TlGsz5qD14XwhAAPwLemck2O83CddH8SerIH0VUw0TuAPOjnlL75APCpzdy+HQ0 bQLk2xXegt8wwPtYgvzENdBZNfhHhVCdfAbdKv/3aJzlMihKrrzYwnvbBZE2D7UdJPiS Lrc9AkD/S3WIFDPPW3bMf729NtZG3hRPyjGrUL/oT10zdkVpl0sZ9+DSzKE9t/2PWkyf rKlQ== X-Gm-Message-State: AOJu0YzcUOXD3Rbl3ftL+k8mmjbonCyQmWMsvFBn8WuR/sV7qYe8JAPJ foohOQLwooKuu9g0B+94fRdfZCf7zI9qRiy9ZNv914T1j+FFYRaaxU4HtOLbe49xVUc4PQ17VBN 5mMdp4fmhRrfQIqMBaXyC0MxTgsdoIA== X-Received: by 2002:a17:907:7811:b0:9ad:78b7:29ea with SMTP id la17-20020a170907781100b009ad78b729eamr3920434ejc.44.1694694050870; Thu, 14 Sep 2023 05:20:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnI8IQZTvri7P99X2wJfPNlE4mBtcKTbBOvigeB9FNtwz4KUEWTrlg/sKIYRkmC1BKPT5btw== X-Received: by 2002:a17:907:7811:b0:9ad:78b7:29ea with SMTP id la17-20020a170907781100b009ad78b729eamr3920421ejc.44.1694694050557; Thu, 14 Sep 2023 05:20:50 -0700 (PDT) Received: from [10.43.2.16] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id rp9-20020a170906d96900b0099e05fb8f95sm934104ejb.137.2023.09.14.05.20.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Sep 2023 05:20:50 -0700 (PDT) Message-ID: <87896aa8-da82-3409-b675-ba0779de32ce@redhat.com> Date: Thu, 14 Sep 2023 14:20:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] Fix hardware watchpoints in replay mode To: Hannes Domani , gdb-patches@sourceware.org References: <20230913155330.1558-1-ssbssa.ref@yahoo.de> <20230913155330.1558-1-ssbssa@yahoo.de> From: Guinevere Larsen In-Reply-To: <20230913155330.1558-1-ssbssa@yahoo.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 13/09/2023 17:53, Hannes Domani via Gdb-patches wrote: > This regression was introduced by 9e8915c6cee5c37637521b424d723e990e06d597. > > The problem is that record_check_stopped_by_breakpoint always > overwrites record_full_stop_reason, thus loosing the > TARGET_STOPPED_BY_WATCHPOINT value which would be checked afterwards. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21969 Hi! Thanks for working on this! In general, when writing a commit message, its best to summarize the problem again, even if it is described in a bug tracker, because the next time this comes up, someone who already has the sources might have no internet access for a while, for example. In this situation, I would normally summarize this bug, explain the issue (that's not covered in the bug), then explain the solution, like so: "Recent changes introduced by commit 9e8915c6cee5c37637521b424d723e990e06d597 caused a regression that meant hardware watchpoint stops would not trigger in reverse execution or replay mode. This was documented in PR breakpoints/21969. The problem is that record_check_stopped_by_breakpoint always overwrites record_full_stop_reason, thus loosing the TARGET_STOPPED_BY_WATCHPOINT value which would be checked afterwards. This commit fixes that by checking if record_full_stop_reason is TARGET_STOPPED_BY_BREAKPOINT and, if so, not overriding it." and adding the "Bug:" trailer at the end. You are, of course, free to change this wording as much as you like, but having a fuller context is very useful when things like bug tracker changes break links in the commit history, for example. Additionally, have you tried making a testcase for this issue? I see that gdb.reverse/watch-reverse.exp tests hardware watchpoints in theory, but since this bug isn't triggered by it, it could probably do with some changes , so this doesn't regress again. My guess is that you need to clean the execution history before switching to hardware watchpoints, so that they get properly saved, but I haven't tested that yet. > --- > gdb/record-full.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gdb/record-full.c b/gdb/record-full.c > index faf8b595d22..da785ef4b2a 100644 > --- a/gdb/record-full.c > +++ b/gdb/record-full.c > @@ -1382,7 +1382,9 @@ record_full_wait_1 (struct target_ops *ops, > > /* check breakpoint */ > tmp_pc = regcache_read_pc (regcache); > - if (record_check_stopped_by_breakpoint > + if (record_full_stop_reason > + != TARGET_STOPPED_BY_WATCHPOINT > + && record_check_stopped_by_breakpoint > (aspace, tmp_pc, &record_full_stop_reason)) > { > if (record_debug) I think a simpler solution would be to move the hw watchpoint check further up, you won't need to check twice for the STOPPED_BY_WATCHPOINT reason. -- Cheers, Guinevere Larsen She/Her/Hers