From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id 2B7D5385843E for ; Sun, 10 Dec 2023 21:41:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B7D5385843E 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 2B7D5385843E 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=1702244486; cv=none; b=hyhXTrWYpe6zQWsvqw6llzJyxVCiZ8F7QoBXhv+HFu/Cc48iyGMpYpOsBK1QyiouZrTcM1mCbMbOtfzlQQqPUNYcCgh/15k+tLYgmGPfC6A3dR1jAEYxnkRg1waQB835nb4r2UiN/DkDFSNN1mse8NdyuWe1g4qqL+Sz3BH9ldA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702244486; c=relaxed/simple; bh=Y+BogermrI9b8cg8oRVku5xtmQZcmg9qko53x9lBF5w=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=WvS6dMxDJ9ITz5PsDBs4QMs7gzxJcGqvTSybr4MTyXOqIqBnmVff92Yt15dmcSYnWiyuuwpamPKSRooFDFgwuukPg3q4kVJqN72aQ5Nn4TaFSKCQDNUNkYInWQuU63Yn/UdvJzjfNzkHy9zx3V7/Tgxy3cQ3GWw5dTwhwzxWnHs= 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 ByoJr29VY8HteCRY8r9Z7L; Sun, 10 Dec 2023 21:41:21 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CRY7rRQWT11XZCRY8rb2h4; Sun, 10 Dec 2023 21:41:20 +0000 X-Authority-Analysis: v=2.4 cv=Z+v/oVdA c=1 sm=1 tr=0 ts=65763080 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=CCpqsmhAAAAA:8 a=zstS-IiYAAAA:8 a=irj9ATl461M08Dsboi8A: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=HAil2JoJnWq1aGFTLUN2FoQMYe9Jq+hRO+5BtUjju3M=; b=NEhv8N5nf8hm8cq321TYO8MrTJ MwMZzezgBT+hkUQYkUNUn4jwo2PN0r73pz/j9inxCBKehmGDHOHgzHRrkdhorxceNpJlXv3+oc6BZ 3LX2onzKe6aF50o8huupBO1GM; Received: from [198.59.47.65] (port=52450 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 1rCRY7-000SHj-18; Sun, 10 Dec 2023 14:41:19 -0700 From: Tom Tromey Subject: [PATCH v4 00/19] Index DWARF in the background Date: Sun, 10 Dec 2023 14:41:08 -0700 Message-Id: <20231210-t-bg-dwarf-reading-v4-0-b978c32fd12f@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAHUwdmUC/3XOQW7CMBAF0KsgrztoxhMIdMU9UBe2M068SFzZV gCh3L0OXRTUdvmlP+/PXWVJQbJ639xVkjnkEKcamreNcoOZeoHQ1aw0aiYiDQVsD93FJA9JTBe mHhDtfucNMVpW9fAziQ/XB3r+qNmaLGCTmdywUqPJRdJaHEIuMd0e4zOt9e8d1Edq+cDHbdPSj hogKHE8lRRHuW1dHNXKzvrn4p/PZg0ILXpLLSJpa34Z/GTovw2uhndMB+xkz655MZZl+QLcgxX dRAEAAA== To: gdb-patches@sourceware.org Cc: Eli Zaretskii 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: 1rCRY7-000SHj-18 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.131.83]) [198.59.47.65]:52450 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfJB0UDU4Lvh2v1BfpRCJbowNeZTnzvbQawVA1BKy/EB+t6eFvjFfFhkDBgPCA/gXGs0AMjpX17PQLt5InAJJSTT+g6dEjbSZdvvg1UV0ElxWNveI7XdG ffGd7DDAX6OS/nYoDXcljPUb9Ez7vr/wV0XkmWb1/wrlOJfzGQ/t53s/M3cruLV0SJA7DZsV0Vkg1Hkwkk0jPO9o7zDfv6whQWo= X-Spam-Status: No, score=-3018.2 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 List-Id: This series changes gdb to do its initial DWARF indexing in the background. This process is mostly asynchronous with respect to the rest of gdb. That is, rather than pre-emptively waiting for scanning to complete, now gdb's main thread will only wait when some result of the scan is required. This drastically improves gdb's apparent startup time in the "normal" case where a user does "gdb some-executable" -- e.g., for starting gdb on itself, the time until the prompt returns goes from ~1.2 seconds to ~0.06 seconds on my machine. This approach works by hiding most of the work from the user. Waiting can still be needed; for example if one starts gdb and immediately sets a breakpoint -- however, because the indexer is reasonably fast, and human reaction times are slow, this series still manages to be fairly successful. My current belief is that doing any better than this will probably require a new debug format that isn't quite so cursed to read. I regression tested this on x86-64 Fedora 38. I've also built it with TSAN and tested that, though TSAN seems to introduce random timeouts into the testsuite when I use "make -j8 check". --- Changes in v4: - Added deferred_warnings patch - Link to v3: https://inbox.sourceware.org/gdb-patches/20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@tromey.com Changes in v3: - Rebase on top of the C++17 changes - Apply Tom de Vries' bug fix - Fix a "save gdb-index" bug found by Alexandra - Link to v2: https://inbox.sourceware.org/gdb-patches/20231112-t-bg-dwarf-reading-v2-0-70fb170012ba@tromey.com Changes in v2: - Updated to final style of BFD locking - Added a thread safety fix for DWO - Added a patch to pre-read DWZ sections - Added calls to bfd_thread_cleanup and bfd_cache_close - Link to v1: https://inbox.sourceware.org/gdb-patches/20231029173839.471514-1-tom@tromey.com --- Tom Tromey (19): Don't use objfile::intern in DWO code Pre-read DWZ section data Add a couple of bfd_cache_close calls Add thread-safety to gdb's BFD wrappers Refactor complaint thread-safety approach Add deferred_warnings parameter to read_addrmap_from_aranges Add quick_symbol_functions::compute_main_name Add gdb::task_group Move cooked_index_storage to cooked-index.h Add "maint set dwarf synchronous" Change how cooked index waits for threads Do more DWARF reading in the background Simplify the public DWARF API Remove two quick_symbol_functions methods Change current_language to be a macro Lazy language setting Optimize lookup_minimal_symbol_text Avoid language-based lookups in startup path Back out some parallel_for_each features gdb/NEWS | 4 + gdb/breakpoint.c | 4 +- gdb/coffread.c | 6 +- gdb/complaints.c | 24 +- gdb/complaints.h | 37 +- gdb/defs.h | 2 +- gdb/doc/gdb.texinfo | 18 + gdb/dwarf2/aranges.c | 77 +-- gdb/dwarf2/aranges.h | 3 +- gdb/dwarf2/cooked-index.c | 201 ++++--- gdb/dwarf2/cooked-index.h | 322 ++++++++-- gdb/dwarf2/dwz.c | 90 ++- gdb/dwarf2/dwz.h | 13 +- gdb/dwarf2/macro.c | 2 - gdb/dwarf2/public.h | 18 +- gdb/dwarf2/read-debug-names.c | 8 +- gdb/dwarf2/read.c | 733 +++++++++++++---------- gdb/dwarf2/read.h | 5 +- gdb/elfread.c | 6 +- gdb/gdb_bfd.c | 58 ++ gdb/gdb_bfd.h | 5 + gdb/gdbthread.h | 3 +- gdb/jit.c | 4 +- gdb/language.c | 51 +- gdb/language.h | 34 +- gdb/machoread.c | 11 +- gdb/main.c | 3 +- gdb/minsyms.c | 69 ++- gdb/objfile-flags.h | 4 - gdb/objfiles.h | 17 +- gdb/psymtab.c | 1 - gdb/quick-symbol.h | 17 +- gdb/symfile-debug.c | 75 +-- gdb/symfile.c | 22 +- gdb/symtab.c | 2 + gdb/testsuite/gdb.dwarf2/dw2-error.exp | 1 + gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp | 2 + gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp | 2 + gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 2 + gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 4 +- gdb/testsuite/gdb.dwarf2/fission-reread.exp | 5 +- gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp | 1 + gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp | 10 +- gdb/thread.c | 8 +- gdb/top.c | 2 +- gdb/unittests/parallel-for-selftests.c | 47 -- gdb/utils.h | 16 +- gdb/xcoffread.c | 3 +- gdbsupport/Makefile.am | 1 + gdbsupport/Makefile.in | 6 +- gdbsupport/parallel-for.h | 234 +------- gdbsupport/task-group.cc | 97 +++ gdbsupport/task-group.h | 64 ++ 53 files changed, 1480 insertions(+), 974 deletions(-) --- base-commit: eef4ff9b707d738322a5dca82a6a9b0aad76a26e change-id: 20231112-t-bg-dwarf-reading-00b65fa130b3 Best regards, -- Tom Tromey