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 879343858CDB for ; Thu, 29 Sep 2022 23:59:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 879343858CDB Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 06ACA1E0D3; Thu, 29 Sep 2022 19:59:16 -0400 (EDT) Message-ID: <2e9a3dab-8783-91b2-9ddf-64e72a5ad560@simark.ca> Date: Thu, 29 Sep 2022 19:59:16 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH] Remove decode_location_spec_default Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20220929233526.1283953-1-tom@tromey.com> From: Simon Marchi In-Reply-To: <20220929233526.1283953-1-tom@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, 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 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: Thu, 29 Sep 2022 23:59:18 -0000 On 2022-09-29 19:35, Tom Tromey wrote: > This removes decode_location_spec_default, inlining it into its sole > caller. > > Regression tested on x86-64 Fedora 34. > --- > gdb/breakpoint.c | 45 +++++++++++++++------------------------------ > 1 file changed, 15 insertions(+), 30 deletions(-) > > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 002f4a935b1..c8c34120aa0 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -100,10 +100,6 @@ static void create_breakpoints_sal (struct gdbarch *, > int, > int, int, int, unsigned); > > -static std::vector decode_location_spec_default > - (struct breakpoint *b, struct location_spec *locspec, > - struct program_space *search_pspace); > - > static int can_use_hardware_watchpoint > (const std::vector &vals); > > @@ -11692,7 +11688,21 @@ code_breakpoint::decode_location_spec (location_spec *locspec, > if (locspec->type () == PROBE_LOCATION_SPEC) > return bkpt_probe_decode_location_spec (this, locspec, search_pspace); > > - return decode_location_spec_default (this, locspec, search_pspace); > + struct linespec_result canonical; > + > + decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace, > + NULL, 0, &canonical, multiple_symbols_all, > + filter.get ()); > + > + /* We should get 0 or 1 resulting SALs. */ > + gdb_assert (canonical.lsals.size () < 2); > + > + if (!canonical.lsals.empty ()) > + { > + const linespec_sals &lsal = canonical.lsals[0]; > + return std::move (lsal.sals); > + } > + return {}; > } > > /* Virtual table for internal breakpoints. */ > @@ -12750,31 +12760,6 @@ create_sals_from_location_spec_default (location_spec *locspec, > parse_breakpoint_sals (locspec, canonical); > } > > -/* Decode the line represented by S by calling decode_line_full. This is the > - default function for the `decode_location' method of breakpoint_ops. */ > - > -static std::vector > -decode_location_spec_default (struct breakpoint *b, > - location_spec *locspec, > - program_space *search_pspace) > -{ > - struct linespec_result canonical; > - > - decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace, > - NULL, 0, &canonical, multiple_symbols_all, > - b->filter.get ()); > - > - /* We should get 0 or 1 resulting SALs. */ > - gdb_assert (canonical.lsals.size () < 2); > - > - if (!canonical.lsals.empty ()) > - { > - const linespec_sals &lsal = canonical.lsals[0]; > - return std::move (lsal.sals); > - } > - return {}; > -} > - > /* Reset a breakpoint. */ > > static void LGTM. Simon