From patchwork Tue Jul 11 21:57:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 118726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp765613vqm; Tue, 11 Jul 2023 15:03:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1xAVUMUBqfvySCIc5mIqL1wrtuzjVZvOgJQ4DW0V5IPs+nr9GZm2BfFeFJ1AyyFulq0W9 X-Received: by 2002:a17:906:105e:b0:993:f996:52cf with SMTP id j30-20020a170906105e00b00993f99652cfmr11383410ejj.28.1689113019793; Tue, 11 Jul 2023 15:03:39 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r15-20020a17090638cf00b0099331b3e790si2941810ejd.654.2023.07.11.15.03.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 15:03:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=cdjecWp9; arc=fail (signature failed); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68F933852AEF for ; Tue, 11 Jul 2023 22:00:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68F933852AEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689112859; bh=IJCBNaPhqdaXgaQ0VkVqNMhNHqiJz05pxlEnHiXLXz0=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=cdjecWp9QE3UYyENomMk+psx3St/w3E7lT7zVvqdUPEZaJZYqZPuZCbePW0tfc0bH mBoptQrQrlvlPVbBPoZ9COOsX6ai4DyA4drJPJVBo4uKg62e/iSlSgFiDdHhNfIvcn xuhiuD6r3cCODY9cOhEnpT/+UIX7aI/pj2Riom8Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 03F6B385700C for ; Tue, 11 Jul 2023 21:59:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 03F6B385700C Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDAvZ015513; Tue, 11 Jul 2023 21:59:03 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrea2v17c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:59:03 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BLuniw033177; Tue, 11 Jul 2023 21:59:02 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx861ch0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:59:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TE8GeQ/1Ku0dMgCbu8uZMCcJsSw79LZgGeC//N7pE5RwQsM7U095pM3N5niGSwQDqxfoxAw/xpJrx/X+EU1iQSpUlVwfVupXYU1Y5QGwU9jWGk0csyIDQ5nOPP4WzfMGijJzkDTsPRo1EX2TCN0Vv/KPDn7GKDRzL7A7bKdWdrIQqf8gTz3xQTBhdHERIui0P/DsDVCtkYx5plXjEK9tLyGzd++EeDe5nYoA2YwOk14SB1fEvRypzIxiGc0oKMoj1emzVDsDes1o1HnFOgwnUC0g7jzeSIAiVcKrzQ8G5nszi1b9fOhCQlX9QqNl0ytFcGkk1/cznT9hXibUSiHB5w== 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=IJCBNaPhqdaXgaQ0VkVqNMhNHqiJz05pxlEnHiXLXz0=; b=HXDde66FbvWZDjjW1e0jBnYt5frm+S5O3pdy5SirnIZhsToplvkylxFHR+GPTQXAPd/Dp8RJSNdLGLvaB9H3B775+IJtvuz60TwpM8PYzjKTFVkJWm2OPgLKOXiA6b16CkKPCW+VpxrAsmSNoOarL1bPjIyNIuTIITCGito39PIq2PCmRJ9rz6WfqWDFdYZIA7WmPZRHvrNOOY62d8Z5FZkZ2iQxV8pobhXgoC9icdc4PJLOM08RuB1AHgSFLYvw9l8P+KptBUw/vUlpEsG4MGR21TNfC9lKt4SqCHfjnLQ/A/i0indieUS+d9L/PuuosRDBhszmhslmwSfFCuIrLA== 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 CO6PR10MB5650.namprd10.prod.outlook.com (2603:10b6:303:14f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Tue, 11 Jul 2023 21:59:00 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::1797:59c3:a40e:f8ab]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::1797:59c3:a40e:f8ab%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:58:59 +0000 To: gcc-patches@gcc.gnu.org Cc: jose.marchesi@oracle.com, yhs@meta.com Subject: [PATCH 8/9] testsuite: add tests for BTF decl tags Date: Tue, 11 Jul 2023 14:57:15 -0700 Message-Id: <20230711215716.12980-9-david.faust@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230711215716.12980-1-david.faust@oracle.com> References: <20230711215716.12980-1-david.faust@oracle.com> X-ClientProxiedBy: SN4PR0501CA0072.namprd05.prod.outlook.com (2603:10b6:803:41::49) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB3213:EE_|CO6PR10MB5650:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d82228e-696b-4bd0-c438-08db825a0801 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZwFaMW43iK9TaLVM5ygEvPTxUTLEZWQtZsXvG1HrrEXLm9z74sy4djuRPklbaDIy9XLEx19Yba9W3Bjf9vdDOfclLF/Wq8P8nhT2DJzTRt9BH6/jubMsTg6dFD8LcOxMptshRXGmRsYhpHAoqipDAzNXZzUGPCm4sQrtUZ3I1SZcXrD42CjhsS3zh0BeUY7VRgPIJ/nsMrg5Eug6EPwUDuqznHTn1OIvg8Qc5CfQeqk7VJXLaZMBOuuext4Wz2MgEihf4qpfWntz40OnLVoaeR5RgxyfWz0BnV1mV53Bm5pME86XfG4Qz+aArcREdi9QDRBKkZqS7gxx/uNWZ69ujFrRj8GZ8RJ5F4OcRy9xjfP77b+2rgL8Zy/oijjg8UqqGopgulJ+L3sqHgwyc7U1JN06G7TzBWa0SV6Xj1DuvIXBjAJ/9FPPVUGOKae8erhYb5NUyT7mZebYRknKZtzM5fwsGL6S+bzPqEn7gA2YDb4wwvzy7N8+8vAvXGeTdXJfCKe0Vga6DbftidBtWdYtjW/aBxKOnFTWdXa88Ov6jVqHP42RN0iZ2NIiJtNrIoJYd2t9EXaZvGvlJbx8eldlRg== 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:(13230028)(39860400002)(346002)(136003)(376002)(396003)(366004)(451199021)(84970400001)(86362001)(38100700002)(36756003)(6486002)(6666004)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(5660300002)(2906002)(316002)(66556008)(66946007)(66476007)(8676002)(44832011)(8936002)(4326008)(478600001)(6916009)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qNvB5kM6X1A+zU8VSmTcIAE2IB+yZiIotUQ7k1tHC5wdJx1D7n8nfK0CuGPNtWxfxV+5QZ3kw7yZEzSfWv6THipFR8KmySZtjCa0bRjGHn0NFHpw5Fja46ynw0lOTerSf2eeWBz8voI5WTushNYZxqkqLwS/PBU9v/cXZxA6rSSK+G91KKTrcheV0w1fjoYm41L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gIJ7M1hYNd69mzwUxMUCL9Qzd1AT7stG5njFOYJ+lUxpLormk14FDNYBNTkUX2fp2hgmwIY1212RR/bAAOCEJDGyit7nBM3Svt7sUjfoX+59bABSrIgfA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d82228e-696b-4bd0-c438-08db825a0801 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:58:59.8425 (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: cjGjrQpXOvCO2uyJxnhWUzTDvLxe+qWaqepTi2VlAnrcdAC+BE1QtCGC2dN5TnTXN6EO6nGX5/R3Fcm1PSvI8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5650 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=863 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110200 X-Proofpoint-GUID: dIFGKS39XppVE5rGGF0p-0CMT6RM3Lof X-Proofpoint-ORIG-GUID: dIFGKS39XppVE5rGGF0p-0CMT6RM3Lof X-Spam-Status: No, score=-13.3 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.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-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771163373824612584 X-GMAIL-MSGID: 1771163373824612584 This patch adds tests for the btf_decl_tag attribute, in both DWARF and BTF. gcc/testsuite/ * gcc.dg/debug/btf/btf-decltag-func.c: New test. * gcc.dg/debug/btf/btf-decltag-sou.c: New test. * gcc.dg/debug/btf/btf-decltag-var.c: New test. * gcc.dg/debug/dwarf2/annotation-decl-1.c: New test. * gcc.dg/debug/dwarf2/annotation-decl-2.c: New test. * gcc.dg/debug/dwarf2/annotation-decl-3.c: New test. --- .../gcc.dg/debug/btf/btf-decltag-func.c | 21 ++++++++++++ .../gcc.dg/debug/btf/btf-decltag-sou.c | 33 +++++++++++++++++++ .../gcc.dg/debug/btf/btf-decltag-var.c | 19 +++++++++++ .../gcc.dg/debug/dwarf2/annotation-decl-1.c | 9 +++++ .../gcc.dg/debug/dwarf2/annotation-decl-2.c | 18 ++++++++++ .../gcc.dg/debug/dwarf2/annotation-decl-3.c | 17 ++++++++++ 6 files changed, 117 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-var.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-3.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..12a5eff9ac7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +#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); + } + +/* { 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 } } */ + +/* { dg-final { scan-assembler-times " BTF_KIND_DECL_TAG 'decl-tag-1'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC" 1 } } */ +/* { dg-final { scan-assembler-times " BTF_KIND_DECL_TAG 'decl-tag-2'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC" 2 } } */ +/* { dg-final { scan-assembler-times " BTF_KIND_DECL_TAG 'decl-tag-3'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC" 1 } } */ 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..13c9f075b1e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c @@ -0,0 +1,33 @@ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x11000000\[\t \]+\[^\n\]*btt_info" 13 } } */ +/* { 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" 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 t { + int a; + long b __tag3; + char c __tag2 __tag3; +}; + +struct t my_t __tag1 __tag2; + +union u { + char one __tag1 __tag2; + short two; + int three __tag1; + long four __tag1 __tag2 __tag3; + long long five __tag2; +}; + +union u my_u __tag3; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-var.c b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-var.c new file mode 100644 index 00000000000..563e8838f1a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-var.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +unsigned long u __attribute__((btf_decl_tag ("__u"))); + +const int * c __attribute__((btf_decl_tag ("__c"), btf_decl_tag ("devicemem"))); + +struct st +{ + int a; + char c; +}; + +struct st my_st __attribute__((btf_decl_tag ("__my_st"))); + +/* { dg-final { scan-assembler-times " BTF_KIND_DECL_TAG '__u'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_VAR 'u'" 1 } } */ +/* { dg-final { scan-assembler-times " BTF_KIND_DECL_TAG '__c'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_VAR 'c'" 1 } } */ +/* { dg-final { scan-assembler-times " BTF_KIND_DECL_TAG 'devicemem'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_VAR 'c'" 1 } } */ +/* { dg-final { scan-assembler-times " BTF_KIND_DECL_TAG '__my_st'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_VAR 'my_st'" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-1.c new file mode 100644 index 00000000000..d5af2188098 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-1.c @@ -0,0 +1,9 @@ +/* Test simple generation of decl tag annotations. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf -dA" } */ + +int *p __attribute__((btf_decl_tag ("p_decl"))); + +/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"p_decl\"" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-2.c new file mode 100644 index 00000000000..10f2dbc5def --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-2.c @@ -0,0 +1,18 @@ +/* Test generation of decl tag annotation DIEs for structs. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf -dA" } */ + +struct st { + int a __attribute__((btf_decl_tag("__st_a"))); + char b; + int *c __attribute__((btf_decl_tag("__st_c_1"), btf_decl_tag("__st_c_2"))); +}; + +struct st my_st __attribute__((btf_decl_tag ("__my_st"))); + +/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 4 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 4 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__st_a\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__st_c_1\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__st_c_2\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__my_st\"" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-3.c new file mode 100644 index 00000000000..e006548fa25 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-decl-3.c @@ -0,0 +1,17 @@ +/* Test generation of decl tag annotation DIEs for functions and func args. */ +/* { dg-do compile } */ +/* { dg-options "-O0 -gdwarf -dA" } */ + +extern int bar (int, int) __attribute__((btf_decl_tag ("__bar_func"))); + +int __attribute__((btf_decl_tag ("__foo_func"))) +foo (int arg1, int *arg2 __attribute__((btf_decl_tag ("__foo_arg2")))) +{ + return bar (arg1 + 1, *arg2 + 2); +} + +/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_GNU_annotation" 3 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"btf_decl_tag\"" 3 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__foo_func\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__foo_arg2\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"__bar_func\"" 1 } } */