From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id EC2F0385842B for ; Sun, 10 Dec 2023 16:45:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC2F0385842B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC2F0385842B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226709; cv=none; b=qsQVPtsmovd5pH43On82UO6JSYqeJ9/1gUAZ7UH0SqukHbBGZ/SDUQ4B5HUvvwmIuPWqVu6DJs2kC4ZNQyA5e2LHcP+eeZ4P4g0APFILcfGdLteyo//EcoqZkHWS428JQRa9nfyhvovC8O0DOVre9ExJMWoVJyx6wgnT6MX5J2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226709; c=relaxed/simple; bh=j/YPZ7NBL9D4dIwxu6iWXre08JMP3jDQF1Tf6C7B7JQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=l4QoSvF8IFk7SML7yR4HUsDpTpwRg6ZY60WYPo3UK/EmcqiRbCwVvEXd6MGL11TZPhA9sGK2ySjaWRh05/XWN44cEiFg4uZTx0CyzLErPU9bI6BSf+bCG7PDi4ap4wwCcYkzC7cYet1Vn2FjycqxZzvsztOYrGG0OsAWkzGOVpE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5004a.ext.cloudfilter.net ([10.0.29.221]) by cmsmtp with ESMTPS id CCsLr6NZDjtZ3CMvZrNyDW; Sun, 10 Dec 2023 16:45:13 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CMvPrP0c311XZCMvQrYzgJ; Sun, 10 Dec 2023 16:45:04 +0000 X-Authority-Analysis: v=2.4 cv=Z+v/oVdA c=1 sm=1 tr=0 ts=6575eb10 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=e2cXIFwxEfEA:10 a=Qbun_eYptAEA:10 a=hHa5O3fexFAedZGOxq8A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Y5GMm5K7EyuSKaMEaDKC2iIJYhVv0TKapE3asN7teQk=; b=DMmNQcSz/OyCCU8IIugIbcfyBi zGkW7C0PduELXpRI1l5MWZIC1efhSmaIPQ9j+1XbceJ9S5MpfZzLRaRxadcm5HAqpHLfZSO9E8OCB ORia0M21ZaDiUIKkUQcnB0iyS; Received: from [198.59.47.65] (port=52394 helo=[192.168.131.83]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rCMvP-001rpu-1F for gdb-patches@sourceware.org; Sun, 10 Dec 2023 09:45:03 -0700 From: Tom Tromey Date: Sun, 10 Dec 2023 09:44:56 -0700 Subject: [PATCH 07/17] Move cooked_index_functions to cooked-index.h MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231210-debug-names-fix-v1-7-a8f6d2525018@tromey.com> References: <20231210-debug-names-fix-v1-0-a8f6d2525018@tromey.com> In-Reply-To: <20231210-debug-names-fix-v1-0-a8f6d2525018@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 198.59.47.65 X-Source-L: No X-Exim-ID: 1rCMvP-001rpu-1F X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.131.83]) [198.59.47.65]:52394 X-Source-Auth: tom+tromey.com X-Email-Count: 8 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCH46KE0jQPFItm4AuclqsQJ8iEwunKe/Gb2LfLRQ7GkgzI44DshsnzhzqlCmrP/BKwbsEhZTBajXs/AIAYyRVvWP9dUT/7va5zYy5zcx0quX47zKTA0 VP+IjMiSfGAe0IN6dsOVpGBFYss3/qMcbmEg9v52rpee69uw5NLTdzB6S6wz0Gln4judrDUpMhMFikYpJ6Bm78q6zobzbx4vqhs= X-Spam-Status: No, score=-3024.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: This moves the declaration of cooked_index_functions to cooked-index.h. This makes it visible for use by the rewritten .debug_names reader, and it also lets us move the implementation of make_quick_functions into cooked-index.c, where it really belongs. --- gdb/dwarf2/cooked-index.c | 6 +++ gdb/dwarf2/cooked-index.h | 94 +++++++++++++++++++++++++++++++++++++++++++ gdb/dwarf2/read.c | 100 ---------------------------------------------- 3 files changed, 100 insertions(+), 100 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index d32fb360a4b..684773cb192 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -614,6 +614,12 @@ cooked_index::get_main () const return best_entry; } +quick_symbol_functions_up +cooked_index::make_quick_functions () const +{ + return quick_symbol_functions_up (new cooked_index_functions); +} + /* See cooked-index.h. */ void diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index 4e7882204a9..62230cf429b 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -677,4 +677,98 @@ class cooked_index : public dwarf_scanner_base dwarf2_per_bfd *m_per_bfd; }; +/* An implementation of quick_symbol_functions for the cooked DWARF + index. */ + +struct cooked_index_functions : public dwarf2_base_index_functions +{ + cooked_index *wait (struct objfile *objfile, bool allow_quit) + { + dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); + cooked_index *table + = (gdb::checked_static_cast + (per_objfile->per_bfd->index_table.get ())); + table->wait (cooked_state::MAIN_AVAILABLE, allow_quit); + return table; + } + + dwarf2_per_cu_data *find_per_cu (dwarf2_per_bfd *per_bfd, + CORE_ADDR adjusted_pc) override; + + struct compunit_symtab *find_compunit_symtab_by_address + (struct objfile *objfile, CORE_ADDR address) override; + + bool has_unexpanded_symtabs (struct objfile *objfile) override + { + wait (objfile, true); + return dwarf2_base_index_functions::has_unexpanded_symtabs (objfile); + } + + struct symtab *find_last_source_symtab (struct objfile *objfile) override + { + wait (objfile, true); + return dwarf2_base_index_functions::find_last_source_symtab (objfile); + } + + void forget_cached_source_info (struct objfile *objfile) override + { + wait (objfile, true); + dwarf2_base_index_functions::forget_cached_source_info (objfile); + } + + void print_stats (struct objfile *objfile, bool print_bcache) override + { + wait (objfile, true); + dwarf2_base_index_functions::print_stats (objfile, print_bcache); + } + + void dump (struct objfile *objfile) override + { + cooked_index *index = wait (objfile, true); + gdb_printf ("Cooked index in use:\n"); + gdb_printf ("\n"); + index->dump (objfile->arch ()); + } + + void expand_all_symtabs (struct objfile *objfile) override + { + wait (objfile, true); + dwarf2_base_index_functions::expand_all_symtabs (objfile); + } + + bool expand_symtabs_matching + (struct objfile *objfile, + gdb::function_view file_matcher, + const lookup_name_info *lookup_name, + gdb::function_view symbol_matcher, + gdb::function_view expansion_notify, + block_search_flags search_flags, + domain_enum domain, + enum search_domain kind) override; + + struct compunit_symtab *find_pc_sect_compunit_symtab + (struct objfile *objfile, struct bound_minimal_symbol msymbol, + CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override + { + wait (objfile, true); + return (dwarf2_base_index_functions::find_pc_sect_compunit_symtab + (objfile, msymbol, pc, section, warn_if_readin)); + } + + void map_symbol_filenames + (struct objfile *objfile, + gdb::function_view fun, + bool need_fullname) override + { + wait (objfile, true); + return (dwarf2_base_index_functions::map_symbol_filenames + (objfile, fun, need_fullname)); + } + + void compute_main_name (struct objfile *objfile) override + { + wait (objfile, false); + } +}; + #endif /* GDB_DWARF2_COOKED_INDEX_H */ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index e7da647fec2..acdb1969915 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16560,100 +16560,6 @@ cooked_indexer::make_index (cutu_reader *reader) } } -/* An implementation of quick_symbol_functions for the cooked DWARF - index. */ - -struct cooked_index_functions : public dwarf2_base_index_functions -{ - cooked_index *wait (struct objfile *objfile, bool allow_quit) - { - dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - cooked_index *table - = (gdb::checked_static_cast - (per_objfile->per_bfd->index_table.get ())); - table->wait (cooked_state::MAIN_AVAILABLE, allow_quit); - return table; - } - - dwarf2_per_cu_data *find_per_cu (dwarf2_per_bfd *per_bfd, - CORE_ADDR adjusted_pc) override; - - struct compunit_symtab *find_compunit_symtab_by_address - (struct objfile *objfile, CORE_ADDR address) override; - - bool has_unexpanded_symtabs (struct objfile *objfile) override - { - wait (objfile, true); - return dwarf2_base_index_functions::has_unexpanded_symtabs (objfile); - } - - struct symtab *find_last_source_symtab (struct objfile *objfile) override - { - wait (objfile, true); - return dwarf2_base_index_functions::find_last_source_symtab (objfile); - } - - void forget_cached_source_info (struct objfile *objfile) override - { - wait (objfile, true); - dwarf2_base_index_functions::forget_cached_source_info (objfile); - } - - void print_stats (struct objfile *objfile, bool print_bcache) override - { - wait (objfile, true); - dwarf2_base_index_functions::print_stats (objfile, print_bcache); - } - - void dump (struct objfile *objfile) override - { - cooked_index *index = wait (objfile, true); - gdb_printf ("Cooked index in use:\n"); - gdb_printf ("\n"); - index->dump (objfile->arch ()); - } - - void expand_all_symtabs (struct objfile *objfile) override - { - wait (objfile, true); - dwarf2_base_index_functions::expand_all_symtabs (objfile); - } - - bool expand_symtabs_matching - (struct objfile *objfile, - gdb::function_view file_matcher, - const lookup_name_info *lookup_name, - gdb::function_view symbol_matcher, - gdb::function_view expansion_notify, - block_search_flags search_flags, - domain_enum domain, - enum search_domain kind) override; - - struct compunit_symtab *find_pc_sect_compunit_symtab - (struct objfile *objfile, struct bound_minimal_symbol msymbol, - CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override - { - wait (objfile, true); - return (dwarf2_base_index_functions::find_pc_sect_compunit_symtab - (objfile, msymbol, pc, section, warn_if_readin)); - } - - void map_symbol_filenames - (struct objfile *objfile, - gdb::function_view fun, - bool need_fullname) override - { - wait (objfile, true); - return (dwarf2_base_index_functions::map_symbol_filenames - (objfile, fun, need_fullname)); - } - - void compute_main_name (struct objfile *objfile) override - { - wait (objfile, false); - } -}; - dwarf2_per_cu_data * cooked_index_functions::find_per_cu (dwarf2_per_bfd *per_bfd, CORE_ADDR adjusted_pc) @@ -16827,12 +16733,6 @@ start_debug_info_reader (dwarf2_per_objfile *per_objfile) idx->start_reading (); } -quick_symbol_functions_up -cooked_index::make_quick_functions () const -{ - return quick_symbol_functions_up (new cooked_index_functions); -} - /* Read the .debug_loclists or .debug_rnglists header (they are the same format) -- 2.43.0