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 36E8E3858D28 for ; Wed, 18 Jan 2023 21:55:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36E8E3858D28 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)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B12631E112; Wed, 18 Jan 2023 16:55:18 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1674078918; bh=E0iT8NCyomBdrs+KxQuZ6y6WDOsx9AcfbdMR4K5p/lI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=izXQLsw3Zq3kILPMoFBQduSgSIJVIYwLrg66T26q5ACHEp/Yf0fo2AWwZ75Kk5aBl ajoknjvGVhs5Kex0sZh+3qyf1CunkhbPB+M6d9tZsqamYb+HlX3AC6yuy0tl8gFUdV ZViwzPfuUPUcWGoafd5Gl//485qW9H3EJErgABCc= Message-ID: <56ff147d-d09f-2093-efac-50b1eee555d0@simark.ca> Date: Wed, 18 Jan 2023 16:55:18 -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 3/6] Pass section index to start_compunit_symtab Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20230118153025.342512-1-tromey@adacore.com> <20230118153025.342512-4-tromey@adacore.com> From: Simon Marchi In-Reply-To: <20230118153025.342512-4-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: > /* Subroutine of augment_type_symtab to simplify it. > diff --git a/gdb/buildsym.h b/gdb/buildsym.h > index 9724607f3d9..0464c738114 100644 > --- a/gdb/buildsym.h > +++ b/gdb/buildsym.h > @@ -146,18 +146,23 @@ struct buildsym_compunit > (or NULL if not known). > > NAME and NAME_FOR_ID have the same purpose as for the start_subfile > - method. */ > + method. > + > + SECTION_INDEX is the index of the section for the compunit and > + for block symbols in this compunit. Normally SECT_OFF_TEXT. */ I don't understand this comment, specifically how a compunit can "have" a single section. Don't compunits define data and text symbols, which have different sections, for instance? >From what I can see, this section index is ultimately use to apply / unapply a relocation offset when dealing with call sites (e.g. compunit_symtab::find_call_site), so it makes sense that we want the text section (call site addresses are code addresses). So maybe the comment and / or the field name could reflect that this is the section index for the code / text section. Just saying "section index" doesn't tell much about which section it is. I'm curious to know why we have to store that and we can't always use SECT_OFF_TEXT, but I guess that will come with the following patches. Simon