From patchwork Wed May 12 22:13:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1477855 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=RSJqHX/e; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4FgTb45fG5z9sWM for ; Thu, 13 May 2021 08:13:52 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2336C393C854; Wed, 12 May 2021 22:13:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2336C393C854 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1620857626; bh=KcR8YKcXCe17x+zBtVOEKX1IFesA3acVbi7EuybLeeM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RSJqHX/e1Y30r7hDLP4PPgB69R1H8i8HpH3a7AqsE0ZFHfXMfzzvXjfaJs/aPgvhl GkxoukJ3Okqav2AcEg4u7T4c6gZ30tOQH1uUq+q9ft+GEKXlNHsytcVGr6nxh0CbHu 5N/v/rnxeb9YiW9msi35OX7O28c9eG9Bm0Etp4NM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by sourceware.org (Postfix) with ESMTPS id E9455385380C for ; Wed, 12 May 2021 22:13:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E9455385380C Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14CM0qmv096070 for ; Wed, 12 May 2021 22:13:40 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 38gpnug46d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 12 May 2021 22:13:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14CM03tr080619 for ; Wed, 12 May 2021 22:13:40 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3020.oracle.com with ESMTP id 38gppfhdrk-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 12 May 2021 22:13:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMiTjt6KqLH3wBmNRc+KJhHoPOk8h+Ar5/BlfYqnIGajis9HsFaEMqe9BUuTPY2h+LNosxmoltdeTBgEPgOgDSTCA5dQc8JI4jKiKizcPqltDDjsMbjXPw2qX1R95lHMvEsTAj2OFVpA5B0z8Iq4M6yx6dmnWpH8wO1UnUNHdOGeZWrMD/Hxgzec1x5DrMGv+DwL2cW67Fx+JHqZ1xYZNCuiNN3kgGNS35N+QAYxljSaKv1pWbA644uhJunMQnICDC8bXR3yjhQ1P6OpbA3ABhA5HUddZFKKO57/HRRUNwm4sU2WSLLHylyDI9E46jWLnE1K/tRg2jC/9zhYKutkLA== 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=KcR8YKcXCe17x+zBtVOEKX1IFesA3acVbi7EuybLeeM=; b=NGRK3GJc1ECWW/k+8olbpwCloXh4w6mcqz4AzABO8rBpqix5FgR42j/tX+cMIzKLg/ZJ//NxsIux600WQwADHkJIL/w4jNGFcdBNp/yrzryutqo1LWj/8wbsAx9Os22cS/SU64M43WmieGNSkImmfBux+hJTBiEbLzYH4OKp7OyDoV3GaAEWDnelJmSThT6jbfuUnLjbQxQ5Oox4H2Sp89/hFuABHuByteq3jG7b3AMGbU/RHNGxUyauyoik8U6zgK2LlDJ4FhESrz740kAX5+QbFbtT/VaVsnCIDCmCWcP6MYf5S/Tb9zTJwiCCFn15QOKSFJgmS8yxhGTSG0j4lQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CO1PR10MB4499.namprd10.prod.outlook.com (2603:10b6:303:6d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.26; Wed, 12 May 2021 22:13:38 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::38f0:2cf9:7238:9ffa]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::38f0:2cf9:7238:9ffa%6]) with mapi id 15.20.4065.042; Wed, 12 May 2021 22:13:38 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH,V3 2/2] dwarf: new dwarf_debuginfo_p predicate Date: Wed, 12 May 2021 15:13:26 -0700 Message-Id: <1620857606-25038-3-git-send-email-indu.bhagat@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620857606-25038-1-git-send-email-indu.bhagat@oracle.com> References: <1620857606-25038-1-git-send-email-indu.bhagat@oracle.com> X-Originating-IP: [24.80.24.133] X-ClientProxiedBy: MWHPR13CA0047.namprd13.prod.outlook.com (2603:10b6:300:95::33) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ibhagatpc.hitronhub.home (24.80.24.133) by MWHPR13CA0047.namprd13.prod.outlook.com (2603:10b6:300:95::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.11 via Frontend Transport; Wed, 12 May 2021 22:13:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b4c245e-c860-4acc-de92-08d91593312c X-MS-TrafficTypeDiagnostic: CO1PR10MB4499: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZE+PMWO82tFLbt2KrYAdppreKPtti655eRAjXMgMJqES9CvzWftUO/YHSHJ7s/oLghQpQkdsY3g2sJIE+h4uCrGHsdDHQlTSDvni9zRkae2/NkL1UBs7cb7iOFAcnG5TKxstH9BJoS5onnrho9iEILF7+EIiTcCAMLR2qEVAFFqSYazCSx2KMEmmm5u0up1SAQDAikcFsSdlOjcLHu2oOkrh1jiEiTTmcHLcDn7wimwxYtKULL1Whh+Q+D0Tbtidatj20zQVadteObwvvlPfVBXhSzggjCOloplJZV+6UMSRfxuIHL8iwIhJo+aHZ0bVOxiXGt7A6FVhaF+GqtpCl/W0O4aW3q1o2cFV30CA3EQfAuBXDrcUntGLc86N62T/HJIQjDUuF6j9khLP0OddVqk413/APuBXre7U1q4bpCMfeteVuVFkJzy//Z8v5DBs/wzhHScZsXIGYOGk3fDIYrq3Oe9whk+OuQJOXtZcaP+c+eBxSGxDpBZ/oTiiIrJuAta+dkLILd3ez/NAdUMcvYvLkqVRqDHSz9J9fcHs+HhvcvwUnYU3DzVye9IqxvUqs4+G36bYPPUIkv7gmr4XmBT6eimqmfcyzybM4eh7rZfiok+2+ry5Yq/ObdRQrkMUlbYBt1UFnJaFbZBG8PrJcw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(376002)(366004)(136003)(39860400002)(396003)(2616005)(956004)(38350700002)(38100700002)(16526019)(6916009)(6512007)(186003)(26005)(44832011)(8676002)(478600001)(2906002)(36756003)(316002)(86362001)(6486002)(66946007)(30864003)(6666004)(8936002)(66556008)(66476007)(52116002)(6506007)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: MWV8SvqE3KS4UT0ZfVNG+NXbmj307I3EvOiGXdyJfo5X42hgJZKO3ZF9VVHxovoMsliF5d/w6M1wrh61OQwwLdjlqw7l7/ULqFQ5x5jOOsdCJt+Z/+V0egQdKZUXhoG1zYRXVvWsZeFtoZhjwMLHWqAH0fscZEz8c9+jH07FHGyU6Gx9fbaCPcia+bYK1iklGKT+GOkqulrcKitBFGe3/xsDYSZ6Uqqq/OzkAfRdjaPtoLJyuMydgaFm+AFnOQGBE79utFgKQAU7JSlimL0OOpDVInQd438a5wprUkZAf6oeOtlsn2Qx1IWxBNHAnM8znLzniRWfF7vZIippZGaaoAI1dM+0K8rzz0TYn+LJ0H6TiJbdnv16e7STdmKnrvJ343UPQVv4QEXhWdfMMMUtumW+Ohku0dZ0Rxuu6tkfNu9yYNqjLOBPoIUhvtRoHxT4uWy/OtO+BhTEtCx58rPaqdltfeBeSrwMe4ZPvle2AOCfq6GkkAiMB55gl5YSPX0A2DXel2Hi1mX5k0BeJfZlFzHYWVPqbur7ULQpxX2VK2ZtyWR1V21xUjVINoQvP6ugIiaiEeeectS7JzwevmgQ3wqz+iMwHCibdiVIWjAaTVPgmHVkScC1EqbUpePYzp4o2qnnFrtF6nJwNIQdniA2pyeL/aTs1AQl6NIP46Sx0jjbj0wpGI3yto23I4c5HCqij+pa6MSnT7pUS1zpUJwgUDNgy+6VcNeqTGqjqvhejDC3mc2Vi/SYP+FCmttYjz1NFwBWaRZDPdZkqsN4HrL2wDbVSJgROBewVk0wm7n3xLWuVYHsIyPJRatZSj0dKE2mqZQM/j8TXdGosrFVs2bNQQdfMD4FtzrMHMqMlnprUDxabKMouM78kl9TdoeenzxRIMo+iMv21CYlzCJSTz9nMKmT26o49bpjH4AOpML1xj1orckv0lNZjKdjP7cXfhNNopu1VfWDm8jrd9AkUBJJ3hWtvwdQCs8VVl1dmNu8NZHo6+tR/QoTw61qz+w4ZABPxAumJYw69xaekZsDwtGo0Qrue4YCwGROxRm6d00UMVzID8lmjEnyoxZGmdUey1tzTbegpGWgimwoQItcKEEOsY4ahCHuGE1FfwmtUVsCZvJkgHJKdhV7GoaGi+aNmTLZK0RO7aYBayg0snavgQHRbGMsXYJ38U2wec4b2racgfFx10OhmMwhjaH5cOHu9MynjH/sn0EHoQWdFT+JGigEdouCvTREqfLSl4+4g2BBt/YR96R7scbt8QBMBjK8N4xCADj0l+ICjD9M7GynzqM1qzQNYrValXOkTJe+HECbWa09+ZF0zvvk94cLrOMWZjnz X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b4c245e-c860-4acc-de92-08d91593312c X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 22:13:38.0474 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zMBTtqN9DkmZcVcalmqCRKsyshO7jF4SXDq8p8iOiZBzsrz5WMwRzonJkMwodYv/J3hOWI4Vh73bygCNWSBqAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4499 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9982 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120142 X-Proofpoint-ORIG-GUID: p4XXZPA1h8d93evOBuMf2kxSa1uuC3n9 X-Proofpoint-GUID: p4XXZPA1h8d93evOBuMf2kxSa1uuC3n9 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9982 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 adultscore=0 spamscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120142 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, 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: , X-Patchwork-Original-From: Indu Bhagat via Gcc-patches From: Indu Bhagat Reply-To: Indu Bhagat Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" [Changes from V2] - Tested build (make all-gcc) of cross compiler for target triplets containing c6x/mips/powerpc and darwin/cygwin. [End of changes from V2] This patch introduces a dwarf_debuginfo_p predicate that abstracts and replaces complex checks on write_symbols. gcc/c-family/ChangeLog: * c-lex.c (init_c_lex): Use dwarf_debuginfo_p. gcc/ChangeLog: * config/c6x/c6x.c (c6x_output_file_unwind): Use dwarf_debuginfo_p. * config/darwin.c (darwin_override_options): Likewise. * config/i386/cygming.h (DBX_REGISTER_NUMBER): Likewise. * config/i386/darwin.h (DBX_REGISTER_NUMBER): Likewise. (DWARF2_FRAME_REG_OUT): Likewise. * config/mips/mips.c (mips_output_filename): Likewise. * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): Likewise. (rs6000_dbx_register_number): Likewise. * dbxout.c: Include flags.h. * dwarf2cfi.c (cfi_label_required_p): Likewise. (dwarf2out_do_frame): Likewise. * except.c: Include flags.h. * final.c (dwarf2_debug_info_emitted_p): Likewise. (final_scan_insn_1): Likewise. * flags.h (dwarf_debuginfo_p): New function declaration. * opts.c (dwarf_debuginfo_p): New function definition. * targhooks.c (default_debug_unwind_info): Use dwarf_debuginfo_p. * toplev.c (process_options): Likewise. --- gcc/c-family/c-lex.c | 4 ++-- gcc/config/c6x/c6x.c | 4 ++-- gcc/config/darwin.c | 3 ++- gcc/config/i386/cygming.h | 2 +- gcc/config/i386/darwin.h | 4 ++-- gcc/config/mips/mips.c | 3 ++- gcc/config/rs6000/rs6000.c | 4 ++-- gcc/dbxout.c | 1 + gcc/dwarf2cfi.c | 9 ++++----- gcc/except.c | 1 + gcc/final.c | 15 ++++++--------- gcc/flags.h | 4 ++++ gcc/opts.c | 8 ++++++++ gcc/targhooks.c | 2 +- gcc/toplev.c | 6 ++---- 15 files changed, 40 insertions(+), 30 deletions(-) diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 1c66ecd..c44e7a1 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "stor-layout.h" #include "c-pragma.h" #include "debug.h" +#include "flags.h" #include "file-prefix-map.h" /* remap_macro_filename() */ #include "langhooks.h" #include "attribs.h" @@ -87,8 +88,7 @@ init_c_lex (void) /* Set the debug callbacks if we can use them. */ if ((debug_info_level == DINFO_LEVEL_VERBOSE - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG)) + && dwarf_debuginfo_p ()) || flag_dump_go_spec != NULL) { cb->define = cb_define; diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index f9ad1e5..e2011f0 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -59,6 +59,7 @@ #include "regrename.h" #include "dumpfile.h" #include "builtins.h" +#include "flags.h" /* This file should be included last. */ #include "target-def.h" @@ -439,8 +440,7 @@ c6x_output_file_unwind (FILE * f) { if (flag_unwind_tables || flag_exceptions) { - if (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) asm_fprintf (f, "\t.cfi_sections .debug_frame, .c6xabi.exidx\n"); else asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n"); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 5d17391..026c1fb 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "lto-section-names.h" #include "intl.h" #include "optabs.h" +#include "flags.h" /* Fix and Continue. @@ -3348,7 +3349,7 @@ darwin_override_options (void) && generating_for_darwin_version >= 9 && (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE) : (debug_info_level >= DINFO_LEVEL_NORMAL)) - && write_symbols == DWARF2_DEBUG) + && dwarf_debuginfo_p ()) flag_var_tracking_uninit = flag_var_tracking; /* Final check on PCI options; for Darwin these are not dependent on the PIE diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index cfbca34..ac458cd 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see #undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) \ (TARGET_64BIT ? dbx64_register_map[n] \ - : (write_symbols == DWARF2_DEBUG \ + : (dwarf_debuginfo_p () \ ? svr4_dbx_register_map[n] : dbx_register_map[n])) /* Map gcc register number to DWARF 2 CFA column number. For 32 bit diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index afa9f1b..5312003 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -275,13 +275,13 @@ along with GCC; see the file COPYING3. If not see #undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) \ (TARGET_64BIT ? dbx64_register_map[n] \ - : write_symbols == DWARF2_DEBUG ? svr4_dbx_register_map[n] \ + : dwarf_debuginfo_p () ? svr4_dbx_register_map[n] \ : dbx_register_map[n]) /* Unfortunately, the 32-bit EH information also doesn't use the standard DWARF register numbers. */ #define DWARF2_FRAME_REG_OUT(n, for_eh) \ - (! (for_eh) || write_symbols != DWARF2_DEBUG || TARGET_64BIT ? (n) \ + (! (for_eh) || !dwarf_debuginfo_p () || TARGET_64BIT ? (n) \ : (n) == 5 ? 4 \ : (n) == 4 ? 5 \ : (n) >= 11 && (n) <= 18 ? (n) + 1 \ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 3155459..529e1c9 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "context.h" #include "builtins.h" #include "rtl-iter.h" +#include "flags.h" /* This file should be included last. */ #include "target-def.h" @@ -9489,7 +9490,7 @@ mips_output_filename (FILE *stream, const char *name) { /* If we are emitting DWARF-2, let dwarf2out handle the ".file" directives. */ - if (write_symbols == DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) return; else if (mips_output_filename_first_time) { diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index d1b76f6..26f32e5 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -21606,7 +21606,7 @@ rs6000_xcoff_declare_function_name (FILE *file, const char *name, tree decl) { if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG) xcoffout_declare_function (file, decl, buffer); - else if (write_symbols == DWARF2_DEBUG) + else if (dwarf_debuginfo_p ()) { name = (*targetm.strip_name_encoding) (name); fprintf (file, "\t.function .%s,.%s,2,0\n", name, name); @@ -23765,7 +23765,7 @@ rs6000_dbx_register_number (unsigned int regno, unsigned int format) { /* On some platforms, we use the standard DWARF register numbering for .debug_info and .debug_frame. */ - if ((format == 0 && write_symbols == DWARF2_DEBUG) || format == 1) + if ((format == 0 && dwarf_debuginfo_p ()) || format == 1) { #ifdef RS6000_USE_DWARF_NUMBERING if (regno <= 31) diff --git a/gcc/dbxout.c b/gcc/dbxout.c index d20527b..6be2827 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -92,6 +92,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "expr.h" #include "file-prefix-map.h" /* remap_debug_filename() */ +#include "flags.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index 362ff3f..c27ac19 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -39,7 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "expr.h" /* init_return_column_size */ #include "output.h" /* asm_out_file */ #include "debug.h" /* dwarf2out_do_frame, dwarf2out_do_cfi_asm */ - +#include "flags.h" /* dwarf_debuginfo_p */ /* ??? Poison these here until it can be done generically. They've been totally replaced in this file; make sure it stays that way. */ @@ -2289,8 +2289,7 @@ cfi_label_required_p (dw_cfi_ref cfi) if (dwarf_version == 2 && debug_info_level > DINFO_LEVEL_TERSE - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG)) + && dwarf_debuginfo_p ()) { switch (cfi->dw_cfi_opc) { @@ -3557,9 +3556,9 @@ bool dwarf2out_do_frame (void) { /* We want to emit correct CFA location expressions or lists, so we - have to return true if we're going to output debug info, even if + have to return true if we're going to generate debug info, even if we're not going to output frame or unwind info. */ - if (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) return true; if (saved_do_cfi_asm > 0) diff --git a/gcc/except.c b/gcc/except.c index a7902bb..d481a5e 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -144,6 +144,7 @@ along with GCC; see the file COPYING3. If not see #include "cfgloop.h" #include "builtins.h" #include "tree-hash-traits.h" +#include "flags.h" static GTY(()) int call_site_base; diff --git a/gcc/final.c b/gcc/final.c index e0a70fc..38c3d70 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1428,7 +1428,8 @@ asm_str_count (const char *templ) static bool dwarf2_debug_info_emitted_p (tree decl) { - if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG) + /* When DWARF2 debug info is not generated internally. */ + if (!dwarf_debuginfo_p ()) return false; if (DECL_IGNORED_P (decl)) @@ -2306,10 +2307,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, break; case NOTE_INSN_BLOCK_BEG: - if (debug_info_level == DINFO_LEVEL_NORMAL - || debug_info_level == DINFO_LEVEL_VERBOSE - || write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG + if (debug_info_level >= DINFO_LEVEL_NORMAL + || dwarf_debuginfo_p () || write_symbols == VMS_DEBUG) { int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); @@ -2344,10 +2343,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, case NOTE_INSN_BLOCK_END: maybe_output_next_view (seen); - if (debug_info_level == DINFO_LEVEL_NORMAL - || debug_info_level == DINFO_LEVEL_VERBOSE - || write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG + if (debug_info_level >= DINFO_LEVEL_NORMAL + || dwarf_debuginfo_p () || write_symbols == VMS_DEBUG) { int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); diff --git a/gcc/flags.h b/gcc/flags.h index 3415493..cc7b79b 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -40,6 +40,10 @@ unsigned int debug_set_count (uint32_t w_symbols); const char * debug_set_names (uint32_t w_symbols); +/* Return true iff DWARF2 debug info is enabled. */ + +extern bool dwarf_debuginfo_p (); + extern void strip_off_ending (char *, int); extern int base_of_path (const char *path, const char **base_out); diff --git a/gcc/opts.c b/gcc/opts.c index 1604241..a751d95 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -126,6 +126,14 @@ debug_set_names (uint32_t w_symbols) return df_set_names; } +/* Return TRUE iff dwarf2 debug info is enabled. */ + +bool +dwarf_debuginfo_p () +{ + return (write_symbols & DWARF2_DEBUG); +} + /* Parse the -femit-struct-debug-detailed option value and set the flag variables. */ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 2e0fdb7..7d5bffd 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1976,7 +1976,7 @@ default_debug_unwind_info (void) /* Otherwise, only turn it on if dwarf2 debugging is enabled. */ #ifdef DWARF2_DEBUGGING_INFO - if (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG) + if (dwarf_debuginfo_p ()) return UI_DWARF2; #endif diff --git a/gcc/toplev.c b/gcc/toplev.c index 1016fb9..6a6ebe9 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1527,8 +1527,7 @@ process_options (void) debug_nonbind_markers_p = (optimize && debug_info_level >= DINFO_LEVEL_NORMAL - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + && dwarf_debuginfo_p () && !(flag_selective_scheduling || flag_selective_scheduling2)); if (dwarf2out_as_loc_support == AUTODETECT_VALUE) @@ -1543,8 +1542,7 @@ process_options (void) debug_variable_location_views = (flag_var_tracking && debug_info_level >= DINFO_LEVEL_NORMAL - && (write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG) + && dwarf_debuginfo_p () && !dwarf_strict && dwarf2out_as_loc_support && dwarf2out_as_locview_support);