From patchwork Tue May 11 14:40:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1477168 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; 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=SmbsCANm; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.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 4FfgZK19ZZz9sV5 for ; Wed, 12 May 2021 00:40:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A0068398B151; Tue, 11 May 2021 14:40:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0068398B151 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1620744019; bh=diw0I5Zx+lFUkbMuGDvNpl9JYnT6XBKKjf2NXhFuKCw=; 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=SmbsCANmYxNoKF8zEa9Fa6+pHbNBxbJ6BBZ+b+VE7gxWpC1ZHoIHgnj4CN3AM0JoP H4bfWgWya9ujgHOWdYMIQenqtMuYxboEiYmyO5dfMmn93uxjLo0aAG9da58b62LPyb Qwt7xUyp7cSjPTHc/6XWmX+7UAJJhdoXyp4h4oEM= 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 1ED64388CC02 for ; Tue, 11 May 2021 14:40:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1ED64388CC02 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 14BEYfgf018226 for ; Tue, 11 May 2021 14:40:15 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 38dk9nexdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 11 May 2021 14:40:15 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14BEZrbJ004731 for ; Tue, 11 May 2021 14:40:14 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2042.outbound.protection.outlook.com [104.47.56.42]) by aserp3030.oracle.com with ESMTP id 38e5pxc7j9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 11 May 2021 14:40:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iZHnU3aVx4YKwrjfQmhdssurtwm8SIM+oVBPOq99mK5yxjsiw5uCiGYAGAlA8Lg0r6snkcEJqUd6TEuA70W6rRVPw6LrDXBZCaNnpOn5v0r+SGX8aAV8NeneKzNkmv0cCI3ulT1QHXDK+rinrRhUbPNETszQBDEjYcZ27ocydHQYm9ITnAFExy11w+tJ0Oz5Hu1PYgJTX39gH8oNS7hpRvnSFHNwL7QCo0UmFdT9Y56RlkgQ/5UT2+7LjaosgxKfBorulCyl6zjCfqJ5bP4k9kY+Kj14EtLV7GF6xxuMr6A6XiS4s6sLlNXu8PVLnGggVxO8Py4rSGs84QCrf1KW9A== 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=diw0I5Zx+lFUkbMuGDvNpl9JYnT6XBKKjf2NXhFuKCw=; b=I+kC4WKdv+k42UMY7puYGhwoJhfXzS+MR7yfnAtxG7AX33S2amC0Svpr++krpgLSgY8UFqxy/5xDmDpruI1GNZlwzQkoUqtppYBkZL2s8+JlV2hcvNr8sKFUNyFBztSJ6ijwh9sZT+CsAU83hS2LZT+FteZn7BCfk80j0vp3GHKPE+4ANywo3HFD6pAAm9BZtGEuwhoQgK1YB9z92QfHlq0jY6M9Wh5cRItKJWwftVYkyLCKJ4dE7LMWPdRFWD67J0WyowlyPAlerTxOhzzVItztZJlH/++Z8hs9RaT61MHDk4amj3TegXHewQaYL14P2d+DudNTcBLDRmgjXJSamQ== 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 CO1PR10MB4449.namprd10.prod.outlook.com (2603:10b6:303:9d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31; Tue, 11 May 2021 14:40:11 +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; Tue, 11 May 2021 14:40:11 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH,V2 1/2] opts: change write_symbols to support bitmasks Date: Tue, 11 May 2021 07:40:02 -0700 Message-Id: <1620744003-12647-2-git-send-email-indu.bhagat@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620744003-12647-1-git-send-email-indu.bhagat@oracle.com> References: <1620744003-12647-1-git-send-email-indu.bhagat@oracle.com> X-Originating-IP: [24.80.24.133] X-ClientProxiedBy: MWHPR2001CA0008.namprd20.prod.outlook.com (2603:10b6:301:15::18) 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 MWHPR2001CA0008.namprd20.prod.outlook.com (2603:10b6:301:15::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 11 May 2021 14:40:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4520fba5-8fe8-40f8-1038-08d9148aae1a X-MS-TrafficTypeDiagnostic: CO1PR10MB4449: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G00y+0eOebAbLrDdsnRN1IMdV0/6V8seItlTB2jlEyMX7cvBLUivpFr7De0jSVq29sVdqT1ZR0WYnnZnmr/RpehSY8J5sr/kqmHfxcKSpk2mrJU8OoONWLnKxI2hSYzRqH149dKcngZwuVVSNASO13TkTovPHoayJ+QAVjU++vCBtpaSWy5a58isv6yOw2tIPT75cjw00qiwiHXuWLFBwSsUPaLqzT+dUv4RtBzBQmffaT8XntPYkPmRdnKJLaXadkpwbr1jHhg6XsPmlaR9++XIz6ejmBq0Go4tY1FbEop8xpIygNoVxujJiosdTigEKnETVN1fWw3/iTodEUYw04+TSvJ3r3qiOGO/fG9/bINJwtUKUQR6kbGxUECPr6VtN+J2nvBX5IWsW1kAfPUcgrZ7xsVUJuDA5upwsH/s5AwC83EAGvEIHpClF/s6ndxY6hP0CVNjFpeMonOWQMx8/d6XDVUeswEPEQwjwtxIlruzf5/sG3IljUUeUQLdho9+Ueh64SwrTAEXwVOPhTIugTSUqTNstwK0JqKxPX/pCj8siz8Iv5pCkO3MrK78u81JWiNYKTiBZdKFabXw+rs2+XucfIiReG9Sy2jPX/63WWHlbv0wW/Dr7ZT1nZ3GlgLAjHviHUgmEZdP/iFVJTKGHA== 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:(376002)(39860400002)(136003)(396003)(366004)(346002)(6486002)(83380400001)(6666004)(5660300002)(30864003)(38100700002)(6512007)(38350700002)(66476007)(66556008)(316002)(6916009)(2906002)(8936002)(8676002)(6506007)(44832011)(186003)(16526019)(52116002)(36756003)(26005)(66946007)(956004)(478600001)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dKdj0NuDgz/8CYZxgjkgvu54rZDT7GE+mEPRCUF+jFnW8eDd/qcb0sOZbm+HCSeLXDdJ7AZdDHRuKQ6TL44YHQV40S8m6VzCAcyJz51Fh4P5Ne7B0fOVmK9TOvaqGTMaV+bzUFnTsk0QvmuRa5zIm16sbgs6878reC9ed1LH7RLpgtSlfQpmF4JiiFpm0U08xMghmp0YqKxCE6ghk7UufBSJt3g1Y0cSEFEnqJWq8paKLotDwtAWmNyi2z3Em5wGcQwH+FE4UxdyXS4TeEljVisSK1qZfsC0+uVTcccH961CqxAXeG4e2dlvjqtZsg0PkK7FTEp/2/a2WA2VtgzGWKWM4h1+bNWWFZCCyZZ6fseVriKilckRiIKuzHi+udiTc88HjB5kCUnxC6K0MR6YEC8JkGc7IRmsvQ5Rxk8qLMtLSmzK1J7ubJwCaOa3LRFzhlesTs3ETWlmD9H42qBQvC4zw/WbEVfJiJD4eFPDHeOyARh9Zs6CHkBaYqzYy2Bx8csR/ZXL8kgYNqJ2KN5ucAoEZYNEydGrozaXSsMrNRiIXzHd3J/IDmlf7TnlcnsVKENVfge+GSE7DD8XwVedt/oALVLmKkoAjkPedlROEBBM77SBU61O47HFWJGCvuMVfTTJQtS+cdNwnYsnIQMNhI9HmGlz5fZIF5Xv2+FtAtdBRUMpYe3pQe0odnreikKSMZdLDovgtnFlJ4GtNhNXOx1GJn/HdhyPQ9bhLGWpsRQSJMKWAXwlV7XvBYf1mcxs36nlPlk0P9W+rs19GTel9VRqGbrUN0JFxpCgJVN82mvTnDTKQbSzqTRVOxFsdbnag6WyT8o3GImDjjnSER13P2c1ymBm3DSozAckIgLZbB9AP+RN+OCHW3dctK8nFIfAI6eYeJZ56qD/eN+Rhrznt+MiH7bLTnfGnDihyJ0hSNo0uoGPt3HYt18FpgbdxFMUqSCRvbSYPIuh2UH/JG/XMYxoa9fkSk8yjNHAwlhT7faCfv9wrcShrF376sj3p0qHnNg9zHyam1FeY4+wM7elnvIugN6v/AvYF+n+aCBFfcjkGbtJc8qOlbevEcHvVRf36KyWReuNKDh4z0gAsmuAm2dUuXAUKoj9TGdmdbWm4s4tEBXsnC28BvqBPs+PJzsiksv1e5k8O3xHo9dhBUksfAGWAPNJfS6WR6brA22h8QjVLEmabmLqjr1bwTaz4muvokq91WciYDCwYRQtGzEDfXTubzmE1mkhh3IQePxsZJrLLNckJxzDZBaAE9F982TBzVonZjAi7kLhEJnA5feLQ1x69z77ZveHAjlyWBN2sazfh4gTzFepDV3cK8InUY5M X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4520fba5-8fe8-40f8-1038-08d9148aae1a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2021 14:40:10.9551 (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: TXGlgoORDqz1XUWjCjpdFpKxc87YK0wNwB8Tpu9weuzbTqAmk0vwTAun4M5RzuQ7GqvsQUxi+rnral36TrV0mA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4449 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9981 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105110110 X-Proofpoint-ORIG-GUID: 89loAHT8eLcVr9Y7mVMuYUfVcUDbrapb X-Proofpoint-GUID: 89loAHT8eLcVr9Y7mVMuYUfVcUDbrapb X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9981 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 adultscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105110110 X-Spam-Status: No, score=-11.6 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 V1] - Use debug_set_names API and remove asserts around the diagnostics - Reword diagnostic and adjust testsuite [End of changes from V1] To support multiple debug formats, we need to move away from explicit enumeration of each individual combination of debug formats. gcc/c-family/ChangeLog: * c-opts.c (c_common_post_options): Adjust access to debug_type_names. * c-pch.c (struct c_pch_validity): Use type uint32_t. (pch_init): Renamed member. (c_common_valid_pch): Adjust access to debug_type_names. gcc/ChangeLog: * common.opt: Change type to support bitmasks. * flag-types.h (enum debug_info_type): Rename enumerator constants. (NO_DEBUG): New bitmask. (DBX_DEBUG): Likewise. (DWARF2_DEBUG): Likewise. (XCOFF_DEBUG): Likewise. (VMS_DEBUG): Likewise. (VMS_AND_DWARF2_DEBUG): Likewise. * flags.h (debug_set_to_format): New function declaration. (debug_set_count): Likewise. (debug_set_names): Likewise. * opts.c (debug_type_masks): Array of bitmasks for debug formats. (debug_set_to_format): New function definition. (debug_set_count): Likewise. (debug_set_names): Likewise. (set_debug_level): Update access to debug_type_names. * toplev.c: Likewise. gcc/objc/ChangeLog: * objc-act.c (synth_module_prologue): Use uint32_t instead of enum debug_info_type. gcc/testsuite/ChangeLog: * gcc.dg/pch/valid-1.c: Adjust diagnostic message in testcase. * lib/dg-pch.exp: Adjust diagnostic message. --- gcc/c-family/c-opts.c | 7 ++- gcc/c-family/c-pch.c | 12 ++-- gcc/common.opt | 2 +- gcc/flag-types.h | 29 +++++++--- gcc/flags.h | 17 +++++- gcc/objc/objc-act.c | 2 +- gcc/opts.c | 109 +++++++++++++++++++++++++++++++++---- gcc/testsuite/gcc.dg/pch/valid-1.c | 2 +- gcc/testsuite/lib/dg-pch.exp | 4 +- gcc/toplev.c | 9 ++- 10 files changed, 157 insertions(+), 36 deletions(-) diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 89e05a4..60b5802 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1112,9 +1112,10 @@ c_common_post_options (const char **pfilename) /* Only -g0 and -gdwarf* are supported with PCH, for other debug formats we warn here and refuse to load any PCH files. */ if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG) - warning (OPT_Wdeprecated, - "the %qs debug format cannot be used with " - "pre-compiled headers", debug_type_names[write_symbols]); + warning (OPT_Wdeprecated, + "the %qs debug info cannot be used with " + "pre-compiled headers", + debug_set_names (write_symbols & ~DWARF2_DEBUG)); } else if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG) c_common_no_more_pch (); diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c index fd94c37..8f0f760 100644 --- a/gcc/c-family/c-pch.c +++ b/gcc/c-family/c-pch.c @@ -52,7 +52,7 @@ enum { struct c_pch_validity { - unsigned char debug_info_type; + uint32_t pch_write_symbols; signed char match[MATCH_SIZE]; void (*pch_init) (void); size_t target_data_length; @@ -108,7 +108,7 @@ pch_init (void) pch_outfile = f; memset (&v, '\0', sizeof (v)); - v.debug_info_type = write_symbols; + v.pch_write_symbols = write_symbols; { size_t i; for (i = 0; i < MATCH_SIZE; i++) @@ -252,13 +252,13 @@ c_common_valid_pch (cpp_reader *pfile, const char *name, int fd) /* The allowable debug info combinations are that either the PCH file was built with the same as is being used now, or the PCH file was built for some kind of debug info but now none is in use. */ - if (v.debug_info_type != write_symbols + if (v.pch_write_symbols != write_symbols && write_symbols != NO_DEBUG) { cpp_warning (pfile, CPP_W_INVALID_PCH, - "%s: created with -g%s, but used with -g%s", name, - debug_type_names[v.debug_info_type], - debug_type_names[write_symbols]); + "%s: created with '%s' debug info, but used with '%s'", name, + debug_set_names (v.pch_write_symbols), + debug_set_names (write_symbols)); return 2; } diff --git a/gcc/common.opt b/gcc/common.opt index a75b44e..ffb968d 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -109,7 +109,7 @@ bool exit_after_options ; flag-types.h for the definitions of the different possible types of ; debugging information. Variable -enum debug_info_type write_symbols = NO_DEBUG +uint32_t write_symbols = NO_DEBUG ; Level of debugging information we are producing. See flag-types.h ; for the definitions of the different possible levels. diff --git a/gcc/flag-types.h b/gcc/flag-types.h index a038c8f..d60bb30 100644 --- a/gcc/flag-types.h +++ b/gcc/flag-types.h @@ -24,15 +24,30 @@ along with GCC; see the file COPYING3. If not see enum debug_info_type { - NO_DEBUG, /* Write no debug info. */ - DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */ - DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */ - XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */ - VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */ - VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c). - and DWARF v2 debug info (using dwarf2out.c). */ + DINFO_TYPE_NONE = 0, /* No debug info. */ + DINFO_TYPE_DBX = 1, /* BSD .stabs for DBX. */ + DINFO_TYPE_DWARF2 = 2, /* Dwarf v2 debug info. */ + DINFO_TYPE_XCOFF = 3, /* IBM/Xcoff debug info. */ + DINFO_TYPE_VMS = 4, /* VMS debug info. */ + DINFO_TYPE_MAX = DINFO_TYPE_VMS /* Marker only. */ }; +#define NO_DEBUG (0U) +/* Write DBX debug info (using dbxout.c). */ +#define DBX_DEBUG (1U << DINFO_TYPE_DBX) +/* Write DWARF2 debug info (using dwarf2out.c). */ +#define DWARF2_DEBUG (1U << DINFO_TYPE_DWARF2) +/* Write IBM/XCOFF debug info (using dbxout.c). */ +#define XCOFF_DEBUG (1U << DINFO_TYPE_XCOFF) +/* Write VMS debug info (using vmsdbgout.c). */ +#define VMS_DEBUG (1U << DINFO_TYPE_VMS) +/* Note: Adding new definitions to handle -combination- of debug formats, + like VMS_AND_DWARF2_DEBUG is not recommended. This definition remains + here for historical reasons. */ +/* Write VMS debug info (using vmsdbgout.c) and DWARF v2 debug info (using + dwarf2out.c). */ +#define VMS_AND_DWARF2_DEBUG ((VMS_DEBUG | DWARF2_DEBUG)) + enum debug_info_levels { DINFO_LEVEL_NONE, /* Write no debugging info. */ diff --git a/gcc/flags.h b/gcc/flags.h index 0c4409e..3415493 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -22,9 +22,24 @@ along with GCC; see the file COPYING3. If not see #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) -/* Names of debug_info_type, for error messages. */ +/* Names of fundamental debug info formats indexed by enum + debug_info_type. */ + extern const char *const debug_type_names[]; +/* Get enum debug_info_type of the specified debug format, for error messages. + Can be used only for individual debug format types. */ + +extern enum debug_info_type debug_set_to_format (uint32_t debug_info_set); + +/* Get the number of debug formats enabled for output. */ + +unsigned int debug_set_count (uint32_t w_symbols); + +/* Get the names of the debug formats enabled for output. */ + +const char * debug_set_names (uint32_t w_symbols); + extern void strip_off_ending (char *, int); extern int base_of_path (const char *path, const char **base_out); diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 796256d..8d106a4 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3078,7 +3078,7 @@ static void synth_module_prologue (void) { tree type; - enum debug_info_type save_write_symbols = write_symbols; + uint32_t save_write_symbols = write_symbols; const struct gcc_debug_hooks *const save_hooks = debug_hooks; /* Suppress outputting debug symbols, because diff --git a/gcc/opts.c b/gcc/opts.c index 24bb641..026952f 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -37,12 +37,95 @@ along with GCC; see the file COPYING3. If not see static void set_Wstrict_aliasing (struct gcc_options *opts, int onoff); -/* Indexed by enum debug_info_type. */ +/* Names of fundamental debug info formats indexed by enum + debug_info_type. */ + const char *const debug_type_names[] = { "none", "stabs", "dwarf-2", "xcoff", "vms" }; +/* Bitmasks of fundamental debug info formats indexed by enum + debug_info_type. */ + +static uint32_t debug_type_masks[] = +{ + NO_DEBUG, DBX_DEBUG, DWARF2_DEBUG, XCOFF_DEBUG, VMS_DEBUG +}; + +/* Names of the set of debug formats requested by user. Updated and accessed + via debug_set_names. */ + +static char df_set_names[sizeof "none stabs dwarf-2 xcoff vms"]; + +/* Get enum debug_info_type of the specified debug format, for error messages. + Can be used only for individual debug format types. */ + +enum debug_info_type +debug_set_to_format (uint32_t debug_info_set) +{ + int idx = 0; + enum debug_info_type dinfo_type = DINFO_TYPE_NONE; + /* Find first set bit. */ + if (debug_info_set) + idx = exact_log2 (debug_info_set & - debug_info_set); + /* Check that only one bit is set, if at all. This function is meant to be + used only for vanilla debug_info_set bitmask values, i.e. for individual + debug format types upto DINFO_TYPE_MAX. */ + gcc_assert ((debug_info_set & (debug_info_set - 1)) == 0); + dinfo_type = (enum debug_info_type)idx; + gcc_assert (dinfo_type <= DINFO_TYPE_MAX); + return dinfo_type; +} + +/* Get the number of debug formats enabled for output. */ + +unsigned int +debug_set_count (uint32_t w_symbols) +{ + unsigned int count = 0; + while (w_symbols) + { + ++ count; + w_symbols &= ~ (w_symbols & - w_symbols); + } + return count; +} + +/* Get the names of the debug formats enabled for output. */ + +const char * +debug_set_names (uint32_t w_symbols) +{ + uint32_t df_mask = 0; + /* Reset the string to be returned. */ + memset (df_set_names, 0, sizeof (df_set_names)); + /* Get the popcount. */ + int num_set_df = debug_set_count (w_symbols); + /* Iterate over the debug formats. Add name string for those enabled. */ + for (int i = DINFO_TYPE_NONE; i <= DINFO_TYPE_MAX; i++) + { + df_mask = debug_type_masks[i]; + if (w_symbols & df_mask) + { + strcat (df_set_names, debug_type_names[i]); + num_set_df--; + if (num_set_df) + strcat (df_set_names, " "); + else + break; + } + else if (!w_symbols) + { + /* No debug formats enabled. */ + gcc_assert (i == DINFO_TYPE_NONE); + strcat (df_set_names, debug_type_names[i]); + break; + } + } + return df_set_names; +} + /* Parse the -femit-struct-debug-detailed option value and set the flag variables. */ @@ -190,7 +273,7 @@ static const char use_diagnosed_msg[] = N_("Uses of this option are diagnosed.") typedef char *char_p; /* For DEF_VEC_P. */ -static void set_debug_level (enum debug_info_type type, int extended, +static void set_debug_level (uint32_t dinfo, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc); @@ -3027,17 +3110,17 @@ fast_math_flags_struct_set_p (struct cl_optimization *opt) } /* Handle a debug output -g switch for options OPTS - (OPTS_SET->x_write_symbols storing whether a debug type was passed + (OPTS_SET->x_write_symbols storing whether a debug format was passed explicitly), location LOC. EXTENDED is true or false to support extended output (2 is special and means "-ggdb" was given). */ static void -set_debug_level (enum debug_info_type type, int extended, const char *arg, +set_debug_level (uint32_t dinfo, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc) { opts->x_use_gnu_debug_info_extensions = extended; - if (type == NO_DEBUG) + if (dinfo == NO_DEBUG) { if (opts->x_write_symbols == NO_DEBUG) { @@ -3058,14 +3141,18 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg, } else { - /* Does it conflict with an already selected type? */ + /* Does it conflict with an already selected debug format? */ if (opts_set->x_write_symbols != NO_DEBUG && opts->x_write_symbols != NO_DEBUG - && type != opts->x_write_symbols) - error_at (loc, "debug format %qs conflicts with prior selection", - debug_type_names[type]); - opts->x_write_symbols = type; - opts_set->x_write_symbols = type; + && dinfo != opts->x_write_symbols) + { + gcc_assert (debug_set_count (dinfo) <= 1); + error_at (loc, "debug format %qs conflicts with prior selection", + debug_type_names[debug_set_to_format (dinfo)]); + } + + opts->x_write_symbols = dinfo; + opts_set->x_write_symbols = dinfo; } /* A debug flag without a level defaults to level 2. diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.c b/gcc/testsuite/gcc.dg/pch/valid-1.c index d445c47..6e9abda 100644 --- a/gcc/testsuite/gcc.dg/pch/valid-1.c +++ b/gcc/testsuite/gcc.dg/pch/valid-1.c @@ -1,7 +1,7 @@ /* { dg-require-effective-target pch_supported_debug } */ /* { dg-options "-I. -Winvalid-pch -g" } */ -#include "valid-1.h"/* { dg-warning "created with -gnone, but used with -g" } */ +#include "valid-1.h"/* { dg-warning "created with .none. debug info, but used with" } */ /* { dg-error "No such file" "no such file" { target *-*-* } 0 } */ /* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */ /* { dg-message "terminated" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp index 1f60fde..bb0ce46 100644 --- a/gcc/testsuite/lib/dg-pch.exp +++ b/gcc/testsuite/lib/dg-pch.exp @@ -28,7 +28,7 @@ proc pch-init { args } { set result [check_compile pchtest object "int i;" "-g -x c-header"] set pch_unsupported_debug \ - [regexp "debug format cannot be used with pre-compiled headers" \ + [regexp "debug info cannot be used with pre-compiled headers" \ [lindex $result 0]] remote_file build delete [lindex $result 1] @@ -38,7 +38,7 @@ proc pch-init { args } { set result [check_compile pchtest object "int i;" "-x c-header"] set pch_unsupported \ - [regexp "debug format cannot be used with pre-compiled headers" \ + [regexp "debug info cannot be used with pre-compiled headers" \ [lindex $result 0]] remote_file build delete [lindex $result 1] } diff --git a/gcc/toplev.c b/gcc/toplev.c index 7e23253..1016fb9 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1461,9 +1461,12 @@ process_options (void) debug_hooks = &dwarf2_lineno_debug_hooks; #endif else - error_at (UNKNOWN_LOCATION, - "target system does not support the %qs debug format", - debug_type_names[write_symbols]); + { + gcc_assert (debug_set_count (write_symbols) <= 1); + error_at (UNKNOWN_LOCATION, + "target system does not support the %qs debug format", + debug_type_names[debug_set_to_format (write_symbols)]); + } /* We know which debug output will be used so we can set flag_var_tracking and flag_var_tracking_uninit if the user has not specified them. */ From patchwork Tue May 11 14:40:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1477169 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=hq6VGcEu; 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 4FfgZN5zM6z9sV5 for ; Wed, 12 May 2021 00:40:28 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B674398B16B; Tue, 11 May 2021 14:40:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B674398B16B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1620744020; bh=19rFKdG1tAS8OS0OPwPNDf7gfs4FqXabPktmAZmoNl0=; 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=hq6VGcEuDrUhr0Pvl/Yo2Y0EDCdTB6Rcf7/PbwTUTQfAqlkb3GL1v26sdmWu33SmW QQIahiE+6O9DXOsKkKn2tiWojCJ/VwcAQo14/gJ4U7Kk0XL196uPwASreOOlei5dJ0 IErArQBl6l81gqXaZnizZpV/mupqh2qDakpmmvCc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by sourceware.org (Postfix) with ESMTPS id A6F643982076 for ; Tue, 11 May 2021 14:40:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A6F643982076 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14BEY5lN154594 for ; Tue, 11 May 2021 14:40:16 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 38e285e7sn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 11 May 2021 14:40:15 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14BEZrbK004731 for ; Tue, 11 May 2021 14:40:15 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2042.outbound.protection.outlook.com [104.47.56.42]) by aserp3030.oracle.com with ESMTP id 38e5pxc7j9-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 11 May 2021 14:40:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=md5VWYwpIjeHsJUY87OJlXoSMLzLA8HHwkijt/N87KmKdsYu8jV1BbIzpiMLeGDP1m9AmT2dvL+EXYdmlDdGfUoT6RM+uC0QiQA1yiQpVHuX3+/DE8oRGu9Syg8EEgk871LyPQrTJXGPNEKsssc7NK0QN2er3iNmaQ4GNumANqwvpd9IAzxVjYzdyvgX1QuXZh6S1PA8fA6Txab9HNX7fkvyTtYg00UZ1x0FehTE3iCgEXgdwkf4UpKSnS+8kh2vVM8vSuh9UrZQxFTXPy4zGWRsMnaV/bdzR/QRQOZsEQorQNECviDxi4W4STEVvrlxj9zFZUd33egOumHsiqD2/g== 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=19rFKdG1tAS8OS0OPwPNDf7gfs4FqXabPktmAZmoNl0=; b=ZMbdlgriHA7LEhhn9YS9WfxF5X0Z9aGOBtLNk6azdCW1E5sZhBR+/O/2fkj96TsaZn3Sn39AN1mJB6w1ys2CJJdEkSJ55WBlKNX1AfC7NsYbC0xBw10ZxXWG7mPm5mt76UAxwqkoF0AJ5iOT5Iek2VxPpF1sg2mdTupiqAULXX6wzUc2opZsGxBoYEAvYaOWxoS4TygMNxxGhqFWVpDvL0Ji4gSi9SP+MjwEP3bKcHg0PLHdnnVLPV1ycmUzK77uFRMdK4BeFuMkEfJ8Ql9jEM90j7aU2BfUyO49aypscCV+7NzMMVBLy72nSA/zZGRvHx31acIZ0XRTf1vksGdCDQ== 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 CO1PR10MB4449.namprd10.prod.outlook.com (2603:10b6:303:9d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31; Tue, 11 May 2021 14:40:11 +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; Tue, 11 May 2021 14:40:11 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH,V2 2/2] dwarf: new dwarf_debuginfo_p predicate Date: Tue, 11 May 2021 07:40:03 -0700 Message-Id: <1620744003-12647-3-git-send-email-indu.bhagat@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1620744003-12647-1-git-send-email-indu.bhagat@oracle.com> References: <1620744003-12647-1-git-send-email-indu.bhagat@oracle.com> X-Originating-IP: [24.80.24.133] X-ClientProxiedBy: MWHPR2001CA0008.namprd20.prod.outlook.com (2603:10b6:301:15::18) 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 MWHPR2001CA0008.namprd20.prod.outlook.com (2603:10b6:301:15::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 11 May 2021 14:40:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ea50428-457b-4dd5-c68f-08d9148aae54 X-MS-TrafficTypeDiagnostic: CO1PR10MB4449: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Hx2jgrnb/KTEZMWFVbT6S6FFPcT4Rcjnxbzx+DRGnso1mKSirb834IfYJWki9YdQAn48ukKmmvtYB8mObQXcyNgLYtMCyaTdJnK9ynscv4+QlZS5/EQ35uk5zhO6DT79FNbr3zc+cwhtboOiYGbs+GZodwCnUBNGNqVAPXNYj5aQn+/Ra+b0Et6+7ayeHkvR9qenbgoxI0UqlHKt05HnIkTgCvdoC1UK2bTSCFHaixotz/vrzkJfPiEPL+DYA1lqIWBvJvCmnDg+4CB2dUj5gNi1n8Gn+tHQscmemgJcdPGL9BSZAQnqQcixtP5dEV55UFcN1l0cm0xxOF68FV+9SjndjrZ9UvZhXSGDZbHK64AadNi+P6Cwfz6+em/io3KnKCUkB5bgvQUh7CsvRlJncSuIVjL7NKE/FPL4dY35nvxGBB/gyh0sLM2BGHC+gvDmbgD/Esqx9ozyMoS2TNzy2KDchn/DVK+vZbgARyLqkqAXlmxpIR/VHMAX9YF9voM7cRlawGGCtnqQJpvdqnjpA== 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:(376002)(39860400002)(136003)(396003)(366004)(346002)(6486002)(83380400001)(6666004)(5660300002)(30864003)(38100700002)(6512007)(38350700002)(66476007)(66556008)(316002)(6916009)(2906002)(8936002)(8676002)(6506007)(44832011)(186003)(16526019)(52116002)(36756003)(26005)(66946007)(956004)(478600001)(86362001)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 6qUhlKM6VHEW+Lt/XXb093pbmHSXcAWEXTz/i4bNExiiDyvMt/SGICipwwgyOl3QzhSNVMgfd74tgL/moQRPZhbonFcfaaN23BHnvSEynJ2wAXrl35WHWHF1Wa2456L18iAAs6QGX+TEVTKiBaxSU36DqHvnOv/Gg1R17WrGVzd5R1Msy2QQl0LmvFqs71WrOsClrmeDQjZdqTlSpzKpb38nvI0rY/SaPkfRsyjOc/dTna51O0nsKbOTZEq/JM+oWx3aiapkotHKkc9SeUE/qbLzIVUpqeCorF54S5kY8CWGGrs15VgjU1pO9SPmX7iuGQ3WN7fmPw9zquLbT3PO3p6KwdKma8hi+GQthYbLs/Tar27yIp3HsyAu5Q6Kridy5a9n7DH+6Mz9kcOPfzR3unj9HhPMZXq6DD9UP46/oyVWiwS0ZkWMCenNePsA8AjBMPaSVq6wMlc5jE+QIhSo2L2NZzuc1kWAzVJosReJb4FovTRBlRr8tHgP9CmUo+8yrqyNgnUxQ8k1dakZc8AsQfwsp3tXaxGCaahEZ/qBMA6Won8f6uiNgkdXOvRm2NGXYnK2cL48rRMYfJ+i4aaR/DLfOeEr+UCVYxBHCM4ypDPqCLLX7r8sZ3AjHFtac3qgwY7WJ+UyxOKvojk7ml7mubJLiI2AVV9A8+Dr5cX48mmYxQEM+t/dMOa1IS5H+2LAni1AFcpAm9k+6osb4zZCBpx5MIt2xIk7DlF1xXPWSgz9MHEIxiwthxy1tfi9lUujvNok9/274hu+XDsfIm3LtfH/q75kjQ9S4NcdymL0+qtkFY2zjKSyKxGr79NRPYCswt9GJIBkmnDi0TlJjh3OQIvkdzrWckVDv8QGxsYHLaYUzxkeHu72tTmp3Kj6X1xOV3dH9WMHE4ybA/XZkzCRLvssV4BgQgEaDU+S6UT/inhAzZPaMoGzJFGSmgpNIdKnHX+mnUbh3zkPlk7mCy/5EEgjt9L9RWMXYk091eb9lW2I89QlqLBxU8N6SKduj8fhTLxGVGBgsV53EsRAjM4M/xvtf4qG9BondGQ6w7jMpRMB8V+P4k4IhrtI80q7Lx7zhcyFqM4E19h6TBrz8mpTb2jLJ4Fts6lHKe0Qqi2Amm1HPzCHczaYpGFlAMnORS+yn8ZjizuJ35TTdB1Sw/1IbYVIM6TndrcAO6FNtClX5MsI7lJ3Ulh+TTlEV5Lmu+FGjqSZanVouKpfO+mFP8gqY4P3DWltUqjTsnJ7krPGIdG5Tf8cwgsOrJZzuFF9yeAA1bAd7J7LfC47oa5xO0HIwjpCDH0TxDFCltytdd7mI/yRE1xk7Q/y/1gS3sqAdw1H X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ea50428-457b-4dd5-c68f-08d9148aae54 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2021 14:40:11.3828 (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: PRmrbFl1LNMyI3F0b2CXifOk8urXwBF2/Y7eqpaCZQudPqtyQs5DKAuI0Biw87/lW+xKv7v0A/ns9u7+m5SF0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4449 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9981 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105110110 X-Proofpoint-GUID: ZjxQghX9lAt4-YLwugimJCOr8A5GSO8Z X-Proofpoint-ORIG-GUID: ZjxQghX9lAt4-YLwugimJCOr8A5GSO8Z X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9981 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 clxscore=1015 impostorscore=0 phishscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105110110 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, 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 V1] - included checks in - config/darwin.c - config/i386/cygming.h - config/i386/darwin.h - config/mips/mips.c - config/rs6000/rs6000.c [End of changes from V1] 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. * dwarf2cfi.c (cfi_label_required_p): Likewise. (dwarf2out_do_frame): Likewise. * 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 | 3 +-- gcc/config/darwin.c | 2 +- gcc/config/i386/cygming.h | 2 +- gcc/config/i386/darwin.h | 4 ++-- gcc/config/mips/mips.c | 2 +- gcc/config/rs6000/rs6000.c | 4 ++-- gcc/dwarf2cfi.c | 9 ++++----- gcc/final.c | 15 ++++++--------- gcc/flags.h | 4 ++++ gcc/opts.c | 8 ++++++++ gcc/targhooks.c | 2 +- gcc/toplev.c | 6 ++---- 13 files changed, 35 insertions(+), 30 deletions(-) diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 6374b72..5174b22 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..a10e2f8 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -439,8 +439,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..b937914 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -3348,7 +3348,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..f460ddf 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -9489,7 +9489,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/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/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 026952f..3e0b046 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);