Message ID | 20240118-submit-domain-hacks-2-v2-0-aecab29fa104@tromey.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 AEC4238582AD for <patchwork@sourceware.org>; Thu, 18 Jan 2024 20:33:25 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id A59A93858C2D for <gdb-patches@sourceware.org>; Thu, 18 Jan 2024 20:32:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A59A93858C2D 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 A59A93858C2D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705609936; cv=none; b=T7VeRyQTS0b2vROjGr/n1Towax70Rd90gEifwip5yKCixWFVLe5m+sqU5p/jHkc2P8wgJ+UMCK6aLUwPbIPqwQYjRpcK83QO6yIZGtzq4R8sTZvoVZfhKCvLO7F6yK5MCMjRgWXz/GgQlkgx+uaCrxlOFhE8NsHtZDvHLshKoO0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705609936; c=relaxed/simple; bh=Nq0IRuxoaNMfu8E8/TFfqrjehJXHYSSlz3dN3UY/XOc=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=KlzoGvXB1frYPdZ2M7vX/ocqWlGepmgreXkPtLVxHtjjgyGNU/Vj88WVXwpKtDvJewajuI8GIG1tJityDSGQ2ATyrMYrxKhsFQ3WzQpr1V9BVW+f0nITToEfBjUScGyrEG2bcgpdmC/PpCH0d34/JScydhs0WQJKIjFsfV/bdP0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5003a.ext.cloudfilter.net ([10.0.29.159]) by cmsmtp with ESMTPS id QKVYrd54coMN9QZ3YrOo96; Thu, 18 Jan 2024 20:32:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id QZ3XrrXyql5UwQZ3Xrg4h2; Thu, 18 Jan 2024 20:32:07 +0000 X-Authority-Analysis: v=2.4 cv=daKTYFbe c=1 sm=1 tr=0 ts=65a98ac7 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=CCpqsmhAAAAA:8 a=zstS-IiYAAAA:8 a=la7AgGY8nKI83QAR_9sA:9 a=QEXdDO2ut3YA:10 a=ul9cdbp4aOFLsgKbc677:22 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-Id:Date:Subject:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8Py64TGrTbXyx830UzLGU3G3yfj8UXK0MS1XugWLopY=; b=msyG7Eqc91MD4JIBAPQD1KYsQX v9lbB+4q5vxYjUx801NP2+P4N3apdvrUG8nS/1QdSorhZmWjiWrWJZ+GJ5BK2g9EMEVLvQwIxkleU RyEp0Y5/0XUNZwZZpLHDXjCpx; Received: from 97-122-68-157.hlrn.qwest.net ([97.122.68.157]:50746 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 <tom@tromey.com>) id 1rQZ3W-002DCj-2r; Thu, 18 Jan 2024 13:32:06 -0700 From: Tom Tromey <tom@tromey.com> Subject: [PATCH v2 00/30] Restructure symbol domains Date: Thu, 18 Jan 2024 13:31:58 -0700 Message-Id: <20240118-submit-domain-hacks-2-v2-0-aecab29fa104@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAL6KqWUC/4WNSw7CIBRFt9Iw9hkeWmIduQ/TAZ+nEAMYwMam6 d6l3YDDk5x77sIKZU+FXbuFZZp88Sk2EIeOGafik8DbxkxwcUIUHMpHB1/BpqB8BKfMq4AANEh S6rPtJWdt+8708N+9ex8ba1UIdFbRuK0WVKmUN9H5UlOe9/8JN/3f1YTAQQyy55ajxuFyqzkFm o8mBTau6/oDiJl6kNQAAAA= To: gdb-patches@sourceware.org Cc: Eli Zaretskii <eliz@gnu.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: 1rQZ3W-002DCj-2r 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]:50746 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfH5Zb8G63jchZxu6RtQp1vGHzDOdmTUnqx57eO9v9Q3C5BH4796UGaHCz+5KcOPke9JjMd8uuV+whNWmI+QVQ0NMcI1IMRpgkNAwLjX0fHVv1u0SHhQb yNPLlXdpheZvEzE10l4U3z+KXKrJ63p7AX2rQ1ZwQWy/xLJd7aCG8D4icbdXcO4auyzUSkXW9y9HSMpKUd4OXBVerW2i435wD7M= X-Spam-Status: No, score=-3016.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Restructure symbol domains
|
|
Message
Tom Tromey
Jan. 18, 2024, 8:31 p.m. UTC
v2 note: I was planning to check this in, but re-testing showed some regressions. I've fixed them here, basically DW_TAG_entry_point caused some problems necessitating a fix in one patch, and a new patch to fix a latent bug. I plan to check this in relatively soon. gdb's symbol domains have long needed some restructuring. The current symbol domains are C-centric, with the "struct" domain being separate from types (which is not the case in non-C languages) and function and types being lumped in with variables. This latter decision makes it impossible to search the symbol table for a function, resulting in bugs like PR 30158, where "main" was found as a namespace, causing a crash. This series adds new symbol domains for types and functions, and changes the various symbol-lookup functions to allow multiple domains to be searched at once. Then, the symbol readers are changed to use the new domains. Finally, selected bits of code are changed to be more precise in which domains they search. symbol_matches_domain currently has a C++-specific hack. This hack handles the C++ language rule where a tag is also entered as a typedef. While working on this series, I discovered that the non-DWARF symbol readers will actually emit a second typedef symbol. DWARF could do this as well, at some memory expense; and while I consider this to be cleaner in an abstract way, for the time being I've left the hack in place. I regression tested this on x86-64 Fedora 38. I also regression tested using the debug-names and gdb-index target boards. --- Changes in v2: - Added patch to fix DW_TAG_entry_point - Link to v1: https://inbox.sourceware.org/gdb-patches/20231120-submit-domain-hacks-2-v1-0-29650d01b198@tromey.com --- Tom Tromey (30): Fix bug in cooked index scanner Small cleanup in DWARF reader Fix latent bug in DW_TAG_entry_point handling Make nsalias.exp more reliable Fix latent bug in mdebugread.c Give names to unspecified types Remove NR_DOMAINS Simplify symbol_to_info_string Split up a big 'if' in symtab.c Use a .def file for domain_enum Add two new symbol domains Add domain_search_flags Replace search_domain with domain_search_flags Remove a check of VAR_DOMAIN Introduce "scripting" domains Use domain_search_flags in lookup_global_symbol_language Use domain_search_flags in lookup_symbol et al Remove some obsolete Python constants Remove old symbol_matches_domain Use the new symbol domains Simplify some symbol searches in Ada code Simplify some symbol searches in linespec.c Only search for "main" as a function Only look for functions in expand_symtabs_for_function Use a function-domain search in inside_main_func Only search types in cp_lookup_rtti_type Only search types in lookup_typename Only search for functions in rust_structop::evaluate_funcall Refine search in cp_search_static_and_baseclasses Document new Python and Guile constants gdb/NEWS | 12 + gdb/ada-exp.y | 13 +- gdb/ada-lang.c | 79 +++-- gdb/ada-lang.h | 6 +- gdb/ada-tasks.c | 17 +- gdb/alpha-mdebug-tdep.c | 2 +- gdb/ax-gdb.c | 5 +- gdb/block.c | 24 +- gdb/block.h | 15 +- gdb/c-exp.y | 19 +- gdb/c-lang.c | 2 +- gdb/c-valprint.c | 2 +- gdb/coffread.c | 5 +- gdb/compile/compile-c-symbols.c | 17 +- gdb/compile/compile-cplus-symbols.c | 15 +- gdb/compile/compile-cplus-types.c | 8 +- gdb/compile/compile-object-load.c | 6 +- gdb/cp-namespace.c | 66 +++-- gdb/cp-support.c | 10 +- gdb/cp-support.h | 8 +- gdb/ctfread.c | 2 +- gdb/d-exp.y | 12 +- gdb/d-lang.c | 2 +- gdb/d-lang.h | 9 +- gdb/d-namespace.c | 24 +- gdb/doc/guile.texi | 13 + gdb/doc/python.texi | 30 +- gdb/dwarf2/ada-imported.c | 2 +- gdb/dwarf2/cooked-index.c | 12 + gdb/dwarf2/cooked-index.h | 46 +-- gdb/dwarf2/index-write.c | 7 +- gdb/dwarf2/loc.c | 2 +- gdb/dwarf2/read-debug-names.c | 128 ++------- gdb/dwarf2/read-gdb-index.c | 37 ++- gdb/dwarf2/read.c | 103 +++++-- gdb/dwarf2/read.h | 2 +- gdb/dwarf2/tag.h | 79 +++++ gdb/eval.c | 5 +- gdb/f-exp.y | 8 +- gdb/f-lang.c | 2 +- gdb/f-lang.h | 2 +- gdb/f-valprint.c | 2 +- gdb/fbsd-tdep.c | 5 +- gdb/frame.c | 9 +- gdb/ft32-tdep.c | 3 +- gdb/gdbtypes.c | 35 ++- gdb/gnu-v3-abi.c | 2 +- gdb/go-exp.y | 9 +- gdb/guile/scm-frame.c | 2 +- gdb/guile/scm-symbol.c | 25 +- gdb/infrun.c | 2 +- gdb/jit.c | 2 +- gdb/language.c | 5 +- gdb/language.h | 4 +- gdb/linespec.c | 67 +++-- gdb/m2-exp.y | 10 +- gdb/mdebugread.c | 6 +- gdb/mi/mi-cmd-stack.c | 5 +- gdb/mi/mi-symbol-cmds.c | 35 +-- gdb/moxie-tdep.c | 3 +- gdb/objc-lang.c | 4 +- gdb/objfiles.h | 7 +- gdb/p-exp.y | 19 +- gdb/p-valprint.c | 2 +- gdb/parse.c | 3 +- gdb/printcmd.c | 2 +- gdb/psymtab.c | 41 +-- gdb/psymtab.h | 5 +- gdb/python/py-frame.c | 3 +- gdb/python/py-objfile.c | 6 +- gdb/python/py-symbol.c | 53 ++-- gdb/python/python.c | 2 +- gdb/quick-symbol.h | 10 +- gdb/rust-lang.c | 7 +- gdb/rust-lang.h | 2 +- gdb/rust-parse.c | 8 +- gdb/source.c | 5 +- gdb/stabsread.c | 8 +- gdb/stack.c | 4 +- gdb/sym-domains.def | 58 ++++ gdb/symfile-debug.c | 26 +- gdb/symfile.c | 9 +- gdb/symfile.h | 2 +- gdb/symmisc.c | 3 +- gdb/symtab.c | 480 +++++++++++++++++-------------- gdb/symtab.h | 177 ++++++------ gdb/testsuite/gdb.ada/info_auto_lang.exp | 4 +- gdb/testsuite/gdb.ada/ptype-o.exp | 2 +- gdb/testsuite/gdb.cp/nsalias.exp | 2 +- gdb/testsuite/gdb.fortran/info-types.exp | 2 +- gdb/valops.c | 14 +- gdb/value.c | 6 +- gdb/xcoffread.c | 9 +- gdb/xstormy16-tdep.c | 3 +- 94 files changed, 1129 insertions(+), 948 deletions(-) --- base-commit: 0d656dfe5b406289faef7f35fb87fb0a00dd64f3 change-id: 20231120-submit-domain-hacks-2-1c1e66b4d560 Best regards,
Comments
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
Tom> v2 note: I was planning to check this in, but re-testing showed some
Tom> regressions. I've fixed them here, basically DW_TAG_entry_point
Tom> caused some problems necessitating a fix in one patch, and a new patch
Tom> to fix a latent bug. I plan to check this in relatively soon.
I re-regression tested this and now I am checking it in.
I'll file a follow-up bug about the double symbol idea for C++.
Tom