From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2065.outbound.protection.outlook.com [40.107.92.65]) by sourceware.org (Postfix) with ESMTPS id 8814B384B831 for ; Thu, 19 May 2022 18:46:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8814B384B831 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fvadFLjivqocshcC6ngXtQJ7cZdpXv7nKt3MNKz4j2g/BHbWA1hkU8qojq2KmloBwOpg0B7YbM2zoGLllmU4/7cSMevT1WtKyf0MA9+vmB5Nd9osFAV+pU+n7aGArEtQ3JW73YRC6FSePugvJ0aNeqxauzxmhi9JH8zNuReisgsaQM7sLfeAJ9Xvu4SMkGLDv7ZPjuNGfQ1XgidMqFJxQfoPsgTPYyteiSr0UdsDPB6DRHKht4Gd8Jra9U4OvsPHdLYeEniKDC37PhFo1vhbSBxgtn6ecjZ14pkcfnttI6B/lWKh0/O2kmsWfTZhyZ1IQ/MtZYr0OgOeWgwH2iVlYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jNk46XFIl88KAVJ9Jyulowe4cZZEa/qRwr0zkulV+68=; b=PWydhdtsT2A7ESA7pqnTv2asNHR8zITfUUjkKye24z4z5WK/SodQWT/I1l0iEeBRN9nq9muaIxMKX0+2ZkyjvNOSdEke7cfYr7m7XsiUYRzLMfVBwbjYDCtepsEHQ/Kn8xmmNUmWuPxd7YNvTlXg6ogVJBwug1cLhmJ/T6fVj3Fjs+LQqP7Wu9O1C/NRFVM2l+r9zDVRIT5hZ9o5z96w42salc2rHxlqSaX3j7/kPHuvABIHYrNDp2TbGiWuseI4VbxJcx1V2fo9bx42ueJJh+nVNpV8pFA/lfmci6B1lgZ7Bk5sEVSzk+w5LJJeunTvUIR4EeMZVjtt+gfwKgHGIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from CO2PR05CA0075.namprd05.prod.outlook.com (2603:10b6:102:2::43) by IA1PR12MB6625.namprd12.prod.outlook.com (2603:10b6:208:3a3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.14; Thu, 19 May 2022 18:46:21 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:102:2:cafe::12) by CO2PR05CA0075.outlook.office365.com (2603:10b6:102:2::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.22 via Frontend Transport; Thu, 19 May 2022 18:46:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5273.14 via Frontend Transport; Thu, 19 May 2022 18:46:20 +0000 Received: from khazad-dum.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 19 May 2022 13:46:19 -0500 From: Lancelot SIX To: CC: , Lancelot SIX Subject: [PATCH v2 0/2] Fix regression with lazy-loading of partial symbols Date: Thu, 19 May 2022 19:45:55 +0100 Message-ID: <20220519184557.2169347-1-lancelot.six@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21804ecd-6e63-467a-406f-08da39c7ddf8 X-MS-TrafficTypeDiagnostic: IA1PR12MB6625:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fNBMhFLyrC1tDWZzTwPce8IjU6ODYok9IXvJVJK3tFlXU1KhsnrvPttUhPJwrC3HAgi4Fume0zYFP9bbeOpgd7GGcnVHDH1ldj7jrRWisy5urIEIXZ5VAc8pI0tEiZuvA1+22SuHvIAMdmNokbU2FIBQKB8iuKYQ3/c8daLfA1apuAZEJKOwzg2MxAYIwMQ7BFDunhrq/yHVRmropJv0EDbCrQMpNBaT2yp9qx9b5//cgqCF6gamGc1zBNJHKSJY4ODnDgDynZh3btmHfNxoxCTuGtcoqs5GNxkMxBede0VjDvk4Ca+VgI7p+AcbYofUHO1ybW5GgVfNdJS3LMONFYfrRAp79rLgYiIls2E3NTSCnspj5KIN2pkCrRBNN2uGMz0psUxyG9uaRfxDva2uhe0TVBT6MRMiYYmvyFy79w3xu305azxFieKlDkA9LjlZqygmegK8LI8NsQf8S8+AO3drM7dlOsWgptfnrZOoq1GOINxza4mSd+cgXn0kLBFnRXLbW/qIHpNutE9MUg7tb1qJQhw07FkzaBduC5O04c2KvVwUFwhs/25uOlh4mBm3RT7F7Y7T8emqtTWttNfQIpEUPkwDAcq5fiYZhF09ohLKKVuCKb5sY3ZdJ0rBn/uD5mzWW48mkVtOZ3it8tcVw17ubT8dIAIyz9O3ieQrNxjCBWgUx/P9ysgKyoi3yjBCHaSscKw8Jftf4/tqAn8QgSTCImz3jFPav86BpqdY7+ujg+BDCTs7H3SeJbzqQlMaKgEpOyYWyQgbnuafcOjsSmeDRs++BSyvqpisVVJdyKc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(86362001)(1076003)(83380400001)(7696005)(5660300002)(426003)(6666004)(47076005)(966005)(26005)(81166007)(8936002)(336012)(2906002)(16526019)(356005)(186003)(40460700003)(54906003)(2616005)(508600001)(70586007)(4326008)(70206006)(36860700001)(6916009)(36756003)(82310400005)(8676002)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 18:46:20.9937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21804ecd-6e63-467a-406f-08da39c7ddf8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6625 X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2022 18:46:26 -0000 This series is a V2 for https://sourceware.org/pipermail/gdb-patches/2022-April/188385.html. Since V1: - Instead of only changing cooked_index_functions::expand_symtabs_matching, change objfile so each call to a method of a quick_function is done after ensuring the partial symbols have been read (the exception being the methods used to actually read partial symbols). - Added patch #2 which does some cleanup in psymbol_functions::require_partial_symbols. - Addressed Pedro's comments regarding the testcase. All feedback are welcome. Best, Lancelot. --- The recent DWARF indexer rewrite introduced a regression when debugging a forking program. Here is a way to reproduce the issue (there might be other ways, but one is enough and this one mimics the situation we encountered). Consider a program which forks, and the child loads a shared library and calls a function in this shared library: if (fork () == 0) { void *solib = dlopen (some_solib, RTLD_NOW); void (*foo) () = dlsym (some_solib, "foo"); foo (); } Suppose that this program is compiled without debug info, but the shared library it loads has debug info enabled. When debugging such program with the following options: - set detach-on-fork off - set follow-fork-mode child we see something like: (gdb) b foo Function "foo" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (foo) pending. (gdb) run Starting program: a.out [Attaching after process 19720 fork to child process 19723] [New inferior 2 (process 19723)] [Switching to process 19723] Thread 2.1 "a.out" hit Breakpoint 1, 0x00007ffff7fc3101 in foo () from .../libfoo.so (gdb) list Fatal signal: Segmentation fault ----- Backtrace ----- [...] --------------------- Lancelot SIX (2): gdb: Require psymtab before calling quick_functions in objfile gdb: Simplify psymbol_functions::require_partial_symbols gdb/objfiles.h | 10 ++++ gdb/psymtab.c | 2 +- gdb/symfile-debug.c | 30 +++++----- ...fork-no-detach-follow-child-dlopen-shlib.c | 23 ++++++++ .../fork-no-detach-follow-child-dlopen.c | 40 +++++++++++++ .../fork-no-detach-follow-child-dlopen.exp | 57 +++++++++++++++++++ 6 files changed, 146 insertions(+), 16 deletions(-) create mode 100644 gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen-shlib.c create mode 100644 gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.c create mode 100644 gdb/testsuite/gdb.base/fork-no-detach-follow-child-dlopen.exp base-commit: c4dd8eb523fae5c9d312f4b7b21377eec66e70c3 -- 2.25.1