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 6F0C63858439 for ; Wed, 18 Jan 2023 17:19:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F0C63858439 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca 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) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9C9541E0D3; Wed, 18 Jan 2023 12:19:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1674062343; bh=e7l8ZrhX1y5kbVFBdUaTTmZdg/iaHRXL+yLCWK05OPc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=JeXo4JxchMvvr+z05cNm7RouJy3zKyAVM3VnZqLvYxhojWU0Q+ff1C9P9lknZVuT5 NLHU57Sca9WhaGY59b4F8+FTBLP3Fhs31KH92IKDIXOIsfJmqopwMOMvZvNw5+JMPa 0KbWRAlKR4ofi/BxTSsqYwSvrt3YElK7e6uqQGMg= Message-ID: <01e52cad-f3ee-41e2-661c-eb95b1b6adc6@simark.ca> Date: Wed, 18 Jan 2023 12:19:03 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 1/6] Use default section indexes in fixup_symbol_section Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20230118153025.342512-1-tromey@adacore.com> <20230118153025.342512-2-tromey@adacore.com> From: Simon Marchi In-Reply-To: <20230118153025.342512-2-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 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 List-Id: On 1/18/23 10:30, Tom Tromey via Gdb-patches wrote: > If fixup_section does not find a matching section, it arbitrarily > chooses the first one. However, it seems better to make this default > depend on the type of the symbol -- i.e., default data symbols to > .data and text symbols to .text. > > I've also made fixup_section static, as it only has one caller. I don't really know the big picture to tell whether this is right, but one small comment: > --- > gdb/symtab.c | 16 ++++++++++++---- > gdb/symtab.h | 3 --- > 2 files changed, 12 insertions(+), 7 deletions(-) > > diff --git a/gdb/symtab.c b/gdb/symtab.c > index b3445133c8c..fe247ab70eb 100644 > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -1704,9 +1704,10 @@ symtab_free_objfile_observer (struct objfile *objfile) > /* Debug symbols usually don't have section information. We need to dig that > out of the minimal symbols and stash that in the debug symbol. */ > > -void > +static void > fixup_section (struct general_symbol_info *ginfo, > - CORE_ADDR addr, struct objfile *objfile) > + CORE_ADDR addr, struct objfile *objfile, > + int default_section) Could you expand the comment above to describe default_section? Simon