From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id xKDkBx6rrGIK8AIAWB0awg (envelope-from ) for ; Fri, 17 Jun 2022 12:26:06 -0400 Received: by simark.ca (Postfix, from userid 112) id 0D74C1E224; Fri, 17 Jun 2022 12:26:06 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=H1Ew8zBa; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C152D1E15C for ; Fri, 17 Jun 2022 12:26:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0DA5A383F940 for ; Fri, 17 Jun 2022 16:26:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DA5A383F940 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1655483163; bh=Nu6uu6HOgV0eZN2y5bdsvgQGqogMcrvSgJEmUcqwjtM=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=H1Ew8zBa7E7hxPhBpJDAX6HwzT1m4J9vDxjf0992jBFu+u4+FKl1MxYJX7EIUlRux /WGHhcr4I+o/m3xHmUjEsKnIDUCS6R8DwPRcJYSAf/gshsp7yXBdUeCixvsJSx13jF zaRda3iJbfFCITe/rgoMAmNaLaz4PgzbczPvUURI= Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 435103835431 for ; Fri, 17 Jun 2022 16:25:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 435103835431 Received: from ubuntu.lan (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 2008486CF5; Fri, 17 Jun 2022 16:25:07 +0000 (UTC) Date: Fri, 17 Jun 2022 16:25:00 +0000 To: Simon Marchi Subject: Re: [PATCH] gdb: reject inserting breakpoints between functions Message-ID: <20220617162125.pqcerpgquu5pruez@ubuntu.lan> References: <20220408200536.235329-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220408200536.235329-1-simon.marchi@efficios.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Fri, 17 Jun 2022 16:25:07 +0000 (UTC) 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: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: Simon Marchi , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, I have just sent a patch[1] which sits on top of this one. I do not think there have been feedbacks on this yet, so I'd like to ping on this one on behalf on Simon. For what it is worth, I do agree with the change proposed changes as it is a pre-requisite for what I am proposing in [1]. Thanks, Lancelot. [1] https://sourceware.org/pipermail/gdb-patches/2022-June/190150.html > diff --git a/gdb/linespec.c b/gdb/linespec.c > index 9d4707cbb4e7..dd31cf2a9fc4 100644 > --- a/gdb/linespec.c > +++ b/gdb/linespec.c > @@ -2133,11 +2140,44 @@ create_sals_line_offset (struct linespec_state *self, > struct symbol *sym = (blocks[i] > ? block_containing_function (blocks[i]) > : NULL); > + symtab_and_line *sal = &intermediate_results[i]; > + > + /* Don't consider a match if: > + > + - the provided line did not give an exact match (so we started > + looking for lines below until we found one with code > + associated to it) > + - the found location is exactly the start of a function > + - the provided line is above the declaration line of the function > + > + Consider the following source: > + > + 10 } // end of a previous function > + 11 > + 12 int > + 13 main (void) > + 14 { > + 15 int i = 1; > + 16 > + 17 return 0; > + 18 } > + > + The intent of this heuristic is that a breakpoint requested on > + line 11 and 12 will not result on a breakpoint on main, but a > + breakpoint on line 13 will. A breakpoint requested on the empty > + line 16 will also result in a breakpoint in main, at line 17. */ > + if (!was_exact > + && sym != nullptr > + && sym->aclass () == LOC_BLOCK > + && sal->pc == BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) The BLOCK_ENTRY_PC and SYMBOL_BLOCK_VALUE macros have been removed. This should now be: + && sal->pc == sym->value_block ()->entry_pc () > + && val.line < sym->line ()) > + continue; > > if (self->funfirstline) > - skip_prologue_sal (&intermediate_results[i]); > - intermediate_results[i].symbol = sym; > - add_sal_to_sals (self, &values, &intermediate_results[i], > + skip_prologue_sal (sal); > + > + sal->symbol = sym; > + add_sal_to_sals (self, &values, sal, > sym ? sym->natural_name () : NULL, 0); > } > }