From patchwork Fri Aug 23 22:21:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 34259 Received: (qmail 115738 invoked by alias); 23 Aug 2019 22:21:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 115730 invoked by uid 89); 23 Aug 2019 22:21:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.142.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Aug 2019 22:21:23 +0000 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 396CF2CBCA9 for ; Fri, 23 Aug 2019 18:21:21 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id yXP2toN0N7hF; Fri, 23 Aug 2019 18:21:20 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 8F2552CBCA5; Fri, 23 Aug 2019 18:21:20 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 8F2552CBCA5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1566598880; bh=FGrrC6Am8EB1NbVgZrBqyR37A/fnsmyM5itGGXI4kF0=; h=From:To:Date:Message-Id:MIME-Version; b=XsOf6Tci3ezBrAaD6XF0AyiqjTeJlK9T6NVV1w9Esua8Bw2qkyfwXPXN73i7ezJzo Nhn3kSOiKaIntfbwkfiNspgo3DeocdR+CeXP3Wj6Nm5iVfgMoZ+UyqulMSjWuAFLvC CxjD6EgtcV3q6Y+Qq28eluqCyBAODwK+6+6AzzSPF/acw2PoRSP3L1mwxRrDSFHvyk ZM7XeVDciUacOk1Mzjcbf7mTmADbkvxK3T2kQdyNfUxsTxIK8TDZDshtetvU3w5sX2 kOwlf2WDcDbE7nNRDWYC/7waed7rbH1mCBC9KQA7QTfgdYzGMvijsT+xewuLH70Gl8 6ma4BtP5J0giw== Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id VFZn16p-uMwf; Fri, 23 Aug 2019 18:21:20 -0400 (EDT) Received: from localhost.localdomain (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) by mail.efficios.com (Postfix) with ESMTPSA id 2235C2CBCA0; Fri, 23 Aug 2019 18:21:20 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] Change lookup_symbol's block_index parameter type to block_enum Date: Fri, 23 Aug 2019 18:21:00 -0400 Message-Id: <20190823222100.30298-1-simon.marchi@efficios.com> MIME-Version: 1.0 The only two values valid to pass to the block_index parameter of quick_symbol_functions::lookup_symbol are GLOBAL_BLOCK and STATIC_BLOCK, part of enum block_enum. Change the type of that parameter to block_enum. Change also the block_index field of dw2_symtab_iterator in the same way.. This makes it consistent with dw2_debug_names_iterator, which already uses block_enum for its block_index field. This is a follow-up to this thread: https://sourceware.org/ml/gdb-patches/2019-08/msg00097.html gdb/ChangeLog: * dwarf2read.c (struct dw2_symtab_iterator) : Change type to gdb::optional. (dw2_symtab_iter_init): Change block_index parameter type to gdb::optional. (dw2_lookup_symbol): Change block_index parameter type to block_enum.c (dw2_debug_names_lookup_symbol): Likewise. * psymtab.c (psym_lookup_symbol): Likewise. * symfile-debug.c (debug_qf_lookup_symbol): Likewise. * symfile.h (struct quick_symbol_functions) : Likewise. --- gdb/dwarf2read.c | 9 ++++----- gdb/psymtab.c | 2 +- gdb/symfile-debug.c | 4 ++-- gdb/symfile.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 3dc34ab5a339..bd8323185fa6 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3883,7 +3883,7 @@ struct dw2_symtab_iterator struct dwarf2_per_objfile *dwarf2_per_objfile; /* If set, only look for symbols that match that block. Valid values are GLOBAL_BLOCK and STATIC_BLOCK. */ - gdb::optional block_index; + gdb::optional block_index; /* The kind of symbol we're looking for. */ domain_enum domain; /* The list of CUs from the index entry of the symbol, @@ -3905,7 +3905,7 @@ struct dw2_symtab_iterator static void dw2_symtab_iter_init (struct dw2_symtab_iterator *iter, struct dwarf2_per_objfile *dwarf2_per_objfile, - gdb::optional block_index, + gdb::optional block_index, domain_enum domain, const char *name) { @@ -4018,7 +4018,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter) } static struct compunit_symtab * -dw2_lookup_symbol (struct objfile *objfile, int block_index, +dw2_lookup_symbol (struct objfile *objfile, block_enum block_index, const char *name, domain_enum domain) { struct compunit_symtab *stab_best = NULL; @@ -6003,10 +6003,9 @@ dw2_debug_names_iterator::next () } static struct compunit_symtab * -dw2_debug_names_lookup_symbol (struct objfile *objfile, int block_index_int, +dw2_debug_names_lookup_symbol (struct objfile *objfile, block_enum block_index, const char *name, domain_enum domain) { - const block_enum block_index = static_cast (block_index_int); struct dwarf2_per_objfile *dwarf2_per_objfile = get_dwarf2_per_objfile (objfile); diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 6cc7566580ab..0bc38e8428be 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -479,7 +479,7 @@ find_pc_sect_psymbol (struct objfile *objfile, static struct compunit_symtab * psym_lookup_symbol (struct objfile *objfile, - int block_index, const char *name, + block_enum block_index, const char *name, const domain_enum domain) { const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 0f9da66e536f..c5b565fc517e 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -140,8 +140,8 @@ debug_qf_map_symtabs_matching_filename } static struct compunit_symtab * -debug_qf_lookup_symbol (struct objfile *objfile, int kind, const char *name, - domain_enum domain) +debug_qf_lookup_symbol (struct objfile *objfile, block_enum kind, + const char *name, domain_enum domain) { const struct debug_sym_fns_data *debug_data = symfile_debug_objfile_data_key.get (objfile); diff --git a/gdb/symfile.h b/gdb/symfile.h index 741b085e0c4f..9633a599fd09 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -179,7 +179,7 @@ struct quick_symbol_functions contains !TYPE_OPAQUE symbol prefer its compunit. If it contains only TYPE_OPAQUE symbol(s), return at least that compunit. */ struct compunit_symtab *(*lookup_symbol) (struct objfile *objfile, - int block_index, const char *name, + block_enum block_index, const char *name, domain_enum domain); /* Print statistics about any indices loaded for OBJFILE. The