From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by sourceware.org (Postfix) with ESMTPS id A0047385DC32 for ; Wed, 20 May 2020 19:43:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A0047385DC32 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 43B712B53FB; Wed, 20 May 2020 15:43:47 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id grE4bTN8K7OW; Wed, 20 May 2020 15:43:47 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id EE1FD2B5753; Wed, 20 May 2020 15:43:46 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com EE1FD2B5753 X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZKv7jsAL1YK6; Wed, 20 May 2020 15:43:46 -0400 (EDT) Received: from [10.0.0.193] (unknown [192.222.164.54]) by mail.efficios.com (Postfix) with ESMTPSA id D8C5B2B53F4; Wed, 20 May 2020 15:43:46 -0400 (EDT) Subject: Re: [PATCH] gdb: reset/recompute objfile section offsets in reread_symbols To: Tom Tromey , Simon Marchi via Gdb-patches References: <20200520192226.2889993-1-simon.marchi@efficios.com> <877dx6o0ur.fsf@tromey.com> From: Simon Marchi Message-ID: <303c6a2a-9510-8ee4-8af2-81f3f65d2f57@efficios.com> Date: Wed, 20 May 2020 15:43:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <877dx6o0ur.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, 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: Wed, 20 May 2020 19:43:48 -0000 On 2020-05-20 3:36 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> This patch fixes this by making reread_symbols clear the > Simon> `section_offsets` vector, and re-create it by calling `sym_offsets`. > Simon> This is analogous to what syms_from_objfile_1 does. I didn't seem > Simon> absolutely necessary, but I also made it clear the various > Simon> `sect_index_*` fields, since their values no longer make sense (they > Simon> describe the old executable, and are indices in the now cleared > Simon> sections/section_offsets arrays). > > This makes sense to me. Thanks, I'll push the patch then. > Simon> I don't really like the approach taken by reread_symbols, trying to > Simon> reset everything manually on the objfile object, instead of, for > Simon> example, creating a new one from scratch. > > A long time ago, Jan had a patch to do exactly this. > I couldn't easily find it; there was some opposition to it at the time, > but I still think it's a better approach. Here's the thread: https://sourceware.org/legacy-ml/gdb-patches/2009-06/msg00679.html Simon