From patchwork Wed Jan 17 16:39:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 84269 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 96D043857C42 for ; Wed, 17 Jan 2024 16:41:21 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 356ED38582AC for ; Wed, 17 Jan 2024 16:39:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 356ED38582AC 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 356ED38582AC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705509584; cv=none; b=gsaJSufAUBYySMIRvfCgDh1IS9jDm9kczRa1LXjFRIGJLBSa3jaD2M7qHY/d/LzARyt+g1EgFwo5FiofbUgvi2ljIVuoMVZNzQewtevz9M6TWHSSjTHSPtqrskDLPobI7QyrtJTvUkI1u5BH3sKF/YzKXhBxOLxOManfKwfzx9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705509584; c=relaxed/simple; bh=XM/nSDJnr3qOTsQ5YzToxJAJ1g/vKiGOBLFzGOBVvGg=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=DvafJYDFu//tswrA6JfAwYD62M1JihwYgti9LJASACPxOJXZV9G8aa6BxDQtr9RTTzA3ickKaBx+GxfCOGmS+FG+8wd0RAaQd/oOIRf6TV+imLpT8ZYT2cfGuJOJSKQnV8ZkMVJD/3a25/yefxeoD3/Epla6vkaLYwCrhOIJiM0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5005a.ext.cloudfilter.net ([10.0.29.234]) by cmsmtp with ESMTPS id Q8QYrSvDF80oiQ8x1rmtXO; Wed, 17 Jan 2024 16:39:39 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Q8wzrVRPNfs4hQ8x0rWpUG; Wed, 17 Jan 2024 16:39:38 +0000 X-Authority-Analysis: v=2.4 cv=Q6TBXq6a c=1 sm=1 tr=0 ts=65a802ca a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=dEuoMetlWLkA: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=89wZOdmJrcD0rJguASCZi3KzREa81w1lVvnojxUHxR0=; b=vFWIrePQFCw/aCNcwgO7KPhPKr APWnbb67b/8lhN84seWsBUKPuYu7koNC0aWd/dZE8OgY4jtzTfS7JUqqZUm2oRJxB+X5BBVjYNg1c GUshrrKG1bH6kvTDrxair7Ifn; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:56636 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rQ8wz-002OXE-22 for gdb-patches@sourceware.org; Wed, 17 Jan 2024 09:39:37 -0700 From: Tom Tromey Date: Wed, 17 Jan 2024 09:39:34 -0700 Subject: [PATCH v2 06/17] Move cooked_index_functions to cooked-index.h MIME-Version: 1.0 Message-Id: <20240117-debug-names-fix-v2-6-dbd5971a9c31@tromey.com> References: <20240117-debug-names-fix-v2-0-dbd5971a9c31@tromey.com> In-Reply-To: <20240117-debug-names-fix-v2-0-dbd5971a9c31@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: 97.122.68.157 X-Source-L: No X-Exim-ID: 1rQ8wz-002OXE-22 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-68-157.hlrn.qwest.net ([192.168.0.21]) [97.122.68.157]:56636 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfLLIawiR50YJDfEEvq8FC4ACmiHYqaT+hReKAB9k6EmazHhbwuWvPDqC7kZS87C4exBu7h/u0aY17fUnvvCC9jGrL4TRpRjhBHlW3ro4OTiwfFC2W5ZK Fv77s9nG1gHQTSOGEqgzvTyXQzEM8HFxwzY9dzO6oTMO7nKLuGY1hz1iNml7vbP1xvkOTz7gUZBmocrleErpRDvV4Q4R7/BG4uY= X-Spam-Status: No, score=-3022.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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 54c622977b1..542ec2fd69f 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -616,6 +616,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 6caa8132f53..24c83b56e05 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -737,4 +737,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, + unrelocated_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 cac194df617..8010c0141f5 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16651,100 +16651,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, - unrelocated_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, unrelocated_addr adjusted_pc) @@ -16919,12 +16825,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)