From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR06-AM7-obe.outbound.protection.outlook.com (mail-am7eur06olkn2016.outbound.protection.outlook.com [40.92.16.16]) by sourceware.org (Postfix) with ESMTPS id 2F050397B83F for ; Mon, 26 Jul 2021 16:45:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F050397B83F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ElATkmqxDoxfqLKnZEkPy6JqKCtm+t0MBPrr04HUOPQk/RdLCQD6Lw4cnhIfcuJ7pu1GWG3Iv8uTv3c0522ATwR391ATsLjkAIu0u247Cu5QXq88icyEagRwa/nfrEsji/VpGMWF3iNiI8g/pXIg0PBq8TreprZ/vV6ewg7erGowqV3qjYAPPhp8H771uDDrqc/c+YpITGnxNqYgp4yjt5jfQ2Yw96vw/ksoMrlUB/yWC5gKKbwVN20gCiWU371+1iVi1YYel8FzY0hd8P4l5ADf2YmFn2FH4LzXy+boMvGfcFWjR5il0EjifQIJhM96fY5i3piGtGNBpKXlrAYEuw== 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=eCa3xT7cOtfkaWRFGEySLRnGZPN583qUxaVzC6FCWOs=; b=FanWSq6DuYdXmqu6t8mHw+OdyKzFYANj5oRjlMH7VwIjiuOYMyRRRgQhkkGXAg5RLnl7zcaAnp/+Hw/AQOyA8yA6Gbf8KyCys2LWs+g9H5kWRdOe+/UIFfaR4P4YHHam6665qTyfplEhOKdiHI5ti/TyWlhFyhgQWZQtbkeQIygaNcAEWV3D1KCRsv98qBk5PnexX/g6+um916oIf612LVeX3ID1O8uthIqZuxVD1PDn/CeK0NdQkcdVeq4SFv1ShqzYwXpKy027SgM+JEZ43bve6/JT0H6ep1JbYAXYgGVwfQkjFTSGJD5T6x+32wHh6seIBVpvdyWuisiZ37Pd5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DB8EUR06FT028.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::4c) by DB8EUR06HT029.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::299) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24; Mon, 26 Jul 2021 16:45:38 +0000 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2a01:111:e400:fc35::40) by DB8EUR06FT028.mail.protection.outlook.com (2a01:111:e400:fc35::253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24 via Frontend Transport; Mon, 26 Jul 2021 16:45:38 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:1AF6BCAC5F24807FF47AD678F709CCF2EFB40D2ABB0E4ACDDC62C8729242E2A8; UpperCasedChecksum:84D84D84CC6CD50967EF9AEA237CDCE1B5EF84F1289FB72D9DEAA6AA9F58D3F2; SizeAsReceived:7783; Count:45 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::3d30:d151:570a:8a16]) by AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::3d30:d151:570a:8a16%8]) with mapi id 15.20.4352.031; Mon, 26 Jul 2021 16:45:38 +0000 To: "gcc-patches@gcc.gnu.org" , Richard Biener , Eric Botcazou , Arnaud Charlet From: Bernd Edlinger Subject: [PATCH 1/2] Fix debug info for ignored decls at start of assembly Message-ID: Date: Mon, 26 Jul 2021 18:45:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TMN: [RWqVWGFuEqNuV0i3wqZtU0xrDcXbSGDX] X-ClientProxiedBy: AM0PR02CA0001.eurprd02.prod.outlook.com (2603:10a6:208:3e::14) To AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:364::23) X-Microsoft-Original-Message-ID: <9b61dee3-bb43-ccbd-c2e3-af16935180fe@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (88.76.118.196) by AM0PR02CA0001.eurprd02.prod.outlook.com (2603:10a6:208:3e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24 via Frontend Transport; Mon, 26 Jul 2021 16:45:37 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 6f68eef9-2b3e-4fb7-8373-08d95054cc0d X-MS-TrafficTypeDiagnostic: DB8EUR06HT029: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZvenZ1Yllh/LbH/tEJNh8dpGVppIiPRqcbHpqAkbHxKW0ZO1QZUGggdnRwmkFirzNqeorVr15mDgOsyDX3bs3FGg17WEao1aJ8pgqTNBdK9OwBrNaV6E6P7hohj6Wt2DbI7SusYseAYSfg1NcIlWiLImC8fS0lSAnk1i0ORqmpoeiXx9k3ZXQ3Z0NMMM8QZDj+0vVCmELv6kYNyPTpgZlKCny1yGa8ZBMgA4GznECkIg/jMJKlaIFJfeaIGnapNQsstMR+2kUyyUiXGrkxNTCmfneTekibYU4k2xVcmNZQv+jhBTiDkVOXNhpF9bA6gEbXDW6Zd6ENC0k4AqJAwhqIp1aKONHfExkJ4S4DRog59JN1tLVEd4foehsBMouYrSse7GGdvhBHSgjbX6TQtZZol1zx/vbpJkOaA52DCSfKVhv6LsoMR8KC0bjAAGmQaK X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aqgRsyRyEZDEdiis0RKLdQ5Da1teZ0FFpbcNkBBzV+hJpndIdhKGWcoY2Z5fqXWdLviKnnPOy6+/viVdbAGt27xQZBFjc+iNDr3EgGv+5ueTHWWj0ZQgi4brb5Ru6qatWaZmpejblTPyJBzbpccuPw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f68eef9-2b3e-4fb7-8373-08d95054cc0d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2021 16:45:38.2649 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR06FT028.eop-eur06.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: DB8EUR06HT029 X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, FORGED_MUA_MOZILLA, FREEMAIL_FROM, GIT_PATCH_0, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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: 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: , X-List-Received-Date: Mon, 26 Jul 2021 16:45:41 -0000 Ignored functions decls that are compiled at the start of the assembly have bogus line numbers until the first .file directive, as reported in PR101575. The work around for this issue is to emit a dummy .file directive when the first function is DECL_IGNORED_P, when that is not already done, mostly for -fdwarf-4. 2021-07-24 Bernd Edlinger PR ada/101575 * dwarf2out.c (dwarf2out_begin_prologue): Move init of fde->ignored_debug to dwarf2out_set_ignored_loc. (dwarf2out_set_ignored_loc): This is now also called when no .loc statement is to be generated, in that case we emit a dummy .file statement when needed. * final.c (final_start_function_1, final_scan_insn_1): Call debug_hooks->set_ignored_loc for all DECL_IGNORED_P functions. --- gcc/dwarf2out.c | 29 +++++++++++++++++++++++++---- gcc/final.c | 5 ++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 884f1e1..8de0d6f 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1115,7 +1115,6 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, fde->dw_fde_current_label = dup_label; fde->in_std_section = (fnsec == text_section || (cold_text_section && fnsec == cold_text_section)); - fde->ignored_debug = DECL_IGNORED_P (current_function_decl); in_text_section_p = fnsec == text_section; /* We only want to output line number information for the genuine dwarf2 @@ -28546,10 +28545,32 @@ dwarf2out_set_ignored_loc (unsigned int line, unsigned int column, { dw_fde_ref fde = cfun->fde; - fde->ignored_debug = false; - set_cur_line_info_table (function_section (fde->decl)); + if (filename) + { + set_cur_line_info_table (function_section (fde->decl)); + + dwarf2out_source_line (line, column, filename, 0, true); + } + else + { + fde->ignored_debug = true; + + /* Work around for PR101575: output a dummy .file directive. */ + if (in_first_function_p + && debug_info_level >= DINFO_LEVEL_TERSE + && dwarf_debuginfo_p () +#if defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) && defined(HAVE_AS_WORKING_DWARF_N_FLAG) + && dwarf_version <= 4 +#endif + && output_asm_line_debug_info ()) + { + const char *filename0 = get_AT_string (comp_unit_die (), DW_AT_name); - dwarf2out_source_line (line, column, filename, 0, true); + if (filename0 == NULL) + filename0 = ""; + maybe_emit_file (lookup_filename (filename0)); + } + } } /* Record the beginning of a new source file. */ diff --git a/gcc/final.c b/gcc/final.c index ac6892d..82a5767 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1725,7 +1725,7 @@ final_start_function_1 (rtx_insn **firstp, FILE *file, int *seen, if (!dwarf2_debug_info_emitted_p (current_function_decl)) dwarf2out_begin_prologue (0, 0, NULL); - if (DECL_IGNORED_P (current_function_decl) && last_linenum && last_filename) + if (DECL_IGNORED_P (current_function_decl)) debug_hooks->set_ignored_loc (last_linenum, last_columnnum, last_filename); #ifdef LEAF_REG_REMAP @@ -2205,8 +2205,7 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, } else if (!DECL_IGNORED_P (current_function_decl)) debug_hooks->switch_text_section (); - if (DECL_IGNORED_P (current_function_decl) && last_linenum - && last_filename) + if (DECL_IGNORED_P (current_function_decl)) debug_hooks->set_ignored_loc (last_linenum, last_columnnum, last_filename); -- 1.9.1