From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 657D438133F7 for ; Tue, 7 Jun 2022 21:44:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 657D438133F7 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IJ1pN018341; Tue, 7 Jun 2022 21:44:11 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gfyekev1v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:11 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257LeXJx038763; Tue, 7 Jun 2022 21:44:10 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gfwu2xj98-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TQW1ZhMtQmE4dCkON2nSujKUUBjF5LU2ri+Og0CuxOp1OWPHt4J2RHnV3Zj/tloHO1X3uNKp9mta/aOmQ2ArxkMvgTmjxdN/50qdbZetu0zTk+siYV34C8TqfyMM5bntvyNrZGWWrooNVLW484cFr3iEP31Rnn1Zw2I0n8ST8kpKrgL7XksrmsFEw+mXvh34/+x+0q4ElidQ5WazVKUOyvBcr4LRYhLW/6XXQ1/8hPg6940GLt30D4myFdgLra15hLgruHUC62pOAUGNMmHlh8tOu4z2NG0T0WzZ/K9EXlMORM84odr/h58b4dkQz+yiz7qCpjhyiKtgxR8jSn3WuA== 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=5HGQ8rPJF4I38B/AJ0MiETorQOI+qENQDsaU0tZTWMA=; b=aBzr/KjVndNmEOn9Hu0BuObmkcNtghzmPs84OjHKJvij1JfnUlB0fHQzE6BUB5OgtkBBZP+L9asZVFXC0HN8zjh7EXRP+e8cEoWdRdDlm5gAHoeolV2tpIxJvlMUEf6N36881XS999YDylhREpELS5pFSMZipW3SE0fap9nAWO4tECc51Hn10NiU0L731eeeHGdUuafTuh/nOCQvBSnp9LqSIC9OR/cl/CurWDEdayax6FO6XP/5nXHOaxczG0X/18W4NBeH/MwkzVrT0Qlxmt3pDQtTkZL2bqA/rqQUaZZQCdZNINVtjjiP47AOCthZy8FKDrpraYKaSKTxHCprpw== 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 MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:08 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:08 +0000 From: David Faust To: gcc-patches@gcc.gnu.org Cc: jose.marchesi@oracle.com, yhs@fb.com Subject: [PATCH 9/9] testsuite: add debug annotation tests Date: Tue, 7 Jun 2022 14:43:42 -0700 Message-Id: <20220607214342.19463-10-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0178045-991e-4903-7928-08da48ceda21 X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0wkcdHag+bGqxMaYWQNr1b9M6h6KfG0CKdyC0dNEFaQ7c2XN8NaD88uym9E2RbNCh07AKQDrj1MDSrh9K4OHFxD7wMHLOIBaNxGFEiiIuVbcjmErNLqXSvIEBh2sWKA16Kp4vrugSt0WjiI9IG4jWljuWMh2U5YLZ1LqQBzKqBRpiBIwHp5ON83sxBhtiU8ZyijogulOqJ46JOjKIycoYkQFzX6RGm2VhYgSJ8UP+h2jTwOSlu5Qw0NjopLrobN3eaWF7BdqY+YBMvvw1A5W/rrmFFWRvRIQeiN0F5dp6u2hJenba5TWkYswc2zvW2z+DKCSYFNjWzQcWPmCgg8ygQabxSh6FHkZAp/rX8tUOtMB1eihqYiXjvLKI84tZ5oNCPm8TiB80ubk6YDkVfx+3ZVSa3dlgHncHXBGij3UWq9nOwAxJ0be74HKXpF0dzv1F1BlZ93Muu8dqnsTuv0qD9qnQ5x+EtN9jk8mdk116JD5ad8Y8xRS+Trr1f9NwceeciYRECxjdjgfOzx5Kjum3ZGZTII54onIkPb9pV7VprXvrQ+hTgPpKgQ0zpX12zdf4etmSrGg9pP8OZy79ghTeI3wFY8FvSWgX6hzDTiV4vtCk8D2N2vZk8rWpNuWH4dySxpzSzp1g1WNhUjV2lSlmbVdR2VPmqeZortn3MN6w6SK4TETearrSX4MArXnFflnimdDCG2gBwN/Op0HgcuGp4PLWN6f8YVi5EKwNTh4awlBjlyd5Ek37nlV63ee9Y9mrB4RyCZ1SuEW3ZfkYYUpdA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(83380400001)(30864003)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(84970400001)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?qx/2X5QY5/0cv4X6pv9pCW5NwMY80mUKtOn+3mHKHFbU/rx2ejzwbAo8c4si?= =?us-ascii?Q?czXTOBxgRLork+Q57dQPz8HQtW/C4JL9AflwlEekyWaUhGnNtJnIKPKbysnc?= =?us-ascii?Q?2xILovUNh3vqKSwggxyQQdrgyeJO5IcSOFImmc7l/Fje1eAaSTVaLqdfqc1m?= =?us-ascii?Q?c2nyggpRSuR2TJG1rfG9Ymj+Od54FJEWlwojHqWDoUavE2a9IaARS9DIDce7?= =?us-ascii?Q?AEsxbcN0913Frg8nfbHof2pt6g4tNj9PutYhf4+9WpRv22opVrHRe53QjXvq?= =?us-ascii?Q?kfp4SeJhsTEOJz0LaRotxTii3CJM265pLTpvO2hmuAPqqCgkRBFZMFnHlRRm?= =?us-ascii?Q?7SOqzWzv0/BxtcayREGq5/J3j+2lsfdiUtEqKiljd7LgygXWt3bREEbjsXLD?= =?us-ascii?Q?46028CsJu+yD7mTjZW223gYEzEvbPkkiUpLX0BPsn3VaYB9ZwQmEnC6BSRiF?= =?us-ascii?Q?AZtC90+sU+dcm6ywdOZlpMzHltk4mfwwz3xSDYtiomLFMmm1AgAwpLULeQZo?= =?us-ascii?Q?Ay8OFXPAzGH/xwJ+XYrsPjr7copcY3LfaO3kI+T828wGWlxE7wmQPz9Adw+N?= =?us-ascii?Q?NuEZyulVcuZuaDRUBkUPeV/Y9bC5WccFPDYBccY3CIRNu6oCh+ob2Vxjp4Hr?= =?us-ascii?Q?2H8OYdS7x3BQhB463O/oEG5QUIPmkCXuBVUaQL++ynt9G6TA1ZUCRwjDP+Eg?= =?us-ascii?Q?jsTX51Jg7FXuBJSaRoxLtUWdS7BJNT7j8OilM5MZQiWcvURD8oAkGenbZ6RP?= =?us-ascii?Q?UEm7EIeJwHha4ywYnirhd5jEtSefj7PrFNZWC1LW23zPKwmPzQoM1okKzKyC?= =?us-ascii?Q?K/QnMUls+8iFDcmc3l8H4WqnhsH9nI2fn3xjMtcs9sCiGWc3ym7T8DScxrvH?= =?us-ascii?Q?K6I4AG5l6oSw1mwPBNhTHD50FM+u6iwTwvfuUkezmSW9iIXPA3cOPMvQGgRV?= =?us-ascii?Q?eZB6iI3mcbNoHE+MBKgCazX/U7T1CVgs3uXjJCOxoM6o8RHx1KxNAerfWkEN?= =?us-ascii?Q?gcIBOca1EoK6+716goLLkLs2Cje+H/xligMNYtxbOeG+wienLgdbP5JrB6U+?= =?us-ascii?Q?q12/c0HU3MOPiQSOCojk0gcGvWk7fAqRCToPGMMMqYDcFeTiXCAp1JZJ6MvB?= =?us-ascii?Q?fcNEP5gdCa2UzusU3PdfAFhFIED5AAcd3gKS2jLbTMCJfGs9oBFqgtaJDQ1X?= =?us-ascii?Q?jjS9iX+Raa7jCy8WDF7gg4NSCvS7ezWKX782nwIiwXoeeCtmeoYgfxNqmtz1?= =?us-ascii?Q?Jbhy2WD3N84WLS8NleFx8zeFRiN/T5nfE8Pq4DBlHrIfWs1Dsj8WK7v+gX/l?= =?us-ascii?Q?yWbnM3rb5KI9DM5MJJBHfv/N27k4daC0Sg0WYksy/yuTYZ5sp+XGA5CXFwmZ?= =?us-ascii?Q?HpbIChRYR0yz7aLkciBt7nS0ATqObV4ab7mkaGjt5b5c58HOYAW19rGdD85+?= =?us-ascii?Q?nS8aeVEbzHPSbf9vXLKQGLgZzEQPQNd3SjiSm7KCZqV/uYFiI+ONHyXjHUbB?= =?us-ascii?Q?btHlJpQbp7sHpI8H9FhD3PhFpimcpTBOEoLyLX3ftvu98gv5VXX6oscqN8vi?= =?us-ascii?Q?v6gqi3D7vDlYXpvr/FXHGdZrlEnlvOkfQesQttBMY6cO95GdQfPTiEpTfYfR?= =?us-ascii?Q?AWkYwWi2XvCwQPWPxUOXL+olRjfyJojFXmUHcf1rY+0I5SCxZY7wCJNFIv3j?= =?us-ascii?Q?AJGBBbfGPJQcyMpIicW+lizcDyQFW3fPDqjJglLE5SREIkcuDJPz3OMVpoDQ?= =?us-ascii?Q?qFYZDWtOJ9xanRhqTvgqy5h9Q26QLulYeZsY3pWAvlDg2p0vTw89?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0178045-991e-4903-7928-08da48ceda21 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:08.7998 (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: PFnVw584CE7ZaWVsXXUaEgFTP8fxHbRfJSJyYaJAOcOzhStIHvszVU2oh7502r37NQd16795qnX5hqwQEmE0jA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-GUID: wR66b2WxRwrCTGNI17uTCHOd8ojzQaFq X-Proofpoint-ORIG-GUID: wR66b2WxRwrCTGNI17uTCHOd8ojzQaFq X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: 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: Tue, 07 Jun 2022 21:44:14 -0000 This patch adds tests for debug annotations, in BTF and in DWARF. gcc/testsuite/ * gcc.dg/debug/btf/btf-decltag-func.c: New test. * gcc.dg/debug/btf/btf-decltag-sou.c: Likewise. * gcc.dg/debug/btf/btf-decltag-typedef.c: Likewise. * gcc.dg/debug/btf/btf-typetag-1.c: Likewise. * gcc.dg/debug/dwarf2/annotation-1.c: Likewise. * gcc.dg/debug/dwarf2/annotation-2.c: Likewise. * gcc.dg/debug/dwarf2/annotation-3.c: Likewise. * gcc.dg/debug/dwarf2/annotation-4.c: Likewise. --- .../gcc.dg/debug/btf/btf-decltag-func.c | 18 ++++++++++ .../gcc.dg/debug/btf/btf-decltag-sou.c | 34 +++++++++++++++++++ .../gcc.dg/debug/btf/btf-decltag-typedef.c | 15 ++++++++ .../gcc.dg/debug/btf/btf-typetag-1.c | 20 +++++++++++ .../gcc.dg/debug/dwarf2/annotation-1.c | 20 +++++++++++ .../gcc.dg/debug/dwarf2/annotation-2.c | 17 ++++++++++ .../gcc.dg/debug/dwarf2/annotation-3.c | 20 +++++++++++ .../gcc.dg/debug/dwarf2/annotation-4.c | 34 +++++++++++++++++++ 8 files changed, 178 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c new file mode 100644 index 00000000000..b2d6820cf23 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c @@ -0,0 +1,18 @@ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x11000000\[\t \]+\[^\n\]*btt_info" 4 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xffffffff\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*decltag_compidx" 1 } } */ + +#define __tag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __tag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __tag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +extern int bar (int __tag1, int __tag2) __tag3; + +int __tag1 __tag2 foo (int arg1, int *arg2 __tag2) + { + return bar (arg1 + 1, *arg2 + 2); + } diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c new file mode 100644 index 00000000000..bb125b53ce7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c @@ -0,0 +1,34 @@ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x11000000\[\t \]+\[^\n\]*btt_info" 16 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*decltag_compidx" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*decltag_compidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*decltag_compidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xffffffff\[\t \]+\[^\n\]*decltag_compidx" 6 } } */ + +#define __tag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __tag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __tag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +struct t { + int a; + long b __tag3; + char c __tag2 __tag3; +} __tag1 __tag2; + +struct t my_t __tag1 __tag3; + + +union u { + char one __tag1 __tag2; + short two; + int three __tag1; + long four __tag1 __tag2 __tag3; + long long five __tag2; +} __tag3; + +union u my_u __tag2; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c new file mode 100644 index 00000000000..6a44aaf9623 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c @@ -0,0 +1,15 @@ +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x11000000\[\t \]+\[^\n\]*btt_info" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xffffffff\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ + +#define __tag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __tag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __tag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +struct s { int a; } __tag1; + +typedef struct s * sptr __tag2; + +sptr my_sptr __tag3; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c new file mode 100644 index 00000000000..0d046265b7a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x12000000\[\t \]+\[^\n\]*btt_info" 4 } } */ + +#define __tag1 __attribute__((debug_annotate_type("tag1"))) +#define __tag2 __attribute__((debug_annotate_type("tag2"))) +#define __tag3 __attribute__((debug_annotate_type("tag3"))) + +int __tag1 * x; +const int __tag2 * y; + +struct a; + +struct b +{ + struct a __tag2 __tag3 * inner_a; +}; + +struct b my_b; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c new file mode 100644 index 00000000000..f6f305c2739 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __decltag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __decltag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __decltag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +struct S { + int a __decltag2 __decltag3; + int b __decltag1; +} __decltag1 __decltag2; + +struct S my_S __decltag3; + +/* Verify that we get the expected DW_TAG_GNU_annotation DIEs for each tag. + Note: one more TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 7 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_decl\"" 6 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-1\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-2\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-3\"" 2 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c new file mode 100644 index 00000000000..04628fb1b81 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __typetag1 __attribute__((debug_annotate_type("type-tag-1"))) +#define __typetag2 __attribute__((debug_annotate_type("type-tag-2"))) +#define __typetag3 __attribute__((debug_annotate_type("type-tag-3"))) +int __typetag1 * x; + +char * __typetag1 buf; + +int * __typetag1 * __typetag2 __typetag3 g; + +/* Verify we get the expected annotation dies. Note +1 TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 6 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_type\"" 5 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-1\"" 3 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-2\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-3\"" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c new file mode 100644 index 00000000000..0548cd52d6d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __decltag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __decltag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __decltag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +extern int foo (char a, int b) __decltag1 __decltag3; + +int bar (int x) +{ + return foo ('a', x); +} + +/* Verify that we get the expected DW_TAG_GNU_annotation DIEs for each tag. + Note: one more TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 3 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_decl\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-1\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-2\"" 0 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-3\"" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c new file mode 100644 index 00000000000..9d2b3ad5c00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __decltag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __decltag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __decltag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +#define __typetag1 __attribute__((debug_annotate_type("type-tag-1"))) +#define __typetag2 __attribute__((debug_annotate_type("type-tag-2"))) +#define __typetag3 __attribute__((debug_annotate_type("type-tag-3"))) + +/* Note the decl tags on these parameters will not be recorded... */ + +extern int foo (int * __typetag1 x __decltag1, + char * __typetag3 c __decltag1 __decltag2); + + +/* ... but here they will be. */ + +int bar (int * x __decltag1 __decltag3, char **buf __decltag2 __decltag3) +{ + return foo (x, buf[0]); +} + +/* Verify that we get the expected DW_TAG_GNU_annotation DIEs for each tag. + Note: one more TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 7 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_decl\"" 4 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-1\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-2\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-3\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_type\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-1\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-2\"" 0 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-3\"" 1 } } */ -- 2.36.1