From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id E4748385DC06 for ; Tue, 14 Apr 2020 15:04:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E4748385DC06 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6C2841E60C; Tue, 14 Apr 2020 11:04:47 -0400 (EDT) Subject: Re: [PATCH] breakpoint: Make sure location types match before swapping To: Keno Fischer , gdb-patches@sourceware.org References: <20200401013813.GA27550@juliacomputing.com> From: Simon Marchi Message-ID: <372f95e1-4591-7e0d-90c7-168477e032ba@simark.ca> Date: Tue, 14 Apr 2020 11:04:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-24.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2020 15:04:49 -0000 On 2020-04-14 3:01 a.m., Keno Fischer wrote: > Bump. It would be great to get this fixed. > > On Tue, Mar 31, 2020 at 9:38 PM Keno Fischer wrote: >> >> This patch fixes PR gdb/25741 "GDB tries to set breakpoint using Z0, but remove it using z1". >> In particular, what occurs in that case is that a hardware breakpoint is hit, >> after which GDB removes it and establishes a single step breakpoint at the >> same location. Afterwards, rather than simply removing this breakpoint and >> re-enabling the hardware breakpoint, GDB simply swaps the activation, without >> informing the server, leading to an inconsistency in GDB's view of the world >> and the server's view of the world. To remidy this situation, this >> patch adds a check that ensures two breakpoint locations have the >> same type before they are considered equal and thus eligible for silent >> swapping. >> >> gdb/ChangeLog: >> * breakpoint.c (breakpoint_locations_match): Fix PR gdb/25741 >> >> Signed-off-by: Keno Fischer >> --- >> gdb/breakpoint.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c >> index e49025461b..582dae1946 100644 >> --- a/gdb/breakpoint.c >> +++ b/gdb/breakpoint.c >> @@ -6838,7 +6838,7 @@ breakpoint_locations_match (struct bp_location *loc1, >> /* We compare bp_location.length in order to cover ranged breakpoints. */ >> return (breakpoint_address_match (loc1->pspace->aspace, loc1->address, >> loc2->pspace->aspace, loc2->address) >> - && loc1->length == loc2->length); >> + && loc1->length == loc2->length && loc1->loc_type == loc2->loc_type); >> } >> >> static void >> -- >> 2.24.0 >> I think the change makes sense, but this is not an area I know well, and it's one that is a bit sensitive. I'll do a full test run and take a bit more time to look at it. In the mean time, if anybody else wants to take a look, go for it. Simon