From patchwork Fri Apr 1 19:42:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 1612395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=BtMc3Sgp; dkim-atps=neutral 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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KVW4842rBz9sGG for ; Sat, 2 Apr 2022 06:50:32 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B844385E02F for ; Fri, 1 Apr 2022 19:50:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B844385E02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1648842630; bh=dJ/x5ECBlCTobbCoEyy0aQ0oPE42+uBFsNdtRM9QD/I=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=BtMc3SgpMnzjUFwQr/TFk+eXdTdahV3PUlnt/9ejZPMrZtAWtKtUKFdpe/i4H2AG+ djbuzLjsK0XQKL6/XlLvAIGv29yrA/IqLXuz5c3IztRol8M/mlLuJsCuUXODXoYp8A 9E/Ty8oixdvEWmWRppHtV11bAUNDVWsHcxfQc/og= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id AF1603839400 for ; Fri, 1 Apr 2022 19:43:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF1603839400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 231FvH4e018522; Fri, 1 Apr 2022 19:43:07 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1se0qw7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Apr 2022 19:43:06 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 231JfOLv037445; Fri, 1 Apr 2022 19:43:05 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3f1s96afrg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Apr 2022 19:43:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=baMjdxoFTlLEQfLhn0n0KT51ijfbTESOHmfRrmHCV3d6PN4tofrbuSAbNOBZ/yuQ3rikp7BbegET5TpVlxwlr07XgIxsmG6yOBYXMte3I/9G9MXy3u1hT21vTzkIARFJ0xanZn3OUu0oWa5y5XemZrlAcI7ObCl0iNTzfgG6vVs2bPvn3uuxin12pIvlK8yAH7I27EwWo928zP1Hmq/BD3uacMXEG1aoE5Lm1OzpJfohBxMnrdSwokwmOWBtVyRiJEebvX1cOddl6kMvmJK+jWSNjBuu2JEgpY842urK002tF8RuzQrNwtBufPGWx2zNJtDm+4y1DpgoHFnm7cVodQ== 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=dJ/x5ECBlCTobbCoEyy0aQ0oPE42+uBFsNdtRM9QD/I=; b=jlx4HmoHkNhPKewPnpVER35TxyYREtTPbD5B6LyIjNR0MrYgQ2OqrNL8vWOROJwOXHzYreC8JV5LYuQGvPNdpBhyGcp0LzQ9DE8JrRn4M2rzAwVYDwynElxnSwAYFkqT5LXI9Z83LWzl+dF1Rz911Fz34VPA6S8vY8VG1vGmHlzDJXYkBxM+xvpVlQk2AqzFucbYHYyVDrjsy+Bo98bIDC3vCTBiDFqddlxSnSncbVzuO9LRrQhfTx8S04PLAAvgkpab0x3Yu3V+1WetDJxkd7vaxURvQ3bLZgO5b72McfWGpRKrDRRnK8woCM/7BjjAQMtKIdS3tOR1LUMdsHjqGg== 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 MWHPR1001MB2286.namprd10.prod.outlook.com (2603:10b6:301:2d::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Fri, 1 Apr 2022 19:43:02 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::705e:a465:c30b:fec6]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::705e:a465:c30b:fec6%6]) with mapi id 15.20.5123.021; Fri, 1 Apr 2022 19:43:02 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 8/8] testsuite: Add tests for BTF tags Date: Fri, 1 Apr 2022 12:42:16 -0700 Message-Id: <20220401194216.16469-9-david.faust@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220401194216.16469-1-david.faust@oracle.com> References: <20220401194216.16469-1-david.faust@oracle.com> X-ClientProxiedBy: DM6PR03CA0052.namprd03.prod.outlook.com (2603:10b6:5:100::29) 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: 25db7d9d-dfbf-443d-46a4-08da1417d585 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2286: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: /i2/muxIZmfMoasrFYlR+jMKMpit7pNUlsrqZYjgidWR3mjQwst4Spw+NSho4IxHZ5k7AQxHc+5uPbSvFWqCYUwNhS8PW+E/SKn/o0XPzHL7XgHRXZHQxC9ymOC3UpLb87+J7f8TXOVQvQpHl+llQe7T3ImrSsa/9sOwfqsqvWKy4vwciLNz43syl5Tvx6jevlB5ZqBSt9BzekQMIZYImSCxg+R4f81U+yErg4+bEBDscBilO1agv4l4tsdUOpQnNWpPDUEL2SQyvEH1dyV24429J5OUyvL+cSwD+NZEcsuv4sGWeqhM5Hv3WneZTjaCoQp/hz8xdzduK2bRb+69wiKsNDPjPdGJ+E9btDYWfxo/lmCwfhcBBTib7mJmzGpyt9p+JVUDGcKJFaCNQzQcoqdrdVA8UZ2mlhLeW+1Hd+wCdnMAnG0pOfvXlQne5htXHbP7ibkSfU1NDrp4YZyHKQqHUVaz04wrsn7YqTVivNEZ4aYtgf8lDIqhO38GVp3ep2jXsB4mLLTWivvuywbHFy+lur2M7kNKlANzDZkxanWUnDsNR6uPxpDy4SjP5xZGUrIPyjs4tq1YFF+7sObVJrU7Ibl3HLqVPGdqRqsXwj0ZnJKGrUwGV0QGDNhSnkjtlMsKhMfcVscgXcwpcvGSJUh9BdKPi39MTyS4p8IYXht7RqeP3fZ28ciIbEzwhWLusYeKxqaeM5LrarVOhvj+tPjahqqXfk9z0Va+ykUHYP3pRnFTO7nrChnD7rXlpRVXr4XI1zYgwrnW6nAU2w7DRQ== 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)(66946007)(6916009)(316002)(36756003)(66556008)(5660300002)(66476007)(508600001)(38100700002)(86362001)(6666004)(8676002)(44832011)(4326008)(8936002)(6486002)(6512007)(107886003)(52116002)(2906002)(6506007)(2616005)(83380400001)(84970400001)(186003)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gQzr+1lgYOmw02ybN8eLp2ZT9+TxupOS7mF7V8K+XSa5S3B22if6SE1JMl0lI/azYZkDD4IqWxX1JhhaHekJu92PlNshL5M4wMrWWaIEGqYI24XQVyPIVVX03co2038byQ7E7dNxr58EC52x8kdoGcFBX/YxqR2WSGCMNoPBMPj3U10FbllosYf4ThaJNvxXQ/VNO0IOtj+NvETv/QSfkTkHgGvfMdEyJeAuQiDdjTaJdYqRe9M6gUnn5Pore/tEdhOZVm2C4nw6SLRzIkOU7o/YrfzgGQmiZo9hJYMTgt6eBafxT60T5PR3OmefcfTH2uZHrwQW47zlolttWwS249tbOiDMx1RP/nGdKuNlUpG5mSilriLxIxSSXHo29LEpndIZ7JHHA2N9Y6sFPH4v8EbyHtXWQqv31wVg6bHmIhWSrkV2FdJM1GHvKETBUUM9SiFjxCVPWtvzim4zGT754SNUTeoUWk1tzNAhEPrKJBT8s/ktNRuOI+tAmMpkyYdtCq5Pfn5frHXF7B2RfxFh9jCQP6aDqMzu7MzX7j5E2Gzg+Dw79yCsqwZ1Whc2e4lTa3mpMqfcsaQRFVPK7KNJ8Ddgd0CVTw7BZltYRBW/AMJtAtDRh6aJu8sw75LtnYpGn2vKYA160nEcGG9lNszY5hZg6Rz2XDF/ID2EocjfhvzvKrYddQF9f3zBTcx4pAvciDni0MfUE90zjG/xcqZW17UREFoNGlaVZM1x9gXmfx04vtqC1Cvy5BVGxtLyrgT9VfF3lUm9lcoua4MkHlH4kCyNiMVlpDDwhOEoKPVDF6+ngm2bRdPUHSijAIy+wD2RO0ueD2pHtSMil+WVMpFCiSc93HOG/HczuFLcJdKQZfKGPVICP3Q50vHUks23pwhU4OW555SeK6koW1F23AU1NWHBGWnxxd+UGlnu1Ukh5raS4C7CdfEQr77NnpNd4wPa9oDgZO1emzU2JZ6YKK8CAo0I6W/0y+blxsx3Gm0iwZOe4oF8n9C0XQIvVYE/JKuzIIKLlNs7QLpCZ7LCX0CwCIwYoDbicOQeH96ylsdI0wNo2QCOWRq09ZYYlprK6Pp0gbIDfC2mR9u78nKeax/n8UnrIpsuCq3O4M0xPw2PJqkEsN4qBl/c7X23KycpB67zcdoZS0S2+LpuhiYTITWw729ou+AzGlhJy3IWwaXV3CUJgSNMmPF2/cEKS/a3qaTIit8YHTSwrBGqxutWT96UFXSB8M4Edtd9B5egUIMhx+jPYv3Y/y2aQtKBcm7ufunk2tRxCryNr0g08Xamo+MMiVtpWfFfysktve7GRCzRbUG71vDKqWDSKP6IPkb0gMIg9Du5OGKT/oEGOmjTE05AjuxD7ZoWqxBMBdsSXDU9NDhHUhDP4GpIQA/yQsqWIu8WQIEQV/CpESHAPgJANJJfYVagA6V4UCjAstX//FivtKsQB2apzgJoQYaHahmubGn9y+80pj/wJx/SxRpw0Sjm/paFAQJglioP1d2M0PPi7pHF5exrvPcViMhJIsglrw2lBKPVJqPikA3qSKAcqHbmFZ+pbgaCMrX/C+eAYbmGwE+Zgd8jMImyEwhZxeaZQf9M90LF5IXKOJi8FkOhmGbJe0RPi45ytz54ECfj0eE7v0QhCRFOS0siL2Rd6YeeCqGONwUA73AUR6/mVw/g2S+adw7zxCIV3Ssq50EovLz78+iLQK0KyPyN8JKNsyW2d8O9QFEzHHupIIxj9ZGdbZn4z6rXjmlBg5z5d3eXF+ux+MSHOkoWrIVWGtbFoBDDBn9f X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25db7d9d-dfbf-443d-46a4-08da1417d585 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2022 19:43:02.6837 (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: xo1+QVEfRtXNFLI7tL1p/Uoe47vItUk98gGwdhEJ7uh2WXMCh48bNDtvuDGyBhhRAdH30jca6ZYdjWriweqs1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2286 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.425, 18.0.850 definitions=2022-04-01_05:2022-03-30, 2022-04-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204010093 X-Proofpoint-ORIG-GUID: gxueA8lg2FOOVNYRs9eylRWjMdHlu-7Z X-Proofpoint-GUID: gxueA8lg2FOOVNYRs9eylRWjMdHlu-7Z X-Spam-Status: No, score=-13.7 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_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This commit adds tests for the tags, in BTF and in DWARF. gcc/teststuite/ * 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/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 | 29 ++++++++++++++++ 5 files changed, 116 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 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..aa2c31aaa32 --- /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__((btf_decl_tag("decl-tag-1"))) +#define __tag2 __attribute__((btf_decl_tag("decl-tag-2"))) +#define __tag3 __attribute__((btf_decl_tag("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..be89d0d32de --- /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__((btf_decl_tag("decl-tag-1"))) +#define __tag2 __attribute__((btf_decl_tag("decl-tag-2"))) +#define __tag3 __attribute__((btf_decl_tag("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..75be876f949 --- /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__((btf_decl_tag("decl-tag-1"))) +#define __tag2 __attribute__((btf_decl_tag("decl-tag-2"))) +#define __tag3 __attribute__((btf_decl_tag("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..4b05663385f --- /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__((btf_type_tag("tag1"))) +#define __tag2 __attribute__((btf_type_tag("tag2"))) +#define __tag3 __attribute__((btf_type_tag("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..543cf771f92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-gbtf -gdwarf -dA" } */ +#define __typetag1 __attribute__((btf_type_tag("type-tag-1"))) +#define __typetag2 __attribute__((btf_type_tag("type-tag-2"))) +#define __typetag3 __attribute__((btf_type_tag("type-tag-3"))) + +#define __decltag1 __attribute__((btf_decl_tag("decl-tag-1"))) +#define __decltag2 __attribute__((btf_decl_tag("decl-tag-2"))) +#define __decltag3 __attribute__((btf_decl_tag("decl-tag-3"))) + +struct S { + int a __decltag2 __decltag3; + int b __decltag1; +} __decltag1 __decltag2; + +struct S my_S __decltag3; + +long __typetag1 __typetag2 * 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" 9 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 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 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_type_tag\"" 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\"" 1 } } */