From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) by sourceware.org (Postfix) with ESMTPS id 23C663888C6B for ; Fri, 18 Mar 2022 14:28:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 23C663888C6B ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EXurTEFGLooySAWS9FOx9uELnp5Z+jmVlnxFsGP0AcWRz4/QcMZQEWZNY9YhoWk/BJm70a0/ozu1XgM1f5lwxkuaRtKD04144nCPV6XFpqjlGukUiSIVBaV5oZQ2UJ9c48qQOYxuzKKb+sDhvhOv85WOj1hMfXULZr0pB3zSzdJO5ZlfX4lUkdvaU9yToG0fe5ETaxlzDw1j1YDQHDQ4RI6mjHKVwKQtnyDI+V64evaQWfb2wBGte8r5hywVFHxLPiotvRnybmDYAKFuK7iIZQUSJpW+LW4GHz7vDQNbwFreaTuk7+QCeiqMZTiYCLE+0cJ9vrZ28fdmEzByeHpD9w== 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=BqmLNoNa1B+tqa4U6kMIvMNCLwlAl69U3s4Ls++tTbs=; b=hwnr/PgCCbi4XYF5gsPVx1CFmRJc2yGqtAEcA3F++OSUIDh9R57pHenOIslgpfi9C6D3GX11RORcMHwbSH49u0d7+5gINa2H+bwAr0980bvDQxbsSjgsup0hFegXJovKSM7u/0kGq813tGcJVTM2CabEgqN0J4rL039tf+CW0mqSERLJ2Aa6LMu2dNlHNd6CjJ9ZzKk5nmEGZT6DmrB9ZfYtJ+EjM5Cjv06Y4Etk5A/zMNSky2z97kqqFxkKACGw9RZTmEKG2IdjyqSfJUSbPPWV6oIgf8ldjX6HH/ItMy8ppapTh+pxyNYx9LxRE/rcCWnrkcYMppIUXWPDgZ/vJw== 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 DS7PR03CA0131.namprd03.prod.outlook.com (2603:10b6:5:3b4::16) by CH2PR12MB3910.namprd12.prod.outlook.com (2603:10b6:610:28::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Fri, 18 Mar 2022 14:28:34 +0000 Received: from DM6NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::8e) by DS7PR03CA0131.outlook.office365.com (2603:10b6:5:3b4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.23 via Frontend Transport; Fri, 18 Mar 2022 14:28:34 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT025.mail.protection.outlook.com (10.13.172.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5081.14 via Frontend Transport; Fri, 18 Mar 2022 14:28:34 +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; Fri, 18 Mar 2022 09:28:33 -0500 From: Lancelot SIX To: CC: , Lancelot SIX Subject: [PATCH 0/2] Add support for DWARF's prologue_end flag in line-table Date: Fri, 18 Mar 2022 14:27:31 +0000 Message-ID: <20220318142733.1097657-1-lancelot.six@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 351a3fdd-fcd3-44db-e681-08da08eb95a0 X-MS-TrafficTypeDiagnostic: CH2PR12MB3910: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: DxoT41o9I2uPSjrfMeoMjtjqlI+MpPW5i6ECcHjKTA4In3/T/fDmAw8QUo4nFqfctcjSvk/PNtAwhch7SpcetE08CVqJe6YkwUxK5UO/qXuI3Pi1NpHG2AOMefk9NSPdERBb6MGEwdqHXkMLe+p4f3HQb3FPjc6HyR8xWEn77C0LN6cUfkcYBhUAzzpzZrxneSfB6I58vivLoszS13AwWOqip9jQ9DjF7851RmjUPqDZqN9vplvBa9glee18B/YJ1R/XKiXoqGFBPemekrDfXLtUbLlR5uyH0YiNgHYwUM15JVFR+M4GJpI8yY7bBSFon+xCRQzdJYQhvuR+gwF+EqjgJVQOBfurEPg+sMKwyzKgzesge6jLBuZ+/QHTcCZSarpEoCWliP05c3pZtBUk86+IQ82r2Z/2Fz/BnYGgQ8yU4naVwIrx3SMFQafoZMuwWo3uHraguSBhnBiJw+JbW+NHd/cuNK3bj1K8aWX7PoYEEwdbKrPfXNvp/XQH1tDiS0sMMT4cflJHQC6Q9mfeVqckOe7mn9ZHZqTeGOfEr1cDfvkW4IfeCikKrkbemh/yrVx9tOQAkSUmT6OP3TIWSlP3cdw5tuUmTBMAcxaZABF1NB78TJW7PxAtSOqykzICPE07O3WYKgw/T+PEQ5duAn2ba9yIzRr2ACNjsD0ae23QekmjKuCas6tQ7n11K77CTHdxVi/QMN8KNVLxQxa+Lw== 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)(36840700001)(40470700004)(47076005)(83380400001)(1076003)(186003)(16526019)(40460700003)(26005)(36756003)(2616005)(7696005)(81166007)(8936002)(6916009)(54906003)(356005)(508600001)(8676002)(4326008)(70586007)(426003)(336012)(70206006)(36860700001)(86362001)(5660300002)(316002)(82310400004)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2022 14:28:34.6095 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 351a3fdd-fcd3-44db-e681-08da08eb95a0 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: DM6NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3910 X-Spam-Status: No, score=-5.3 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 18 Mar 2022 14:28:40 -0000 Hi, I came across a situation where GDB would fail to properly report a breakpoint hit. Lets consider the following simplified example: void foo () { inlined_function (); } In this situation, the user did place a breakpoint in foo ("break foo"), but when the breakpoint was hit GDB reported the stop to be in inlined_function. In the debug information, the foo and inlined_functions have the same low_pc, but GDB places the breakpoint at a PC higher than that $low_pc. Therefore, when the breakpoint is hit, the effective PC seems to be inside inlined_function. GDB reports that the stop happened in the inlined function which is not what the user expects. The underlying issue is of course that the breakpoint is placed at the wrong PC. This comes down to an invalid detection of the end of the prologue of the foo function, which is what this small series fixes. The program I am interested in is compiled by a LLVM based compiler, which includes prologue_end markers in the line table information. Those markers (introduced in DWARF-3) indicate where breakpoints should be placed to be at the first instruction past the prologue of a function. Currently, GDB does not process this information. This series proposes to implement support for the DWARF prologue_end flags. The first patch in the series does some minor refactoring, and the second patch adds support for the prologue_end flags. As (as far as I can tell) GCC does not emit those flags, this series has no effect to debug code produced by this compiler. The series have been regression tested on upuntu-20.04 x86_64-linux using: - make check - make check RUNTESTFLAGS="CC_FOR_TARGET=clang CXX_FOR_TARGET=clang++" All feedbacks are welcome, Best, Lancelot. Lancelot SIX (2): gdb/buildsym: Line record use a record flag gdb: Add support for DW_LNS_set_prologue_end in line-table gdb/NEWS | 4 + gdb/buildsym-legacy.c | 2 +- gdb/buildsym.c | 5 +- gdb/buildsym.h | 12 ++- gdb/doc/gdb.texinfo | 27 ++++++ gdb/dwarf2/read.c | 52 +++++++---- gdb/symmisc.c | 6 +- gdb/symtab.c | 51 +++++++++++ gdb/symtab.h | 4 + .../dw2-out-of-range-end-of-seq.exp | 4 +- gdb/testsuite/gdb.dwarf2/dw2-prologue-end.c | 28 ++++++ gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp | 91 +++++++++++++++++++ gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp | 2 +- gdb/testsuite/lib/dwarf.exp | 16 ++-- 14 files changed, 273 insertions(+), 31 deletions(-) create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-prologue-end.c create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp base-commit: c4d0963383ad8ca0f0bf63c857b9462efdacff7c -- 2.25.1