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 46033396E876 for ; Wed, 20 May 2020 19:34:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 46033396E876 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.193] (unknown [192.222.164.54]) (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 46F281E5F9; Wed, 20 May 2020 15:34:19 -0400 (EDT) Subject: Re: [PATCH] gdb: reset/recompute objfile section offsets in reread_symbols To: Christian Biesinger , Simon Marchi Cc: gdb-patches References: <20200520192226.2889993-1-simon.marchi@efficios.com> From: Simon Marchi Message-ID: <37e9ae9c-ff16-f571-596a-2f6b153d29c4@simark.ca> Date: Wed, 20 May 2020 15:34:18 -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: Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, 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:34:21 -0000 On 2020-05-20 3:24 p.m., Christian Biesinger via Gdb-patches wrote: > On Wed, May 20, 2020 at 2:22 PM Simon Marchi via Gdb-patches > wrote: >> diff --git a/gdb/symfile.c b/gdb/symfile.c >> index dd8192a67fbb..b02a9235663b 100644 >> --- a/gdb/symfile.c >> +++ b/gdb/symfile.c >> @@ -2543,6 +2543,11 @@ reread_symbols (void) >> will need to be called (see discussion below). */ >> obstack_free (&objfile->objfile_obstack, 0); >> objfile->sections = NULL; >> + objfile->section_offsets.clear (); >> + objfile->sect_index_bss = -1; >> + objfile->sect_index_data = -1; >> + objfile->sect_index_rodata = -1; >> + objfile->sect_index_text = -1; > > Would it make sense to have a reset() function on objfile instead, > that handles all necesary clearing of members? > > Christian > Probably not ideal, but probably better than what we have now. At least the knowledge of how to reset an objfile to an original state would be in the objfile class itself. I think it would be nicer to just free the objfile and create a new one from scratch, although I don't know what other problems come with that. Simon