From patchwork Sun Dec 10 16:44:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 56489 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 97C6D3857B88 for ; Sun, 10 Dec 2023 16:45:30 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id 7AC3C3858419 for ; Sun, 10 Dec 2023 16:45:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AC3C3858419 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 7AC3C3858419 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226706; cv=none; b=mNTL3nQHDiiVBYobfPtjng7Fgn6VBPU6BEL9tvUlKiQfOuGAQBqhtTejxV+8qq+ao6xH2+i60+v2gNw+npX7bD9MTVmOQQptNueSrLryVn9rVTgl+4lxrq5dHMO19ZthHke8OjyPoaQs4pv2+Opk6gd0u80gn6mClNKknt90o+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702226706; c=relaxed/simple; bh=R2ELIcXEpRaQ598/x7ETorymw0y6ZGqFKuzwLWSMRI8=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=WBSZEI7akEMwNDV6ii9ofPLeYUNzHkXkIzy/nNIgWqSSOuK8Mzy1QTCuY2ZZpYCMXBgf3+Ja6gxq8qvwKICVUzBclLLeK9lg7iSAkH/IPVT+5qtFuksTT2yqF7xVGHE55LhP7UfkF2GS9goFtlwQ4nQyAAH1Vsmc/VbBSNCJ18Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id CHbar4Wx38HteCMvOr8cpX; Sun, 10 Dec 2023 16:45:02 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CMvNrCeA2RGmSCMvOrq9VN; Sun, 10 Dec 2023 16:45:02 +0000 X-Authority-Analysis: v=2.4 cv=efcuwpIH c=1 sm=1 tr=0 ts=6575eb0e 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=zstS-IiYAAAA:8 a=bj5jkYoiUDR1MO9J_4UA:9 a=QEXdDO2ut3YA:10 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-Id:Date:Subject:From:Sender:Reply-To:Cc: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=YCDPfKkFdeqnYjcyXC1UmP8C4BWx/DE7OOuncm3Dhys=; b=oYPSpS6ILy35djzAOi0Wek9DMN x4nT1mU7Bj2Wm/7BdsNYQXzah2PdECBTSh1r3hDGQZdJPhOUT20EE+XFqn2vXfArB3n9AzvuSb47O cPsHMoOoCl1YIJrqcW2YsgNkU; 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 1rCMvN-001rpu-25 for gdb-patches@sourceware.org; Sun, 10 Dec 2023 09:45:01 -0700 From: Tom Tromey Subject: [PATCH 00/17] Rewrite .debug_names reader and writer Date: Sun, 10 Dec 2023 09:44:49 -0700 Message-Id: <20231210-debug-names-fix-v1-0-a8f6d2525018@tromey.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAALrdWUC/x3MSw7CMAxF0a1UHmPRpBIgtoIYOI6TekBANj+p6 t4bGJ4nvbuAi6k4nIcFTN7qem8dYTcAz9SqoOZuiGOcQgwjZkmvio1u4lj0i1wSldPxEIQZ+ut h0ud/8XLtTuSCyajx/Os896li/pAVNKGsrcK6brqiE4uGAAAA 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: 1rCMvN-001rpu-25 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: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCUzmiBoEmfTGhi9lYuy/zGt7HPAn7xiPWlb0/aBEyVNNIOz9L0PUDTGstjHc25KcUEflEYoCG4e1jZZQPstMMqx2gWI1VJFSU5QuCcIowGVB0kIEcJi cnI45ckG8G4MriEj9CYjUB1eRdZGVgRA1eR07nd3Nmfjngo5El86jDJdhs0oB/DEo7OEMek2Mts5YcRcvEWFfz4CSJSZ7bNYrNM= X-Spam-Status: No, score=-3018.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This series rewrites gdb's .debug_names reader and writer. Currently, gdb can generate a .debug_names index, but the contents are very wrong -- they use fully-qualified names, which is not at all what is envisioned in the DWARF spec. After this series, the section contents will be much closer to DWARF. However, it's not really useful for gdb to follow DWARF exactly. First, the DWARF spec has a few bugs affecting the generation of the index. GDB fixes these -- you won't see these fixes in this series, though, as they were all handled by the new DWARF scanner. Second, gdb likes to have some information not readily available in the DWARF-specified contents. You can see the new DW_IDX_* constants patch for a list. I've regression tested this using cc-with-debug-names on x86-64 Fedora 38. It's possible that there are regressions with cc-with-debug-names at some intermediate points in the series -- in particular I think it would happen after the reader is rewritten but before the writer patch is applied. I didn't test this situation, since I don't think it is very important. It could be worked around by combining the two patches, but I thought that would make review much more difficult. This is based on my earlier series to read DWARF in the background. This was done because (1) that's going to land eventually anyway and (2) that series generalizes the cooked index code somewhat, making it a nicer starting point. --- Tom Tromey (17): Refactor 'maint set dwarf synchronous' handling Refactor quick-function installation in DWARF reader Remove IS_ENUM_CLASS from cooked_index_flag Add some new DW_IDX_* values Document GDB extensions to DWARF .debug_names Add language to cooked_index_entry Move cooked_index_functions to cooked-index.h Do not write the index cache from an index Change cooked_index_worker to abstract base class Remove cooked_index_worker::start_reading Empty hash table fix in .debug_names reader Fix dw2-zero-range.exp when an index is in use Explicitly expand CUs in dw2-inline-with-lexical-scope.exp Remove some .debug_names tests Rewrite .debug_names reader Export dwarf5_augmentation Rewrite .debug_names writer gdb/doc/gdb.texinfo | 39 + gdb/dwarf2/cooked-index.c | 162 +++- gdb/dwarf2/cooked-index.h | 184 +++- gdb/dwarf2/index-write.c | 401 ++++----- gdb/dwarf2/mapped-index.h | 4 +- gdb/dwarf2/read-debug-names.c | 949 ++++++++------------- gdb/dwarf2/read-debug-names.h | 2 + gdb/dwarf2/read.c | 337 ++------ gdb/testsuite/gdb.dwarf2/clang-debug-names-2-foo.c | 22 - gdb/testsuite/gdb.dwarf2/clang-debug-names-2.c | 27 - gdb/testsuite/gdb.dwarf2/clang-debug-names-2.exp | 42 - gdb/testsuite/gdb.dwarf2/clang-debug-names.c | 25 - gdb/testsuite/gdb.dwarf2/clang-debug-names.exp | 42 - gdb/testsuite/gdb.dwarf2/clang-debug-names.exp.tcl | 121 --- .../gdb.dwarf2/dw2-inline-with-lexical-scope.exp | 4 + gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 10 +- include/dwarf2.def | 9 + 17 files changed, 948 insertions(+), 1432 deletions(-) --- base-commit: 98eea77e9ce69ba00d5f93dd2264f1d1971fd86f change-id: 20231210-debug-names-fix-cfbaf8761ecc Best regards,