From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 6B1FC385700D for ; Thu, 13 May 2021 14:38:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6B1FC385700D Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 14DEcGYJ027606 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 May 2021 10:38:21 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 14DEcGYJ027606 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 BFBEA1E783; Thu, 13 May 2021 10:38:15 -0400 (EDT) Subject: Re: [PATCH 1/4] gdb: add new function quick_symbol_functions::has_unexpanded_symbols To: Andrew Burgess , gdb-patches@sourceware.org References: <87ca93b987e114d57bb549ae72d6635148341e22.1619456691.git.andrew.burgess@embecosm.com> From: Simon Marchi Message-ID: <31028587-9d73-da88-62de-f6d7f82c27df@polymtl.ca> Date: Thu, 13 May 2021 10:38:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <87ca93b987e114d57bb549ae72d6635148341e22.1619456691.git.andrew.burgess@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 13 May 2021 14:38:16 +0000 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: Thu, 13 May 2021 14:38:23 -0000 > diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h > index f06ceff41c2..096053e75e9 100644 > --- a/gdb/quick-symbol.h > +++ b/gdb/quick-symbol.h > @@ -86,6 +86,12 @@ struct quick_symbol_functions > available. */ > virtual bool has_symbols (struct objfile *objfile) = 0; > > + /* Return true if OBJFILE has any unexpanded symbols. A return value of > + false indicates there are no unexpanded symbols, this might mean that > + all of the symbols have been expanded (full debug has been read in), > + or it might been that OBJFILE has no debug information. */ > + virtual bool has_unexpanded_symbols (struct objfile *objfile) = 0; Naming nit: I would maybe suggest to name this "has_unexpanded_symtabs", since the unit of expansion is a symtab, not a symbol. I would understand it better this way. > diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c > index b839194e2f7..cfc3bed9222 100644 > --- a/gdb/symfile-debug.c > +++ b/gdb/symfile-debug.c > @@ -100,6 +100,19 @@ objfile::has_partial_symbols () > return retval; > } > > +/* See objfiles.h. */ > +bool > +objfile::has_unexpanded_symbols () > +{ > + for (const auto &iter : qf) > + { > + if (iter->has_unexpanded_symbols (this)) > + return true; > + } > + > + return false; > +} I find it odd that this is implemented in this file. I thought that symfile-debug.c was just for wrappers that add debug logging. Maybe that's how it was back then and it just evolved from there, when objfiles gained the capability to have multiple symbol providers. So I think it's fine to add this here, because it's in line with what's already there, but I would suggest adding the debug logs like there is in the other functions. Otherwise, LGTM. Simon