From patchwork Mon Jan 4 20:06:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1422239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=hotmail.de Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D8mqY5TyXz9sVk for ; Tue, 5 Jan 2021 07:06:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9BBCB3861000; Mon, 4 Jan 2021 20:06:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071069.outbound.protection.outlook.com [40.92.71.69]) by sourceware.org (Postfix) with ESMTPS id 7CE113854817 for ; Mon, 4 Jan 2021 20:06:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7CE113854817 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bernd.edlinger@hotmail.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QH8jTCdPQPSRd8QGZ5A9VQ3eJ1f1wE7HiBUgN20RR3nKBRN/CeeRerMZ70P3cOJUKs35xwWrFztwa47d/C3AjMVeHX6+Hq3OLTHblhGpVtDzBH5NQHIsKL85UpAho031tgMkzgcQfHbJSatMxZOpg6awNf+HBNxy83xDilMaN49OoWTbhP72lOnVBKfT7ljH2XTfVL3+4Bg6MC9pDm9MrHM6oDHgl3NwPpxVA7qJ+olP8Bha3NMCPAE1D0blZNNXxzR/lD0DXl9oq2/gvMk5KTnqYzTU+OpDpjl7IGyDdBt7U6MDaJdFk3Pb7bnvTIeTzF2WUE8/hq3FjHHAX8EboQ== 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-SenderADCheck; bh=zMVFb6B8zMUehRUkivhEN+VhRI7vLYj77pDIlGnUtW0=; b=b1GhNsvOcDumqZ+y1JyoBdzdRDQqDSanSalClQ+/GY57qDFqVW/LUkcxiAT0Ro0FHO8+ix6to/iiH72Z2CASVPn1r9p90TVxaQHJfEV6waND08DApqb3/oNdzpKR66nK31LahoMvCpK+rDxAhG1Ex2y6J13LjXj69DMTqwpMEOZB9OxIL3/jQKcCanUkeeIb9OdhyMQjO0M9ik1gUm1gB+1V81KAb+mV1+ycsZxBqUkj0RFaoH4Lu+sJXOU38xTKDupT3nKDfkm2+Xi0lfQcZjP0ldsuB2PRPZNv7eL2gjH4ea6T84xlV+CRtFfO6ljjrqSeUZTI2v9HulCMUp6yIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DB5EUR03FT030.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e0a::52) by DB5EUR03HT065.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e0a::437) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21; Mon, 4 Jan 2021 20:06:38 +0000 Received: from AM0PR0602MB3410.eurprd06.prod.outlook.com (2a01:111:e400:7e0a::48) by DB5EUR03FT030.mail.protection.outlook.com (2a01:111:e400:7e0a::144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.21 via Frontend Transport; Mon, 4 Jan 2021 20:06:38 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:50F1C588F77102C80A4F1E6DADA5979C33A1A3FF4CC1CABFD6CB6076F1D3FFA9; UpperCasedChecksum:2BC33BAA6240D5E9C5A5243720AF7B26693F6C22C81F41BA2C130E8CF6BA6F42; SizeAsReceived:7783; Count:44 Received: from AM0PR0602MB3410.eurprd06.prod.outlook.com ([fe80::60c8:86c2:bdaa:f0d2]) by AM0PR0602MB3410.eurprd06.prod.outlook.com ([fe80::60c8:86c2:bdaa:f0d2%3]) with mapi id 15.20.3721.024; Mon, 4 Jan 2021 20:06:38 +0000 From: Bernd Edlinger Subject: [PATCH] Add line debug info for virtual thunks (PR ipa/97937) To: "gcc-patches@gcc.gnu.org" , Richard Biener , Jakub Jelinek , Alexandre Oliva Message-ID: Date: Mon, 4 Jan 2021 21:06:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Content-Language: en-US X-TMN: [dj4IHMjoobLsxaqC3KbKzBMD86HYKj73] X-ClientProxiedBy: AM0PR04CA0004.eurprd04.prod.outlook.com (2603:10a6:208:122::17) To AM0PR0602MB3410.eurprd06.prod.outlook.com (2603:10a6:208:21::24) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (88.68.3.2) by AM0PR04CA0004.eurprd04.prod.outlook.com (2603:10a6:208:122::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.19 via Frontend Transport; Mon, 4 Jan 2021 20:06:36 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 44 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 71d3c811-a618-462c-eec3-08d8b0ec3ea2 X-MS-TrafficTypeDiagnostic: DB5EUR03HT065: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OTQpnLFLkLxHvvmQNrxR7rh208xv2WlCmxMlCcp8hO4Afr8mpJk7sBUbLlCrMeXGDolIovBgn4ehd2+G+OIq2yluGfppu+X4v1agtct0d/UjEAM/7n0dwOr5N8uJqUFL7k5oFt7fSCd6VkT/vqwhJJ82G9aF3HLiID+3Y9DFwpWPSbuhhuCXiLcQ8Lkulcpnp7eo8mYARk1UVmBKmX4NHcF8Grz6Z6OhaJteD9kL8QMy/lPVsdAhvYE8lDpBaoCz X-MS-Exchange-AntiSpam-MessageData: HRQIV1PvU7JNVI/ssTXwQflo8xysTfHI22OMhuHjzd4de+x/uchrVLqaT1bYR/lVUnoMIqvdZJXWyUEXj1U56RvjtJwCjRlmF+NDQjU9E9zb9XR8D4CDcdJVpskFt6u0HPq9ULMTGN3fe4EB2evFDw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2021 20:06:38.2101 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 71d3c811-a618-462c-eec3-08d8b0ec3ea2 X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT030.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT065 X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, FORGED_MUA_MOZILLA, FREEMAIL_FROM, GIT_PATCH_0, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, currently there is a problem when debugging a virtual thunk. That is a decl with DECL_IGNORED_P. Currently the line information displayed in gdb is completely bogus, thus the last line of whatever function is immediately before the PC of the thunk. This patch improves the debug experience at least a bit by emitting at the line number information where the thunk has been defined. I do not dare to touch anything but dwarf2 debug info, therefore the patch is a bit awkward. Bootstrapped and reg-tested on x86_64-pc-linux-gnu. Is it OK for trunk? Thanks Bernd. From 0a44bb870e90623689cae484f8a8899706480876 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Sun, 3 Jan 2021 11:18:39 +0100 Subject: [PATCH] Add line debug info for virtual thunks There is no full debug info since the DECL_IGNORED_P flag is set on virtual thunks. But instead of no line info at all, emit at least the location of the function decl. 2021-01-03 Bernd Edlinger PR ipa/97937 * final.c (final_start_function_1): Always emit function start line information for dwarf2 debug. (final_end_function): Always call end_function for dwarf2 debug. * varasm.c (assemble_start_function): Always call begin_function for dwarf2 debug. --- gcc/final.c | 9 +++++++-- gcc/varasm.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/final.c b/gcc/final.c index fc9a05e..5a274c1 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1735,7 +1735,12 @@ final_start_function_1 (rtx_insn **firstp, FILE *file, int *seen, last_filename); if (!dwarf2_debug_info_emitted_p (current_function_decl)) - dwarf2out_begin_prologue (0, 0, NULL); + { + if (write_symbols == DWARF2_DEBUG) + dwarf2out_begin_prologue (last_linenum, last_columnnum, last_filename); + else + dwarf2out_begin_prologue (0, 0, NULL); + } #ifdef LEAF_REG_REMAP if (crtl->uses_only_leaf_regs) @@ -1879,7 +1884,7 @@ final_end_function (void) { app_disable (); - if (!DECL_IGNORED_P (current_function_decl)) + if (!DECL_IGNORED_P (current_function_decl) || write_symbols == DWARF2_DEBUG) debug_hooks->end_function (high_function_linenum); /* Finally, output the function epilogue: diff --git a/gcc/varasm.c b/gcc/varasm.c index ce5d449..513922d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1930,7 +1930,7 @@ assemble_start_function (tree decl, const char *fnname) ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname); #endif - if (!DECL_IGNORED_P (decl)) + if (!DECL_IGNORED_P (decl) || write_symbols == DWARF2_DEBUG) (*debug_hooks->begin_function) (decl); /* Make function name accessible from other files, if appropriate. */ -- 1.9.1