Message ID | AS8P193MB12855E0F9D40695E201381F8E4DF2@AS8P193MB1285.EURP193.PROD.OUTLOOK.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 24861382E82D for <patchwork@sourceware.org>; Fri, 5 Jul 2024 09:16:28 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2036.outbound.protection.outlook.com [40.92.89.36]) by sourceware.org (Postfix) with ESMTPS id F108F384403E for <gdb-patches@sourceware.org>; Fri, 5 Jul 2024 09:15:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F108F384403E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F108F384403E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.92.89.36 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1720170962; cv=pass; b=kOhVyGEodk+iJ7I+6Vs5ZgLusukPxsp54akbEJXzqbR+ZWJB5lUZnJ6Xh6Yeg04FR/a2oclHsMgCHV2Z+P8wzfGB6Mljb44+yqXk+FcszY7uD+DF/vuEQOOPC6R+Ep/JdXCZTT50UXrVSurKkzw/KwvpoEukt6e0QhLEQGXztSw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1720170962; c=relaxed/simple; bh=e9gd7IG4tkSA4KAz8rHgPfMwoxN5S/Rys6t46Bk4KLk=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=Wwyoh4yrNwApvDWAFBX9V8m0UGX5P5JMyqUQNSXS055eYshyfttNCW+XXL8rW3eutp5mtRa5pugVOggJ86Iybc4Tb8thf13YGleU+cF9GZKydzMoJyXGywQB0B3/HW2nRtCfDNClADlwbheC5C4uzbCC4lQ0qob12fYHzBS8fx4= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1u7TZT6ihU4RxF9YqWhXGTbTpcQk2VxZLjiirFHdZOV2DiIv9MNaB4K18kO2a1Vj3ecBwFNSjT+CPSrtXl2LGEXP4ld4mwU7OBRPnYFnAmJoEIXWLjgnl6wwFKmmqylf4mA8roo083bgIfSx+m7CwKgBLXIrBuvdJ44p8/5t1jxww1cqwZIUXtrr9uXHL8CSlwSEhXsAtAIU5JqG6KYTls1QkvUaqYtpGIyt4n1aREtJdhEIc/xQmAgG5LXbKDjXymQyoFTeW1gk48eE95PuvmdBT5pkH27uOtQDM0b3MQ1lWh9rpdRcIhaNDpKUnBDduRaMRmvhigqn/g62uIOmg== 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=I8vzI97dBSJkbKeJOedPc1+m7bXTL3/Zkl2+70NYURA=; b=IobvbM4osqkiBoGR0fAYjm2/ZQ20C1KQVRpHRmG2/LLAKEmTxtNCIVrLHCq1LtGEYF9re9ujaDb1Zw7AE1VNaKM5GyebULEK3G2nEIdggExTA6wmhfz0QsCyDgpoIyaLy102afp+FZAcePwe348mDj9glwQqmJUqEHiEjwdC0hSaxg4x26NORulhw9XlgV73RdT2pa0sYj8ah/zcEU6KfyKMi6LBvmejeXhXg2kEC+Bg8zcz05hvHJknyGI4rBk7qJGRbe61YyVh+Xena436nBPbg8bdKtHuHAls/FH140wAVPrw2RiR+hKtaQLFxldg/W1OoU8jwQ97ac2oCxpZgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=HOTMAIL.DE; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I8vzI97dBSJkbKeJOedPc1+m7bXTL3/Zkl2+70NYURA=; b=nt3SSa7iuuJgOHCNe74fhNJrAZnFrsqY5iBMbIvyeyydgkocgCzVGcS/fnFfl7RyrRaU/aboAmOqKTsv+J/JwAU4pekPSVsoHG1sSyWqoLYgcXJDpbpdH+TaegFUAcp9zhzkv6qStC3YQW94I/zyLN2fI5xsmFpcgvVGXePauLW5fQFmwJMFoWgw8DF2S3SPq9j2KLUxXpPqIMe0VKljsZIscQiOVDbLrjxQH7a+aYHB2Bj2FpUfnUYzakkdhFarRdYMjD0wPgjUsSeoU0C0t9cPeQ8Jn/ThhN6sX5mWVLqu7ORiCMtKqFS4KVl3HZ1okf1zeucNu7GbDhRdi487yQ== Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) by GV1P193MB2344.EURP193.PROD.OUTLOOK.COM (2603:10a6:150:2c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.29; Fri, 5 Jul 2024 09:15:47 +0000 Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::e65d:5dd2:5662:c61f]) by AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::e65d:5dd2:5662:c61f%6]) with mapi id 15.20.7741.029; Fri, 5 Jul 2024 09:15:46 +0000 Message-ID: <AS8P193MB12855E0F9D40695E201381F8E4DF2@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM> Date: Fri, 5 Jul 2024 11:15:18 +0200 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org> From: Bernd Edlinger <bernd.edlinger@hotmail.de> Subject: [PATCH v3 0/3] Improve debugging of optimized code Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TMN: [+3YwY+sG2TIaJJdo83l9szgYXkP857tA8+SFxjyML7mtsXCmutMjcGPiMQMzv2mk] X-ClientProxiedBy: FR5P281CA0034.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f3::13) To AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) X-Microsoft-Original-Message-ID: <d253a16a-0663-4510-ae3d-9a0326794785@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P193MB1285:EE_|GV1P193MB2344:EE_ X-MS-Office365-Filtering-Correlation-Id: 175dad42-4b34-43ab-d07a-08dc9cd30dbf X-Microsoft-Antispam: BCL:0; ARA:14566002|19110799003|8060799006|461199028|1602099012|3412199025|4302099013|440099028; X-Microsoft-Antispam-Message-Info: yQJ6Ay8x9grm4fqzaU1Aru8mT3EUV2q206Bcxdk8RXGGTqs8U2lhMWfQP5Ixjm81gq+/r16VqVXCNxEV0fr43BC34ouDnsD2EGh01QXt7qAumwRyPdXJNm8yfir7T+YSVBKQLcwZvCBTb58TTV66wo6oSOapgqljzc/FBFi9EcpqiD4uJpDMe+7vQJxCPLMye1HodKARzyxlW2gSl0A3MzP8WPNHrfjedG9s1nD6OBvZltOMzqnaUrCN8Dg2ANARNltqFQdBDBsULakHYVJsPF7Di/m2wnuOBj9Iw72+sgXM0nyrJTksZgA2jD5vzVV73aCMgENdNLGWbT8i+lHWFd4P+MBG7hlWYRJ06oZqEJ+fGUuoRmGwyhj3lK945Xbno37CtjAXijlqjOPit4kV6cBlvkYwt42tYvlXuX4Pndi8071uwUbq0p4uF4btKl7K5Z1GReej/RuZcKz3QBruM5QYLmE3shLpbmiPhF6uCq7/GupUVhXWBVctlzjr1HTbrwUy6XCXd/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05oazItb34qWKrMbQ+GX9y9cd6Mu9SEN39oaOrm?= =?utf-8?q?EwSe5aGppfPM4BA2wFI6QEcFZxDRIYeEtsDjj7AxDha672H4fo+sbKkKh8kq1+/M/?= =?utf-8?q?7NWD3LdJ2zfgsAYPCNojg2qEThYUNJ5tYRk1Nc00q4PA38/+l8NlOpL79hYaQoA6U?= =?utf-8?q?f/v8bnwY8is3FOPOGL9B0fg91NS4lHrIO2Ot1zvXsxbQGNHv/3xvLanlMAj5yBT8R?= =?utf-8?q?Ab6sLCpMLGUQNJGUEBThP6sAuWaJCDUWcbpKUJPa28NHDqpZuxoQH+wQarWNXeRBT?= =?utf-8?q?5EZo0Mh/i92h3dVH0VZzCfC/FB8UOoWZoONuXP9BUuIq05D9SZfqERd8LikBWhMvc?= =?utf-8?q?UIzByoDkvsmC425vC0ebW5aBocig4iZF45GoqdQ97++GZrz77TT7RWjEw7qzqn3F8?= =?utf-8?q?BmuY9bl4ZWQxRfUjM4JCDMAwynB8CK6TMh3mewVIALH1CavqKRsSHWAXlo31ahSMf?= =?utf-8?q?Kyak2oOElyc9eJxZTOHrH22zUzzlInOuPeb7Oic8ncT4H9FG4ePIPle7H17TiulRX?= =?utf-8?q?q24ZR+5WgHYY8xYLXKkaHOdIFquRwCXEfTQfs3wyawj4rPbFEoCchecDbCrIMaQWE?= =?utf-8?q?PlAWfKN9g28lNCK/mo5CvmyVeBlk8DSJkYJZeqFTOkHUx8WLSdiFQAKDklMC54lvn?= =?utf-8?q?FnPnic+fDNSjF6P8?= X-OriginatorOrg: sct-15-20-7741-18-msonline-outlook-01732.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 175dad42-4b34-43ab-d07a-08dc9cd30dbf X-MS-Exchange-CrossTenant-AuthSource: AS8P193MB1285.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 09:15:46.4454 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1P193MB2344 X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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.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 |
Improve debugging of optimized code
|
|
Message
Bernd Edlinger
July 5, 2024, 9:15 a.m. UTC
I've rebased and re-tested the following patches which are trying to improve the debug experience of optimized gcc code. This work was previously posted quite some time ago here: https://sourceware.org/pipermail/gdb-patches/2021-January/175617.html These patches improve the debug experience with optimized gcc code significantly, as can be seen by the test cases. The problem is that there are cases where an inline function has line table entries at the end of the inline subrange, and it is unclear by the dwarf-5 debug info if these line table entries belong to the called inline function or to the calling outer function, while there are at least some corner cases where by stepping into these lines e.g. the return value might be inspected. Also the call stack is often displayed wrong because the line table entries do not match with the block structure i.e. are obviously not in the correct function. Therefore this patch series tries to improve the issue by introducing a heuristic, that marks some of the line table entries that happen to be at the exact end of an inline function range as weak. This new line table flag can be used to avoid to step into the inline function when a step over was requested, and display the line belonging to the correct function in the callstack. I'm sorry, that this solution has quite some complexity, but I promise it is worth it. Please give this patch a try and look for yourself how the debug experience is improved in the test cases, and certainly also a number of other programs, especially with C++, where inline functions are pretty much used everywhere. v3: minor update to fix regressions in gdb.cp/empty-inline.exp This update fixes only one test case, that turned out, not to work properly with arm and aarch64 targets (many thanks to Linaro for reporting this to me). The reason was that the call stack looks slightly different when the trap is on a statement boundary or not. So the test expectation was changed to ignore that bit. Additionally the test case was failing on riscv simulator targets because assignment to NULL is not enough to cause an exception on a simulator. However assigning to (char*)-1 triggers always an exception. Bernd Edlinger (3): Fix handling of DW_AT_entry_pc of inlined subroutines Introduce a new line table flag is_weak Fix range end handling of inlined subroutines gdb/block.c | 15 +- gdb/buildsym.c | 106 ++++++++-- gdb/buildsym.h | 3 + gdb/dwarf2/read.c | 89 +++----- gdb/infcmd.c | 3 +- gdb/infrun.c | 30 ++- gdb/jit.c | 1 + gdb/symmisc.c | 6 +- gdb/symtab.c | 17 +- gdb/symtab.h | 5 + gdb/testsuite/gdb.base/empty-inline.c | 39 ++++ gdb/testsuite/gdb.base/empty-inline.exp | 56 +++++ gdb/testsuite/gdb.cp/empty-inline.cc | 33 +++ gdb/testsuite/gdb.cp/empty-inline.exp | 50 +++++ gdb/testsuite/gdb.cp/step-and-next-inline.cc | 6 +- gdb/testsuite/gdb.cp/step-and-next-inline.exp | 194 +++++++----------- gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp | 2 +- gdb/xcoffread.c | 1 + 18 files changed, 443 insertions(+), 213 deletions(-) create mode 100644 gdb/testsuite/gdb.base/empty-inline.c create mode 100644 gdb/testsuite/gdb.base/empty-inline.exp create mode 100644 gdb/testsuite/gdb.cp/empty-inline.cc create mode 100644 gdb/testsuite/gdb.cp/empty-inline.exp