From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by sourceware.org (Postfix) with ESMTPS id 988E73959C69 for ; Tue, 9 Mar 2021 10:04:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 988E73959C69 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 1299tk9D135772 for ; Tue, 9 Mar 2021 10:04:27 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 3742cn6pp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 09 Mar 2021 10:04:27 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1299pOvS185154 for ; Tue, 9 Mar 2021 10:04:27 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by userp3030.oracle.com with ESMTP id 374knwkxyc-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 09 Mar 2021 10:04:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZyHyjaGzk1fHbQUIjA1M2BanVc6jChJZ1ERgncb6XNVjgk9IGhn6HoVAIa53Qr9Ob5CeN0yvtRJSIcq4V5XkzjN0cWUR1TDeLM6b76e4Z66reESzeSWE3acE88HBbrpFH3eF9pcDfjz8S2hTFL0ETiv7haWMg3EjnNOjueH76NL2lwV98TpTRsrUepi7uBgZ6hVGL4w72dSZKHKWpKE3xeFDNyrWICfMwbmwT/m9/oL4zJ8C1tOXNWv/oy7QUr54O5zsAMxoVetf7hg1bhFjT/wuN214rkqtKdvw+Dwp0+OiiHjtjtbpZvCvWpsDCS6e5lGZJ+FWuda073q8TsrKg== 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=/vJsQ27VYrJQ/5Ldx9xy03uJ2OvCVZBeDY4YIVS8rio=; b=PLJ1CA3r3f9qRe1qmx+rBMWduxMZ+XesmtM7cL1E+ec4PjqfCQ4t73Z5qemPeZYNk7m1OZw9a6ZnwULnAjOFA1/NBnFZm3i7m/clh7Jxxtcuf72r09AVpcD9dAJNYPMQfXQx2jC9veM58DG4+Lm98M11WgKeR23MeP55Y6CnxtqxCbJsxgKwVHC+6mgZ2X0D09BeIWtpzb5WNMGTTfsHWp6KJVOIkNWySGjj0VxwYm0tX15xfwgy4hZ7T1EEhSX6AlFVwOu2b9hp1eGLoN5tmcco6Dljv9fQQ/N0kohZekTw4lGUWwIzbAk6Uk+i4PFdkW2iLxy+2ksNQCwD+kZFMQ== 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 DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) by DM5PR10MB1675.namprd10.prod.outlook.com (2603:10b6:4:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.28; Tue, 9 Mar 2021 10:04:21 +0000 Received: from DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::35f2:ac4c:f8c0:ee4]) by DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::35f2:ac4c:f8c0:ee4%7]) with mapi id 15.20.3912.027; Tue, 9 Mar 2021 10:04:21 +0000 From: "Jose E. Marchesi" To: gcc-patches@gcc.gnu.org Subject: [PATCH V4 3/5] CTF/BTF testsuites Date: Tue, 9 Mar 2021 11:04:00 +0100 Message-Id: <20210309100402.16632-4-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.25.0.2.g232378479e In-Reply-To: <20210309100402.16632-1-jose.marchesi@oracle.com> References: <20210309100402.16632-1-jose.marchesi@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [141.143.193.72] X-ClientProxiedBy: LO2P265CA0242.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::14) To DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from termi.localdomain (141.143.193.72) by LO2P265CA0242.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 10:04:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bce25ef8-96a5-4805-c4fa-08d8e2e2b4ff X-MS-TrafficTypeDiagnostic: DM5PR10MB1675: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xoUc8Ks3e3tV39NBINarxUJtE/PS7w82kjd8G2wld2YZTwYU+1dpC6aRCqlLE78GPL4z814+MA+FYSfz/7XPBpW2sAa+AC0HE9/ryv1BsS091qC22RmvbOrJiyp1aKNhPqjqF8NDKiVvPYipjt5JAHe/Qz435TmxOFFA8lYqX7x/L1A2fPcgB596H5Q9gZ7eW0mT17U1MD/nk1nM4gpSqq4iTM2VJ3/Y2e4e37wS6RR63Y9Iq7Q466svwo7dVtwpca3rfmOBP+WK0jxPrCX/gfkB7mn3q/7K+GYs/UFfofqZmWQs5MiakT7CXczp9eeRquI4eh9l0TsDu60MIc5DY6wcZ0f6fFi4B9vdCfHCHRpQMIiC3KOij/0S5V80cceGPcygQRofGEAayn7hUnoWrRiUtJtMDxFCxk5aQtMHPzTJgje6hlLc+Pk3shI/MOkv1wmf6awhi+ymUqr8XpjbGll986qaTKLvHsfnvo4I5L2oo9ZW9rxKzAMycU2dp1l7SsKalBT+s3bP3Ny7YQyR+6Nk5ILgGhWORZF3IAT4FA8IuTpI4CacyjV2ZK/xh0NddSW/RmrBjWmmbClQU8z7GQaTiU4psAaAfNLGGAtYSoOkV3U4l88njpFhf/Nq6HGOMiPPJJYiuhVGt4tfUScExw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB2041.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(136003)(396003)(366004)(346002)(39860400002)(26005)(5660300002)(316002)(6666004)(30864003)(86362001)(1076003)(8676002)(478600001)(83380400001)(16526019)(186003)(956004)(2616005)(2906002)(8936002)(6486002)(6916009)(6506007)(36756003)(66946007)(66556008)(66476007)(6512007)(52116002)(2004002)(559001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?bPo7UMbo+4ls3j6zGjN9AccroHlfm4P4itGfuS2s1YJlrEj5ADnpsmd3Var0?= =?us-ascii?Q?orQWzyIe7ucshy5C6fEMp4ve26OG4o88dVivD3utjUGTJQaHqet9Sl8a/zpo?= =?us-ascii?Q?GVg9WLDMM4b4W8tt4gP4Lz6+T6pXx3U85RGtGLu2pj/gDGOM/aXtNyEXwzKW?= =?us-ascii?Q?pbdQfZORe/RvbykyV9cRSZpi3gV0LspLQ/lPw0o95+SPmUvLvYe1w/Q0bgJ+?= =?us-ascii?Q?qvJr5vx8vZ9RYPvx8/BREfLGZvvjU+Pvg0a05j7TBkUXvt2Zlzkgo4tOt1uY?= =?us-ascii?Q?wSBDXaV4hVnpWbBMn5kBixRQv6uJAQar7U2DgjUYVC2hCe9GrHTOQfABpipX?= =?us-ascii?Q?/BXRYxfO8J7YhMdQE8BrQ0b+KCKtEQURppKGDDjoAlmY/QRf3USgXtWlPQwT?= =?us-ascii?Q?t8iEmYH3l3/o3K/3sw0nCfY5hFSj3prUYDiUw1vqQDyitsMNZwHS77ipPud4?= =?us-ascii?Q?UmoWGRRCb0J8eubo6nRY888hpvQATnZeXcVFV+HuWSmOz0YD+adSXnWPzldJ?= =?us-ascii?Q?HaimYh2H59YU+Q49Nk9mpc508Wpb6zNf3oAAbvib75R7ndTOtuklLbfA8ln2?= =?us-ascii?Q?Zha42ksXY0DtHxuPN1/BzCfNwYFKYOk52W5Vzn47XxaZgEzkVZq4UroMpZvN?= =?us-ascii?Q?E9Kr9T/nmuQQwelRK8u40pOvtJ7ZexSIh+Cwrq6qjvFqqOITeCe0hsOloIra?= =?us-ascii?Q?qTJSh6szLZ/rHqwHXK/8Kmt4N47g4DpTeoZU3cG5BfY6VCP06eBQHEl5/WDv?= =?us-ascii?Q?PxebFwnemZZCdDUkijJ7sUKyJHqn3RV/q8r0kIZdClYrSKtTuorWqKaGjXGL?= =?us-ascii?Q?DR8K6blThEOfqSSpTfQkEkw0WH8pQvfJPX7QyuxfiwF8p9zbsXQbtlei9Y4M?= =?us-ascii?Q?KL0YndynlwlGPAmLiAa+RB5e1ouejum2MpYem3JvDdLAO8dQYfa4d4tmqsx+?= =?us-ascii?Q?FBVT+6TMdGbjK4c3e0OK/Suz6A31erCuUnQhbgvfGvCh3Lt8J23pwQslCloi?= =?us-ascii?Q?vLxcfcFTnpHvkrFEVyl+fi+KC1rQWzyjALbCYYN4/lmZpdToMVpqDkn5wJg/?= =?us-ascii?Q?dGgyS+MvwWh3vQv+obknL9L5LFoshNx4P8JVygPBGlrusUyPh3XleUc7vsN1?= =?us-ascii?Q?gezwoeBVdau0kG8ONh0UI9y1R6oVx2TGyc682PB+hUS/QViVQu/Zf4I9H/h/?= =?us-ascii?Q?Q22xILL5PZsEE+BHdLwL4Pb5XnjIarTvn8yc/jBHH8PHxiQp0uBYn4tWlKGo?= =?us-ascii?Q?Y7YjcP4U9Zv5cDJxdTm2kFkyoh5kyGGBzKpb63NLLx/vxDtFUqVATmXY2ZRz?= =?us-ascii?Q?lrVUrjEWQbHgi7exn8o8/BVZ?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bce25ef8-96a5-4805-c4fa-08d8e2e2b4ff X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB2041.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2021 10:04:21.0657 (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: kZsfHqrRmrhymWBSZAZhQrSebAY7zp7MtBOQa7IOP397bT5wzTalSf9LWFeugkspe9Hr4PmlnnoTvhFd6iSRK3lw06Uc8Ch50cq9/4wsKvc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1675 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9917 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103090048 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9917 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 clxscore=1015 phishscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 bulkscore=0 mlxscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103090048 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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-List-Received-Date: Tue, 09 Mar 2021 10:04:38 -0000 This commit adds a new testsuite for the CTF debug format. 2021-02-18 Indu Bhagat David Faust gcc/testsuite/ * gcc.dg/debug/btf/btf-1.c: New test. * gcc.dg/debug/btf/btf-2.c: Likewise. * gcc.dg/debug/btf/btf-anonymous-struct-1.c: Likewise. * gcc.dg/debug/btf/btf-anonymous-union-1.c: Likewise. * gcc.dg/debug/btf/btf-array-1.c: Likewise. * gcc.dg/debug/btf/btf-bitfields-1.c: Likewise. * gcc.dg/debug/btf/btf-bitfields-2.c: Likewise. * gcc.dg/debug/btf/btf-bitfields-3.c: Likewise. * gcc.dg/debug/btf/btf-cvr-quals-1.c: Likewise. * gcc.dg/debug/btf/btf-enum-1.c: Likewise. * gcc.dg/debug/btf/btf-forward-1.c: Likewise. * gcc.dg/debug/btf/btf-function-1.c: Likewise. * gcc.dg/debug/btf/btf-function-2.c: Likewise. * gcc.dg/debug/btf/btf-int-1.c: Likewise. * gcc.dg/debug/btf/btf-pointers-1.c: Likewise. * gcc.dg/debug/btf/btf-struct-1.c: Likewise. * gcc.dg/debug/btf/btf-typedef-1.c: Likewise. * gcc.dg/debug/btf/btf-union-1.c: Likewise. * gcc.dg/debug/btf/btf-variables-1.c: Likewise. * gcc.dg/debug/btf/btf.exp: Likewise. * gcc.dg/debug/ctf/ctf-1.c: Likewise. * gcc.dg/debug/ctf/ctf-2.c: Likewise. * gcc.dg/debug/ctf/ctf-anonymous-struct-1.c: Likewise. * gcc.dg/debug/ctf/ctf-anonymous-union-1.c: Likewise. * gcc.dg/debug/ctf/ctf-array-1.c: Likewise. * gcc.dg/debug/ctf/ctf-array-2.c: Likewise. * gcc.dg/debug/ctf/ctf-array-3.c: Likewise. * gcc.dg/debug/ctf/ctf-array-4.c: Likewise. * gcc.dg/debug/ctf/ctf-attr-mode-1.c: Likewise. * gcc.dg/debug/ctf/ctf-attr-used-1.c: Likewise. * gcc.dg/debug/ctf/ctf-bitfields-1.c: Likewise. * gcc.dg/debug/ctf/ctf-bitfields-2.c: Likewise. * gcc.dg/debug/ctf/ctf-bitfields-3.c: Likewise. * gcc.dg/debug/ctf/ctf-bitfields-4.c: Likewise. * gcc.dg/debug/ctf/ctf-complex-1.c: Likewise. * gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Likewise. * gcc.dg/debug/ctf/ctf-cvr-quals-2.c: Likewise. * gcc.dg/debug/ctf/ctf-cvr-quals-3.c: Likewise. * gcc.dg/debug/ctf/ctf-cvr-quals-4.c: Likewise. * gcc.dg/debug/ctf/ctf-enum-1.c: Likewise. * gcc.dg/debug/ctf/ctf-enum-2.c: Likewise. * gcc.dg/debug/ctf/ctf-file-scope-1.c: Likewise. * gcc.dg/debug/ctf/ctf-float-1.c: Likewise. * gcc.dg/debug/ctf/ctf-forward-1.c: Likewise. * gcc.dg/debug/ctf/ctf-forward-2.c: Likewise. * gcc.dg/debug/ctf/ctf-func-index-1.c: Likewise. * gcc.dg/debug/ctf/ctf-function-pointers-1.c: Likewise. * gcc.dg/debug/ctf/ctf-function-pointers-2.c: Likewise. * gcc.dg/debug/ctf/ctf-function-pointers-3.c: Likewise. * gcc.dg/debug/ctf/ctf-functions-1.c: Likewise. * gcc.dg/debug/ctf/ctf-int-1.c: Likewise. * gcc.dg/debug/ctf/ctf-objt-index-1.c: Likewise. * gcc.dg/debug/ctf/ctf-pointers-1.c: Likewise. * gcc.dg/debug/ctf/ctf-pointers-2.c: Likewise. * gcc.dg/debug/ctf/ctf-preamble-1.c: Likewise. * gcc.dg/debug/ctf/ctf-skip-types-1.c: Likewise. * gcc.dg/debug/ctf/ctf-skip-types-2.c: Likewise. * gcc.dg/debug/ctf/ctf-skip-types-3.c: Likewise. * gcc.dg/debug/ctf/ctf-skip-types-4.c: Likewise. * gcc.dg/debug/ctf/ctf-skip-types-5.c: Likewise. * gcc.dg/debug/ctf/ctf-skip-types-6.c: Likewise. * gcc.dg/debug/ctf/ctf-str-table-1.c: Likewise. * gcc.dg/debug/ctf/ctf-struct-1.c: Likewise. * gcc.dg/debug/ctf/ctf-struct-2.c: Likewise. * gcc.dg/debug/ctf/ctf-struct-array-1.c: Likewise. * gcc.dg/debug/ctf/ctf-struct-pointer-1.c: Likewise. * gcc.dg/debug/ctf/ctf-struct-pointer-2.c: Likewise. * gcc.dg/debug/ctf/ctf-typedef-1.c: Likewise. * gcc.dg/debug/ctf/ctf-typedef-2.c: Likewise. * gcc.dg/debug/ctf/ctf-typedef-3.c: Likewise. * gcc.dg/debug/ctf/ctf-typedef-struct-1.c: Likewise. * gcc.dg/debug/ctf/ctf-typedef-struct-2.c: Likewise. * gcc.dg/debug/ctf/ctf-typedef-struct-3.c: Likewise. * gcc.dg/debug/ctf/ctf-union-1.c: Likewise. * gcc.dg/debug/ctf/ctf-variables-1.c: Likewise. * gcc.dg/debug/ctf/ctf-variables-2.c: Likewise. * gcc.dg/debug/ctf/ctf.exp: Likewise. * gcc.dg/debug/dwarf2-ctf-1.c: Likewise. --- gcc/testsuite/gcc.dg/debug/btf/btf-1.c | 6 ++ gcc/testsuite/gcc.dg/debug/btf/btf-2.c | 10 +++ .../gcc.dg/debug/btf/btf-anonymous-struct-1.c | 23 ++++++ .../gcc.dg/debug/btf/btf-anonymous-union-1.c | 23 ++++++ gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c | 31 +++++++ .../gcc.dg/debug/btf/btf-bitfields-1.c | 34 ++++++++ .../gcc.dg/debug/btf/btf-bitfields-2.c | 26 ++++++ .../gcc.dg/debug/btf/btf-bitfields-3.c | 43 ++++++++++ .../gcc.dg/debug/btf/btf-cvr-quals-1.c | 52 ++++++++++++ gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c | 30 +++++++ .../gcc.dg/debug/btf/btf-forward-1.c | 24 ++++++ .../gcc.dg/debug/btf/btf-function-1.c | 18 ++++ .../gcc.dg/debug/btf/btf-function-2.c | 18 ++++ gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c | 44 ++++++++++ .../gcc.dg/debug/btf/btf-pointers-1.c | 25 ++++++ .../gcc.dg/debug/btf/btf-pointers-2.c | 14 ++++ gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c | 22 +++++ .../gcc.dg/debug/btf/btf-typedef-1.c | 82 +++++++++++++++++++ gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c | 16 ++++ .../gcc.dg/debug/btf/btf-variables-1.c | 33 ++++++++ gcc/testsuite/gcc.dg/debug/btf/btf.exp | 41 ++++++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c | 6 ++ gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c | 10 +++ .../gcc.dg/debug/ctf/ctf-anonymous-struct-1.c | 23 ++++++ .../gcc.dg/debug/ctf/ctf-anonymous-union-1.c | 26 ++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c | 31 +++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c | 38 +++++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c | 17 ++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c | 13 +++ .../gcc.dg/debug/ctf/ctf-attr-mode-1.c | 22 +++++ .../gcc.dg/debug/ctf/ctf-attr-used-1.c | 22 +++++ .../gcc.dg/debug/ctf/ctf-bitfields-1.c | 30 +++++++ .../gcc.dg/debug/ctf/ctf-bitfields-2.c | 39 +++++++++ .../gcc.dg/debug/ctf/ctf-bitfields-3.c | 16 ++++ .../gcc.dg/debug/ctf/ctf-bitfields-4.c | 19 +++++ .../gcc.dg/debug/ctf/ctf-complex-1.c | 22 +++++ .../gcc.dg/debug/ctf/ctf-cvr-quals-1.c | 65 +++++++++++++++ .../gcc.dg/debug/ctf/ctf-cvr-quals-2.c | 30 +++++++ .../gcc.dg/debug/ctf/ctf-cvr-quals-3.c | 25 ++++++ .../gcc.dg/debug/ctf/ctf-cvr-quals-4.c | 23 ++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c | 21 +++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c | 27 ++++++ .../gcc.dg/debug/ctf/ctf-file-scope-1.c | 25 ++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c | 16 ++++ .../gcc.dg/debug/ctf/ctf-forward-1.c | 40 +++++++++ .../gcc.dg/debug/ctf/ctf-forward-2.c | 16 ++++ .../gcc.dg/debug/ctf/ctf-func-index-1.c | 25 ++++++ .../debug/ctf/ctf-function-pointers-1.c | 24 ++++++ .../debug/ctf/ctf-function-pointers-2.c | 22 +++++ .../debug/ctf/ctf-function-pointers-3.c | 21 +++++ .../debug/ctf/ctf-function-pointers-4.c | 18 ++++ .../gcc.dg/debug/ctf/ctf-functions-1.c | 34 ++++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c | 17 ++++ .../gcc.dg/debug/ctf/ctf-objt-index-1.c | 30 +++++++ .../gcc.dg/debug/ctf/ctf-pointers-1.c | 26 ++++++ .../gcc.dg/debug/ctf/ctf-pointers-2.c | 25 ++++++ .../gcc.dg/debug/ctf/ctf-preamble-1.c | 11 +++ .../gcc.dg/debug/ctf/ctf-skip-types-1.c | 33 ++++++++ .../gcc.dg/debug/ctf/ctf-skip-types-2.c | 17 ++++ .../gcc.dg/debug/ctf/ctf-skip-types-3.c | 20 +++++ .../gcc.dg/debug/ctf/ctf-skip-types-4.c | 19 +++++ .../gcc.dg/debug/ctf/ctf-skip-types-5.c | 19 +++++ .../gcc.dg/debug/ctf/ctf-skip-types-6.c | 18 ++++ .../gcc.dg/debug/ctf/ctf-skip-types-7.c | 18 ++++ .../gcc.dg/debug/ctf/ctf-str-table-1.c | 26 ++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c | 25 ++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c | 32 ++++++++ .../gcc.dg/debug/ctf/ctf-struct-array-1.c | 65 +++++++++++++++ .../gcc.dg/debug/ctf/ctf-struct-pointer-1.c | 21 +++++ .../gcc.dg/debug/ctf/ctf-struct-pointer-2.c | 22 +++++ .../gcc.dg/debug/ctf/ctf-typedef-1.c | 68 +++++++++++++++ .../gcc.dg/debug/ctf/ctf-typedef-2.c | 20 +++++ .../gcc.dg/debug/ctf/ctf-typedef-3.c | 24 ++++++ .../gcc.dg/debug/ctf/ctf-typedef-struct-1.c | 14 ++++ .../gcc.dg/debug/ctf/ctf-typedef-struct-2.c | 17 ++++ .../gcc.dg/debug/ctf/ctf-typedef-struct-3.c | 32 ++++++++ gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c | 14 ++++ .../gcc.dg/debug/ctf/ctf-variables-1.c | 25 ++++++ .../gcc.dg/debug/ctf/ctf-variables-2.c | 16 ++++ gcc/testsuite/gcc.dg/debug/ctf/ctf.exp | 41 ++++++++++ gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c | 7 ++ 81 files changed, 2103 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf.exp create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf.exp create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-1.c new file mode 100644 index 00000000000..bcbc9492439 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-1.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-gbtf" } */ + +void func(void) +{ +} diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-2.c new file mode 100644 index 00000000000..70e2ff1e053 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-2.c @@ -0,0 +1,10 @@ +/* Check the BTF header information. */ + +/* { dg-do compile } */ +/* { dg-options "-gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "0xeb9f.*btf_magic" 1} } */ +/* { dg-final { scan-assembler-times "0x1.*btf_version" 1 } } */ +/* { dg-final { scan-assembler-times "0.*btf_flags" 1 } } */ + +int foo; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c new file mode 100644 index 00000000000..89a5701bba0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c @@ -0,0 +1,23 @@ +/* Test BTF generation of anonymous struct. + + We expect two BTF struct records: + - struct foo, with two fields "a" and "bar" + - struct with one field "b" + + The anonymous struct should have a name of 0, pointing to the null string + at the start of the string table. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Struct type with 2 members (struct foo). */ +/* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* Struct type with 1 member (anon struct). */ +/* { dg-final { scan-assembler-times "\[\t \]0x4000001\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btt_name" 1 } } */ + +struct foo +{ + int a; + struct { int b; } bar; +} myfoo; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c new file mode 100644 index 00000000000..f3b120bb458 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c @@ -0,0 +1,23 @@ +/* Test BTF generation of anonymous union. + + We expect a named struct type and an anonymous union type record to + be generated. The anonymous union record should have a name of 0, + pointing to the null string at the start of the string table. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Struct type with 1 member. */ +/* { dg-final { scan-assembler-times "\[\t \]0x4000001\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* Union type with 2 members. */ +/* { dg-final { scan-assembler-times "\[\t \]0x5000002\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btt_name" 1 } } */ + +struct foo +{ + union + { + int value; + char ascii; + }; +} myfoo; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c new file mode 100644 index 00000000000..ab55445bd35 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c @@ -0,0 +1,31 @@ +/* BTF generation for array type. + + Unsized arrays are encoded with a 0 for the number of elements. + + In this testcase, 5 distinct BTF records for arrays are expected + b1 : cta_nelems = 2 + c1 : cta_nelems = 3 + a1 : cta_nelems = 2, 5 + buf : cta_nelems = 0. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "0x3000000\[\t \]+\[^\n\]*btt_info" 5 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*bta_nelems" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*bta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*bta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*bta_nelems" 1 } } */ + +int b1[2] = {0,1}; +int c1[5] = {0,1,2,3,4}; +int a1[2][3] = { {3,4,5}, {2,3,4} }; + +/* Variable length struct using arrays. */ +struct my_array +{ + int flags; + int length; + int buf[]; +} my_array_obj; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c new file mode 100644 index 00000000000..c6bf52130dc --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c @@ -0,0 +1,34 @@ +/* Basic tests for BTF bitfields. + + The structure containing bitfield members should be marked with KIND_FLAG=1 + The bitfield member offsets should be encoded as: + (bit_size << 24) | bit_offset + - (0xa << 24) | 0x20 + - (0x7 << 24) | 0x2a + - (0x13 << 24) | 0x40 - note that this is aligned to 0x40. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x84000004\[\t \]+\[^\n\]*btt_info" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0xa000020\[\t \]+\[^\n\]*btm_offset" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x700002a\[\t \]+\[^\n\]*btm_offset" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x13000040\[\t \]+\[^\n\]*btm_offset" 1 } } */ + +struct bitt { + int a; + unsigned int bitfield_a : 10; + unsigned int bitfield_b : 7; + unsigned int bitfield_c : 19; +} bitty; + +struct no_bitt { + int a; + int b; +} no_bitty; + +int main () +{ + return bitty.bitfield_b + bitty.a; +} diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c new file mode 100644 index 00000000000..9665ab67145 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c @@ -0,0 +1,26 @@ +/* Test BTF generation for struct with 0 size bitfield. + + We expect a struct with 2 members to be generated. The size 0 bitfield + should not have any entry in the member list. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Struct with bitfield members, and 2 members. */ +/* { dg-final { scan-assembler-times "\[\t \]0x84000002\[\t \]+\[^\n\]*btt_info" 1 } } */ + +/* Bitfield size 31 (0x1f) at offset 0. */ +/* { dg-final { scan-assembler-times "\[\t \]0x1f000000\[\t \]+\[^\n\]*btm_offset" 1 } } */ + +/* Bitfield size 32 (0x20) at offset 32. */ +/* { dg-final { scan-assembler-times "\[\t \]0x20000020\[\t \]+\[^\n\]*btm_offset" 1 } } */ + +/* Only 2 members. */ +/* { dg-final { scan-assembler-times "btm_name" 2 } } */ + +struct foo +{ + unsigned a : 31; + unsigned : 0; + unsigned c : 32; +} myfoo; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c new file mode 100644 index 00000000000..440623c3b16 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c @@ -0,0 +1,43 @@ +/* Test BTF generation for enum-type bitfields + + It is allowed to have a bitfield type be an enum type. + We expect the following types: + + [1] enum 'foo'(1U#B) size=4U#B + 'BAR' value=0 + 'BAZ' value=1 + 'QUZ' value=2 + 'QUX' value=3 + [2] int 'unsigned int' size=4 offset=0 bits=32 + [3] struct 'bitt' size=4 + member 'f' type=1 bitfield_size=2 bit_offset=0 + member 'data' type=2 bitfield_size=14 bit_offset=2 + */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Enum with 4 members. */ +/* { dg-final { scan-assembler-times "\[\t \]0x6000004\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* Struct with bitfield members, and 2 members. */ +/* { dg-final { scan-assembler-times "\[\t \]0x84000002\[\t \]+\[^\n\]*btt_info" 1 } } */ + +/* Bitfield "f" points to type ID 1. */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btm_type" 1 } } */ + +/* Bitfield "data" points to type ID 2. */ +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*btm_type" 1 } } */ + +enum foo +{ + BAR = 0, + BAZ = 1, + QUZ = 2, + QUX = 3 +}; + +struct bitt +{ + enum foo f : 2; + unsigned data : 14; +} bitty; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c new file mode 100644 index 00000000000..79e9f52a479 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c @@ -0,0 +1,52 @@ +/* Test BTF generation of BTF_KIND_{CONST,VOLATILE,RESTRICT} records. + + BTF const, volatile and restrict records are nameless type records pointing + to the type they modify. + + Types: + [1] int 'int' size=4U offset=0 bits=32 SIGNED + [2] const type=1 + [3] volatile type=1 + [4] const type=3 + [5] ptr type=1 + [6] restrict type=5 + [7] ptr type=2 + [8] restrict type=7 + + Note: + - Type id 3 describes a volatile int. + - Type id 2 describes a const int. + - Type id 4 describes a const volatile int by modifying id 3. + - Type id 6 describes a restrict pointer to int. + - Type id 8 describes a restrict pointer to const int. + */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ + +/* types 5 and 7 are pointers, to 'int' and 'const int' respectively. */ +/* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 2 } } */ + +/* type 3 has VOLATILE qualifier */ +/* { dg-final { scan-assembler-times "\[\t \]0x9000000\[\t \]+\[^\n\]*btt_info" 1 } } */ + +/* types 2 and 4 have CONST qualifier. */ +/* { dg-final { scan-assembler-times "\[\t \]0xa000000\[\t \]+\[^\n\]*btt_info" 2 } } */ + +/* types 6 and 8 have RESTRICT qualifier. */ +/* { dg-final { scan-assembler-times "\[\t \]0xb000000\[\t \]+\[^\n\]*btt_info" 2 } } */ + +const int a = 10; + +volatile int b; + +int * restrict c; + +const volatile int d = 20; + +const int * restrict e; + +const int * f; +int const * g; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c new file mode 100644 index 00000000000..728493b0804 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c @@ -0,0 +1,30 @@ +/* Test BTF generation for enums. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x6000004\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x6000003\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"QAD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"QED.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"QOD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"QUD.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"YES.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"NO.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"IDUNNO.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "bte_value" 7 } } */ + +enum foo +{ + QAD, + QED, + QOD, + QUD, +} a; + +enum barsigned +{ + YES=1000, + NO=-1000, + IDUNNO=0, +} b; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c new file mode 100644 index 00000000000..c894fa26bc7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c @@ -0,0 +1,24 @@ +/* Test BTF generation of forwards. + + Check that the KIND_FLAG (bit 31) of btt_info is set (1) for the forward to + union, and not set (0) for forward to struct. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x87000000\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x7000000\[\t \]+\[^\n\]*btt_info" 1 } } */ + +typedef struct _fwd_st +{ + struct unk_struct_type *data[4]; +} fwd_st_t; + +fwd_st_t struct_container; + +typedef struct _fwd_un +{ + union unk_union_type *options[4]; +} fwd_un_t; + +fwd_un_t union_container; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c new file mode 100644 index 00000000000..9fa1498bd8e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c @@ -0,0 +1,18 @@ +/* Test BTF generation for functions. + + We expect to see one BTF_KIND_FUNC_PROTO with 2 named arguments. + The parameter names should appear in the auxilliary string table. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0xd000002\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "farg_name" 2 } } */ +/* { dg-final { scan-assembler-times "farg_type" 2 } } */ +/* { dg-final { scan-assembler-times "ascii \"alpha.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"bravo.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */ + +int funfoo (int alpha, long bravo) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c new file mode 100644 index 00000000000..3c7fda9ee35 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c @@ -0,0 +1,18 @@ +/* Test BTF generation for functions with varargs. + + We expect one BTF_KIND_FUNC_PROTO with two arguments. The second argument + should have "farg_name" and "farg_type" both of 0, representing varargs. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0xd000002\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "farg_name" 2 } } */ +/* { dg-final { scan-assembler-times "farg_type" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*farg_name" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*farg_type" 1 } } */ + +int fmt (const char * format, ...) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c new file mode 100644 index 00000000000..2381decd6ff --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c @@ -0,0 +1,44 @@ +/* Tests for BTF integer base types. + + 0 f ff 00 ff + | 0 | encoding | offset | 00 | bits | + encoding: + signed 1 << 24 + char 2 << 24 + + All offsets in this test should be 0. + This test does _not_ check number of bits, as it may vary between targets. + */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* Check for 8 BTF_KIND_INT types. */ +/* { dg-final { scan-assembler-times "\[\t \]0x1000000\[\t \]+\[^\n\]*btt_info" 8 } } */ + +/* Check the signed/char flags, but not bit size. */ +/* { dg-final { scan-assembler-times "\[\t \]0x10000..\[\t \]+\[^\n\]*bti_encoding" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x20000..\[\t \]+\[^\n\]*bti_encoding" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x30000..\[\t \]+\[^\n\]*bti_encoding" 1 } } */ + +/* Check that there is a string entry for each type name. */ +/* { dg-final { scan-assembler-times "ascii \"unsigned char.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"signed char.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"short unsigned int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"short int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"unsigned int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"long unsigned int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"long int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ + +unsigned char a = 11; +signed char b = -22; + +unsigned short c = 33; +signed short d = 44; + +unsigned int e = 55; +signed int f = -66; + +unsigned long int g = 77; +signed long int h = 88; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c new file mode 100644 index 00000000000..a14ac0f89b2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c @@ -0,0 +1,25 @@ +/* Test BTF generation for pointer types. + + Two pointer types are expected: + - int * + - struct st * + */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 2 } } */ +/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"st.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ + +int foo = 10; +int *pfoo = &foo; + +struct st +{ + int a; + int *pb; + struct st * next; +}; + +struct st * bar; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c new file mode 100644 index 00000000000..a8a144f26a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c @@ -0,0 +1,14 @@ +/* Test BTF generation for pointers to void. + + In this test, we expect that the pointer references type ID 0, the reserved + void typeid, and that no intermediate type is generated for void. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x1000000\[\t \]+\[^\n\]*btt_info" 0 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*btt_size or btt_type" 1 } } */ + +void *ptr; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c new file mode 100644 index 00000000000..bc3281437c9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c @@ -0,0 +1,22 @@ +/* Test BTF generation of struct type. + + Two BTF_KIND_STRUCT records are expected. + - struct foo with 3 members + - struct data with 2 members */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x4000003\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "btm_name" 5 } } */ + +struct foo +{ + int after; + int before; + struct { + unsigned short n_valid; + int set[10]; + } data; +} my_foo; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c new file mode 100644 index 00000000000..472cc63f600 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c @@ -0,0 +1,82 @@ +/* Test BTF generation for BTF_KIND_TYPEDEF records. + + 7 typedef records are expected. We expect the following types (among others): + [1] int 'int' size=4 offset=0 bits=32 SIGNED + [2] typedef 'my_int' type=1 + [3] typedef 'foo_int' type=1 + [4] typedef 'bar_int' type=1 + .. + [6] typedef 'CBAR' type=5 + .. + [8] typedef 'CBARP' type=7 + [9] struct '_node' size=16 + .. + [11] typedef 'node_t' type=9 + [12] struct '_arena' + .. + [15] typedef 'arena_t' type=12 + [16] var 'a' type=2 linkage=1 (global) + [17] var 'suitcase' type=15 linkage=1 (global) + [18] var 'b' type=3 linkage=1 (global) + [19] var 'c' type=4 linkage=1 (global) + [20] var 'd' type=11 linkage=1 (global) + [21] var 'destination' type=6 linkage=1 (global) + [22] var 'ticket' type=8 linkage=1 (global) + + Note that the order of the variables is not guaranteed, so we do not check + particular variables have exactly the right typedef. Instead, we check: + 1. 7 typedef records are generated, along with the correct strings for them. + 2. There is one variable pointing to each typedef. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x8000000\[\t \]+\[^\n\]*btt_info" 7 } } */ + +/* { dg-final { scan-assembler-times "ascii \"my_int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo_int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"bar_int.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"CBAR.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"CBARP.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"node_t.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"arena_t.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*btv_type" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*btv_type" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*btv_type" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*btv_type" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x8\[\t \]+\[^\n\]*btv_type" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xb\[\t \]+\[^\n\]*btv_type" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*btv_type" 1 } } */ + +typedef int my_int; +typedef int foo_int; +typedef int bar_int; + +typedef const bar_int CBAR; +typedef const bar_int * CBARP; + +typedef struct _node +{ + foo_int name_off; + bar_int info; + struct _node * next; +} node_t; + + +typedef struct _arena +{ + node_t nodes[16]; + my_int vardata; + bar_int flags; +} arena_t; + +my_int a; +foo_int b; +bar_int c; +node_t d; + +CBAR destination; +CBARP ticket = &destination; + +arena_t suitcase; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c new file mode 100644 index 00000000000..d66843717b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c @@ -0,0 +1,16 @@ +/* Test BTF generation for union type. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* One union type with 4 members */ +/* { dg-final { scan-assembler-times "\[\t \]0x5000004\[\t \]+\[^\n\]*btt_info" 1 } } */ +/* { dg-final { scan-assembler-times "btm_name" 4 } } */ + +union onion +{ + int redness; + char *name; + unsigned short freshness; + unsigned short flavor; +} my_onion; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c new file mode 100644 index 00000000000..a79ed1d53b7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c @@ -0,0 +1,33 @@ +/* BTF generation for variables. */ + +/* { dg-do compile } */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* We expect 6 variables */ +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 6 } } */ + +unsigned int x1; + +struct st +{ + int a; + int b; +}; + +union { + long int value; + struct st * pointer; +} bar; + +enum +{ + FOO = 0, + BAR = 2, + BAZ, +} lala; + +int arr[10][20]; + +unsigned long * plong; + +struct st st_inst; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf.exp b/gcc/testsuite/gcc.dg/debug/btf/btf.exp new file mode 100644 index 00000000000..e72a2be8516 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf.exp @@ -0,0 +1,41 @@ +# Copyright (C) 2002-2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# Disable on ptx (in sync with DWARF testsuite) +if { [istarget nvptx-*-*] } { + return +} + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\] ]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c new file mode 100644 index 00000000000..6f637df5be8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ + +void func(void) +{ +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c new file mode 100644 index 00000000000..ccbb109cdbd --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c @@ -0,0 +1,10 @@ +/* A LEVEL of 0 with -gctf turns off CTF debug info generation. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf0 -dA" } */ + +/* { dg-final { scan-assembler-times "0xdff2.*CTF preamble magic number" 0} } */ +/* { dg-final { scan-assembler-times "0x4.*CTF preamble version" 0 } } */ +/* { dg-final { scan-assembler-times "0.*CTF preamble flags" 0 } } */ + +const char * _CONTEXT_NAME = "foobar"; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c new file mode 100644 index 00000000000..93547d45818 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c @@ -0,0 +1,23 @@ +/* Test compilation and CTF generation of anonymous structs. An anonymous + struct type is encoded as no-name CTF struct type. + + For this testcase, a single CTF anonymous struct is expected. + struct {} : ctt_name = 0 (point to offset 0 in the CTF string table to + denote empty string) + + Two CTF struct records should be generated in total. + struct a : ctt_info = 0x1a000002 (2 fields) + struct {} : ctt_info = 0x1a000001 (1 field) */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 1 } } */ +/* { dg-final { scan-assembler-times "0x1a000002\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +struct a +{ + struct { int b1; } a1; + int a2; +} my_a; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c new file mode 100644 index 00000000000..f45af9b742d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c @@ -0,0 +1,26 @@ +/* Test compilation and CTF generation of anonymous union. An anonymous union + is encoded as no-name CTF union type. + + For this testcase, a single CTF anonymous union is expected. + struct {} : ctt_name = 0 (point to offset 0 in the CTF string table to + denote empty string) + + Two CTF struct records should be generated in total. + struct anon_union : ctt_info = 0x1a000001 (1 field) + union {} : ctt_info = 0x1e000002 (2 fields) */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 1 } } */ +/* { dg-final { scan-assembler-times "0x1a000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "0x1e000002\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +struct anon_union +{ + union + { + char name; + int value; + }; +} my_anon_u; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c new file mode 100644 index 00000000000..006a7582f0b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c @@ -0,0 +1,31 @@ +/* CTF generation for array type. + + Unsized arrays are encoded with a 0 for the number of elements. + + In this testcase, 5 distinct CTF records for arrays are expected + b1 : cta_nelems = 2 + c1 : cta_nelems = 3 + a1 : cta_nelems = 2, 5 + buf : cta_nelems = 0. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 5 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cta_nelems" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 1 } } */ + +int b1[2] = {0,1}; +int c1[5] = {0,1,2,3,4}; +int a1[2][3] = { {3,4,5}, {2,3,4} }; + +/* Variable length struct using arrays. */ +struct my_array +{ + int flags; + int length; + int buf[]; +} my_array_obj; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c new file mode 100644 index 00000000000..2a19da050fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c @@ -0,0 +1,38 @@ +/* CTF generation for unsized arrays. + + Unsized arrays are encoded with a 0 for the number of elements. The type + of array index is the INT type. + + TBD_CTF_FORMAT_OPEN_ISSUES (1) - + This testcase makes a note of the case of a probable misrepresentation. + See Note 1 and Note 2 below. + + In the CTF section, these types are encoded as : + + Variables: + _CTF_NEWSTR -> 7: const char [0] (size 0x0) + _CTF_SECTION -> 6: const char [5] (size 0x5) + b1 -> 2: int [0] (size 0x0) + b2 -> 3: int [0] (size 0x0) + + Note 1 : There is misrepresentation in that b1 and b2 are specified + differently by the user. + Note 2 : It is arguable though whether the representation for + _CTF_NEWSTR is incorrect. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 5 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */ + +static int b1[] = {}; + +int b2[0]; + +const char _CTF_SECTION[] = ".ctf"; + +extern const char _CTF_NEWSTR[]; +const char _CTF_NEWSTR[] = "ctfinfo"; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c new file mode 100644 index 00000000000..8def2084c6d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c @@ -0,0 +1,17 @@ +/* CTF generation for variable length arrays. + + In this testcase, a specific flavor of vla appears in the function + signature. + + TBD_CTF_FORMAT_OPEN_ISSUES (1) - + This testcase makes a note of another case of a probable misrepresentation. + See ctf-array-2.c for some context on how vla's are a case of a probable + misrepresentation in CTF. Nevertheless, compilation should not fail. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ + +int foo (int a, int b[a][a]) +{ + return b[a-1][a-3]; +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c new file mode 100644 index 00000000000..013a8ff98d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c @@ -0,0 +1,13 @@ +/* CTF generation for array type. + + Test CTF generation for single element arrays. In this testcase, one CTF + record for array is expected with cta_nelems = 1. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*cta_nelems" 1 } } */ + +int b[1]; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c new file mode 100644 index 00000000000..fc3af037b8b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c @@ -0,0 +1,22 @@ +/* Test CTF generation works well with ((mode)) attribute. + + In this testcase, CTF should report type of bqi to be an enum and + not an int. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"B1.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"B2.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"B3.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "cte_value" 3} } */ + +/* There are no better/direct methods to assert that the CTF for typedef of + enum has been added. */ +/* { dg-final { scan-assembler-times "\[\t \]0x22000003\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*ctv_typeidx" 1} } */ + +typedef enum { B1 = 1, B2 = 2, B3 = 3 } B; +B __attribute__ ((mode (QI))) bqi; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c new file mode 100644 index 00000000000..61f6b6410de --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c @@ -0,0 +1,22 @@ +/* Test CTF generation works well with ((used)) function attribute. + + This attribute, attached to a function, means that code must be emitted for + the function even if it appears that the function is not referenced. */ + +/* { dg-do compile ) */ +/* { dg-options "-O2 -gctf -dA" } */ + +/* These should be true for higher optimization levels. */ +/* { dg-final { scan-assembler-times "ascii \"keep_this.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"lose_this.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */ + +static int lose_this(int a) +{ + return a + 2; +} + +__attribute__((used)) +static int keep_this(double a) +{ + return a * 2; +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c new file mode 100644 index 00000000000..1deac90f256 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c @@ -0,0 +1,30 @@ +/* CTF generation for bitfields. + + In this testcase, two slices are expected - one for enum and the other for + int. CTF slices are unnamed records. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_bits" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*cts_bits" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 2 } } */ + +enum color +{ + RED, + GREEN, + BLUE, + YELLOW, + ORANGE, + BLACK +}; + +struct quickcolor +{ + enum color col:3; + int brushid:2; + int strokes; +}; + +struct quickcolor qc; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c new file mode 100644 index 00000000000..aea09219dba --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c @@ -0,0 +1,39 @@ +/* The bitfield type (int) may be shared, but slices are not de-duplicated. + + In this testcase, it is expected to see a total of 6 CTF slices and 2 CTF + integer types for the bitfields - unsigned long long and signed long long. + + cts_offset is the offset of the bitfield into a machine word. + TBD - hardcoding cts_offset checks into the testcase will cause it to break + across targets with different BIT_PER_WORD. Is there a way to add + cts_offset related checks in the testcase? */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*cts_type" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 3 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*cts_bits" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x21\[\t \]+\[^\n\]*cts_bits" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x10\[\t \]+\[^\n\]*cts_bits" 2 } } */ + +/* { dg-final { scan-assembler-times "ascii \"long long unsigned int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"long long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +struct fields +{ + unsigned long long u1 : 15; + unsigned long long u2 : 33; + unsigned long long u3 : 16; + signed long long s1 : 15; + signed long long s2 : 33; + signed long long s3 : 16; +} flags; + +int i = 33; + +int main () +{ + return flags.u1 + i; +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c new file mode 100644 index 00000000000..8fbcf122f80 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c @@ -0,0 +1,16 @@ +/* The bool bitfield type. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*cts_bits" 2 } } */ + +/* { dg-final { scan-assembler-times "ascii \"_Bool.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +#include + +struct open_file { + bool mmapped:1; + bool released:1; +} of; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c new file mode 100644 index 00000000000..012069ac918 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c @@ -0,0 +1,19 @@ +/* The zero sized bitfield. + + In this testcase, two slices are expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*cts_type" 2 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cts_bits" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xa\[\t \]+\[^\n\]*cts_bits" 1 } } */ + +/* { dg-final { scan-assembler-times "ctm_name" 2 } } */ +struct foo +{ + int a:5; + unsigned:0; + int b:10; +} foome; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c new file mode 100644 index 00000000000..f69e8215e9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c @@ -0,0 +1,22 @@ +/* Tests for CTF complex base types. + + CTF does not have representation for COMPLEX integer types. + + This testcase has a mix of C constructs containing COMPLEX_TYPE. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0xa000000\[\t \]+\[^\n\]*ctt_info" 3 } } */ + +/* { dg-final { scan-assembler-times "ascii \"complex double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"complex long double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"complex float.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +#include + +double complex z1 = I * I; + +const long double complex z2 = I * I; + +float complex z4 = 1+2.11*I; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c new file mode 100644 index 00000000000..9368d47ea0c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c @@ -0,0 +1,65 @@ +/* Test compilation of stubs with various qualifiers - const, restrict and + volatile. + + Testcase includes a std header to allow testing of shared types across + files. Only one CTF record for int is expected. + + CTF records for CVR qualifiers are no-name records. In this testcase, there + are 5 qualifiers across constructs. 2 more no-name CTF records correspond to + CTF pointer records. + + TYPEID: name string (size) -> ref TYPEID : ref name string (size) -> ... + + Types: + 1: long int (size 0x8) + 2: long unsigned int (size 0x8) + 3: size_t (size 0x8) -> 2: long unsigned int (size 0x8) + 4: int (size 0x4) + 5: const int (size 0x4) -> 4: int (size 0x4) + 6: volatile const int (size 0x4) -> 5: const int (size 0x4) -> 4: int (size 0x4) + 7: long long int (size 0x8) + 8: long double (size 0x10) + 9: int * (size 0x8) -> 4: int (size 0x4) + a: int *restrict (size 0x8) -> 9: int * (size 0x8) -> 4: int (size 0x4) + b: const int * (size 0x8) -> 5: const int (size 0x4) -> 4: int (size 0x4) + c: const int *restrict (size 0x8) -> b: const int * (size 0x8) -> 5: const int (size 0x4) -> 4: int (size 0x4) + d: INTP (size 0x8) -> 9: int * (size 0x8) -> 4: int (size 0x4) + e: const INTP (size 0x8) -> d: INTP (size 0x8) -> 9: int * (size 0x8) -> 4: int (size 0x4) + f: void (size 0x0) + 10: void (*) (size_t, int *restrict, const int *restrict) (size 0x0) + */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 7 } } */ + +/* type id 9, b have POINTER type. */ +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + +/* type id 5, e have CONST qualifier. */ +/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + +/* type id a, c have RESTRICT qualifier. */ +/* { dg-final { scan-assembler-times "\[\t \]0x36000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + +/* type id 6 has VOLATILE qualifier. */ +/* { dg-final { scan-assembler-times "\[\t \]0x2e000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +#include "stddef.h" + +const volatile int a = 5; +int *restrict b; + +const int * i; +int const * j; + +typedef int * INTP; +const INTP int_p; + +void foo (size_t n, int *restrict p, const int *restrict q) +{ + while (n-- > 0) + *p++ = *q++; +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c new file mode 100644 index 00000000000..4f328f3a5ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c @@ -0,0 +1,30 @@ +/* Test compilation of stubs with various expressions involving const + qualifier. + + In this testcase, a single CTF record for const int is expected. A total of + two const qualifier CTF records are expected (const int and const struct + s1). */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + +struct mystruct +{ + struct + { + int a; + const int b; + } s1; + char * name; +} my_a; + +struct s1 +{ + int i; + const int ci; +} s; + +const struct s1 cs; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c new file mode 100644 index 00000000000..97317a47b8f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c @@ -0,0 +1,25 @@ +/* Test compilation of stubs with various expressions involving const and + volatile qualifiers. + + In this testcase, it is expected to have const and volatile CTF + records. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"unsigned char.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2e000000\[\t \]+\[^\n\]*ctt_info" 5 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 3 } } */ +/* Two arrays. */ +/* { dg-final { scan-assembler-times "\[\t \]0x12000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + + +const volatile unsigned char vicar = 11; + +const volatile unsigned char * vicarage = &vicar; + +volatile float vilify[2]; + +const volatile char victor = 'Y'; + +const volatile char vindictive[2]; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c new file mode 100644 index 00000000000..c1633ee935d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c @@ -0,0 +1,23 @@ +/* Test compilation of stubs with various qualifiers - const, restrict and + volatile. + + CTF records for CVR qualifiers are no-name records. In this testcase, there + is 1 const qualifier. 1 more no-name CTF record corresponds to the CTF + pointer record. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*ctt_name" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +typedef const struct howto_struct howto_type; + +typedef struct entry +{ + int addend; + howto_type *howto; +} how_ent; + +how_ent hent; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c new file mode 100644 index 00000000000..969354431ba --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c @@ -0,0 +1,21 @@ +/* CTF generation for enums. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"RED.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"GREEN.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"BLUE.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"YELLOW.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "cte_value" 4} } */ + + +enum foo_color +{ + RED, + GREEN, + BLUE, + YELLOW +}; + +enum foo_color my_color; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c new file mode 100644 index 00000000000..fd8aaeced84 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c @@ -0,0 +1,27 @@ +/* CTF generation for enums. + + CTF represents enum values with an int32_t. For enum values not + representable with int32_t data type, the compiler skips adding CTF for + them. This will be fixed soon in the CTF format. + TBD_CTF_REPRESENTATION_LIMIT. + + In this testcase, CTF for enumerator GFS_MONOTONIC will not be generated. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"GFS_MONOTONIC.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */ +/* { dg-final { scan-assembler-times "ascii \"GFS_RUNTIME.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"GFS_STATIC.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "cte_value" 2} } */ + + +enum gomp_schedule_type +{ + GFS_RUNTIME, + GFS_STATIC, + GFS_MONOTONIC = 0x80000000U +}; + +enum gomp_schedule_type gsch_type; + diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c new file mode 100644 index 00000000000..a683113e505 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c @@ -0,0 +1,25 @@ +/* CTF is not generated for entities not at file-scope. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"SFOO.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */ +/* { dg-final { scan-assembler-times "ascii \"gfoo.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +int foo (int n) +{ + typedef struct { int a[n]; } SFOO; + + SFOO a; + __attribute__ ((noinline)) SFOO gfoo (void) { return a; } + + a.a[0] = 1; + a.a[9] = 2; + + SFOO b; + b = gfoo (); + + return b.a[0] == 1 && b.a[9] == 2; +} + diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c new file mode 100644 index 00000000000..9e24b450ea5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c @@ -0,0 +1,16 @@ +/* Tests for CTF float base types. + - Verify that there is a single record for the base types. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "ascii \"float.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"long double.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +float a; +float b = 33; + +double c = 44; +double d = 45; + +long double e; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c new file mode 100644 index 00000000000..fdec7433288 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c @@ -0,0 +1,40 @@ +/* CTF forward type is generated for forward declarations of types in C. + + Check that the ctf-kind of CTF_K_FOWARD type is CTF_K_STRUCT or CTF_K_UNION. + For forward types, the compiler encodes the CTF kind in the ctt_type field. + CTF_K_FORWARD is used as the CTF type as usual in the ctt_info. */ + +/* Note - A value of 6 in "ctt_size or ctt_type" appears twice in this + testcase. This might be misconstrued as 2 CTK_K_FORWARD records of struct + type. The second assembler tag is due to a ref type in a CVR CTF record. + TBD - perhaps a more robust string pattern is needed. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x26000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x6\[\t \]+\[^\n\]*ctt_size or ctt_type" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x7\[\t \]+\[^\n\]*ctt_size or ctt_type" 2 } } */ + +typedef struct __locale_struct +{ + struct __locale_data *__locales[13]; /* forward struct type. */ + + const int *__ctype_toupper; + const char *__names[13]; +} *__locale_t; + +typedef __locale_t locale_t; + +locale_t loc; + +typedef struct __inter_struct +{ + union __inter_data * __inters[13]; /* forward union type. */ + + const int * __ctype_kind; +} * __inter_t; + +typedef __inter_t inter_t; + +inter_t inter; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c new file mode 100644 index 00000000000..a3154f2b2d4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c @@ -0,0 +1,16 @@ +/* CTF forward type is generated for forward declarations of enum types in C. + + Check that the ctf-kind of CTF_K_FOWARD type is CTF_K_ENUM. + For forward types, the compiler encodes the CTF kind in the ctt_type field. + CTF_K_FORWARD is used as the CTF type as usual in the ctt_info. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x26000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x8\[\t \]+\[^\n\]*ctt_size or ctt_type" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"vibgyor.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +enum vibgyor; + +char * (*get_color_name) (enum vibgyor); diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c new file mode 100644 index 00000000000..86ca795c9ab --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c @@ -0,0 +1,25 @@ +/* CTF function index sub-section. + + A function index sub-section in the CTF section contains the offset to the + string name of the global function symbols. The number of entries in the + func info section and the func index section are always the same. + + In this testcase, 2 records in the function index section are expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "funcinfo_name" 2 } } */ +/* { dg-final { scan-assembler-times "funcinfo_func_type" 2 } } */ +/* { dg-final { scan-assembler-times "ascii \"bar.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +int foo (void) +{ + return 0; +} + +int bar (int a) +{ + return 33 + a; +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c new file mode 100644 index 00000000000..cc1a600adbd --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c @@ -0,0 +1,24 @@ +/* CTF generation of function pointers. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x16000002\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x16000003\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"__foo_fn.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"destroy.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"func.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +int (*func) (int *, char); + +typedef int (*__foo_fn) (void *__cookie, char *__buf, int __nbytes); + +typedef struct object +{ + int myint; + char mychar; + void (*destroy)(struct object *); +} object_t; + +object_t myobj; +__foo_fn fooit; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c new file mode 100644 index 00000000000..a4a1104ae8c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c @@ -0,0 +1,22 @@ +/* CTF generation of function pointers. + + In this testcase, there is a single function type expected for two + different function pointer types. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"rcu_callback_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"func.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +struct callback_head { + struct callback_head *next; + void (*func) (struct callback_head *head); +} __attribute__ (( aligned (sizeof (void *)))); +#define rcu_head callback_head + +struct callback_head chead; + +typedef void (*rcu_callback_t) (struct rcu_head *head); + +rcu_callback_t rcb; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c new file mode 100644 index 00000000000..fe35d6c7f2e --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c @@ -0,0 +1,21 @@ +/* CTF generation of function pointers. + + In this testcase, there is a single function type expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo_init_callback.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"fn.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +struct foo; + +typedef void (* foo_init_callback) (struct foo *f1); + +struct foo +{ + /* Function to call to initialize. */ + foo_init_callback fn; +}; + +struct foo f; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c new file mode 100644 index 00000000000..b8a741766ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c @@ -0,0 +1,18 @@ +/* CTF generation of function pointers. + + In this testcase, Type de-duplication of function type is exercised. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "\[\t \]0x16000001\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"var_assign_func_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +struct variable; + +typedef struct variable *var_assign_func_t (struct variable *); + +typedef struct variable { + var_assign_func_t *assign_func; +} shell_var_t; + +shell_var_t a; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c new file mode 100644 index 00000000000..0b086a5af3d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c @@ -0,0 +1,34 @@ +/* CTF generation for functions with varargs or otherwise. + + In this testcase, it is expected to see one CTF_K_FUNCTION record with two + function arguments. The second function argument with a value of 0 + corresponds to the ellipsis. + + Example CTF section excerpt on x86_64 : + + .long 0x5 # ctt_name (name = format) + .long 0x16000002 # ctt_info (CTF_K_FUNCTION with 2 arguments) + .long 0x2 # ctt_size or ctt_type (return typeID) + .long 0x2 # dtu_argv (TypeID of the First argument) + .long 0 # dtu_argv (TypeID of the second argument) + .ascii "\0" # ctf_string + .ascii "int\0" # ctf_string + .ascii "format\0" # ctf_string + + */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x16000002\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "dtu_argv" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*dtu_argv" 1 } } */ + +int foo (void); + +int bar (int); + +int * format (int * fmt, ...) +{ + return fmt; +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c new file mode 100644 index 00000000000..8c68b2e7ede --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c @@ -0,0 +1,17 @@ +/* Tests for CTF integer base types. + - Verify that there is a single record for the base types. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"short int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"long int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +int a; +int b = 33; + +short int c = 44; +short int d = 45; + +long int e = 90; +long int f; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c new file mode 100644 index 00000000000..ee3481af723 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c @@ -0,0 +1,30 @@ +/* CTF objext index sub-section. + + An object index sub-section in the CTF section contains the offset to the + string name of the global object symbols. The number of entries in the + obj info section and objt index section are always the same. + + In this testcase, 4 records in the object index section are expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "objtinfo_name" 4 } } */ +/* { dg-final { scan-assembler-times "objtinfo_var_type" 4 } } */ +/* { dg-final { scan-assembler-times "ascii \"a.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"b.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"a1.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"d_instance.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +static int b = 33; + +int a = 44; +int a1[2] = {22, 33}; + +struct d +{ + int d1; + int d2; +}; + +struct d d_instance; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c new file mode 100644 index 00000000000..e1fccec2d03 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c @@ -0,0 +1,26 @@ +/* CTF generation for pointer types. + + In this testcase, two CTF pointer type records are expected + - int * + - struct foo_struct * + */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"foo_struct.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + +int b = 44; +int * a = &b; + +struct foo_struct +{ + int bar_mem_1; + int bar_mem_2; + float d; + struct foo_struct *next; +}; + +struct foo_struct * node; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c new file mode 100644 index 00000000000..e36e5ec741b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c @@ -0,0 +1,25 @@ +/* CTF generation for pointer types. + + In this testcase, de-duplication of pointer types is exercised. The + compostition of structs in this testcase is such that when adding CTF for + pointer type (link), the pointed-to-type type already adds the pointer to + struct link. + + In this testcase, one CTF pointer type record is expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +struct link; + +typedef struct items { + struct link * link; + int str; +} itemslist; + +itemslist il; + +struct link { struct link * next; }; + diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c new file mode 100644 index 00000000000..28547fae9a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c @@ -0,0 +1,11 @@ +/* Verify the CTF preamble in the CTF section. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler "0xdff2.*CTF preamble magic number" } } */ +/* { dg-final { scan-assembler "0x4.*CTF preamble version" } } */ +/* { dg-final { scan-assembler "0.*CTF preamble flags" } } */ + +void func (void) +{ +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c new file mode 100644 index 00000000000..eb5e6de3623 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c @@ -0,0 +1,33 @@ +/* CTF does not have representation for some types at this time. These types + are skipped in the CTF generation phase in the compiler. + + This testcase does NOT cover all skipped types exhaustively. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ + +#include + +typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16))); +La_x86_64_xmm a1; + +/* GCC also supports complex integer data types. */ +complex char a; +complex signed char b; +complex unsigned char c; +complex short int d; +complex short unsigned int e; +complex int f; +complex unsigned int g; +complex long int h; +complex long unsigned int i; +complex long long int j; + +enum gomp_schedule_type +{ + GFS_RUNTIME, + GFS_STATIC, + GFS_MONOTONIC = 0x80000000U +}; + +enum gomp_schedule_type gsch_type; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c new file mode 100644 index 00000000000..7c8b17df6db --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c @@ -0,0 +1,17 @@ +/* CTF does not have representation for some types at this time. These types + are skipped in the CTF generation phase in the compiler. + + Skip IEEE interchange and extended formats for CTF generation. + + In this testcase, CTF records for types are not added as CTF has no + representation for IEEE interchange and extended formats. + + CTF records for variables do exist, however. The referenced type is + CTF_TYPE_NULLID. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ + +/* { dg-require-effective-target float16 } */ + +_Float16 f16; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c new file mode 100644 index 00000000000..394fa2f7b41 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c @@ -0,0 +1,20 @@ +/* CTF does not have representation for some types at this time. These types + are skipped in the CTF generation phase in the compiler. + + Skip IEEE interchange and extended formats for CTF generation. + + In this testcase, CTF records for types are not added as CTF has no + representation for IEEE interchange and extended formats. + + CTF records for variables and pointer do exist, however. The referenced + type is CTF_TYPE_NULLID. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ + +/* { dg-require-effective-target float32 } */ +/* { dg-require-effective-target float32x } */ + +_Float32 f32; +_Float32x f32x; +_Float32 * f32p; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c new file mode 100644 index 00000000000..f4374e6f0f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c @@ -0,0 +1,19 @@ +/* CTF does not have representation for some types at this time. These types + are skipped in the CTF generation phase in the compiler. + + Skip IEEE interchange and extended formats for CTF generation. + + In this testcase, CTF records for types are not added as CTF has no + representation for IEEE interchange and extended formats. + + CTF records for variables and pointer do exist, however. The referenced + type is CTF_TYPE_NULLID. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ + +/* { dg-require-effective-target float64 } */ +/* { dg-require-effective-target float64x } */ + +_Float64 f64; +_Float64x f64x; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c new file mode 100644 index 00000000000..026f9e06f67 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c @@ -0,0 +1,19 @@ +/* CTF does not have representation for some types at this time. These types + are skipped in the CTF generation phase in the compiler. + + Skip IEEE interchange and extended formats for CTF generation. + + In this testcase, CTF records for types are not added as CTF has no + representation for IEEE interchange and extended formats. + + CTF records for variables and pointer do exist, however. The referenced + type is CTF_TYPE_NULLID. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ + +/* { dg-require-effective-target float128 } */ +/* { dg-require-effective-target float128x } */ + +_Float128 f128; +_Float128x f128x; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c new file mode 100644 index 00000000000..f2dbe08774f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c @@ -0,0 +1,18 @@ +/* CTF does not have representation for some types at this time. These types + are skipped in the CTF generation phase in the compiler. + + Skip Decimal Floating Point format types for CTF generation. + + In this testcase, CTF records for types are not added as CTF has no + representation for Decimal floating point format. + + CTF records for variables do exist, however. The referenced type is + CTF_TYPE_NULLID. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf" } */ +/* { dg-require-effective-target dfp } */ + +_Decimal32 d32; +_Decimal64 d64; +_Decimal128 d128; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c new file mode 100644 index 00000000000..a9d86de6482 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c @@ -0,0 +1,18 @@ +/* CTF does not have representation for some types at this time. These types + are skipped in the CTF generation phase in the compiler. + + Skip IEEE interchange and extended formats for CTF generation. + + In this testcase, CTF records for types are not added as CTF has no + representation for IEEE interchange and extended formats. This testcase + checks that CTF generation skips the 128-bit float gracefully, when code + generation is for a 32-bit environment. */ + +/* { dg-do compile } */ +/* { dg-options "-gctf -m32" } */ + +/* { dg-require-effective-target float128 } */ +/* { dg-require-effective-target float128x } */ + +_Float128 f128; +_Float128x f128x; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c new file mode 100644 index 00000000000..0a0f1f033f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c @@ -0,0 +1,26 @@ +/* CTF String Table as generated by the compiler is expected to have only a + single empty string. Just an optimization by the compiler, it is not + mandated by the CTF format. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "ascii \".0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +union wait +{ + int w_status; + struct + { + int __w_termsig; + int __w_coredump; + } __wait_terminated; + struct + { + int __w_stopval; + int __w_stopsig; + } __wait_stopped; +}; + +typedef union { union wait * __uptr; int * iptr; } __WAIT_STATUS; + +__WAIT_STATUS waitstatus; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c new file mode 100644 index 00000000000..19711c04bf7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c @@ -0,0 +1,25 @@ +/* Test compilation of struct type. + + In this testcase, two CTF_K_STRUCT records are expected + struct a : ctt_info = 0x1a000004 (4 field members) + struct b : ctt_into = 0x1a000002 (2 field members) +*/ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x1a000004\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1a000002\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ctm_name" 6 } } */ + +struct a +{ + int d1; + int d2; + float c; + struct b + { + int time; + int wall; + } b1; +} my_a; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c new file mode 100644 index 00000000000..09b4d2f8f78 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c @@ -0,0 +1,32 @@ +/* Test for compilation of self-referntial structs. + + Further, the compiler is expected to generate a single CTF struct type for + struct dmx_dtdef (due to Type de-duplication at CTF generation). */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "ascii \"dmx_dtdef.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"dtd_name.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"dtd_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"dmx_dtdef_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +struct link +{ + struct link * next; +} * s_link; + +typedef long dmx_id_t; + +typedef struct dmx_dtdef +{ + char * dtd_name; + dmx_id_t dtd_type; +} dmx_dtdef_t; + +typedef struct dmx_bundle +{ + dmx_id_t dmb_type; + dmx_dtdef_t * dmb_dtd; +} dmx_bundle_t; + +dmx_bundle_t dbt; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c new file mode 100644 index 00000000000..d6c6b6be91f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c @@ -0,0 +1,65 @@ +/* Test Compilation of mixed constructs containing structs and arrays. + + Further, the compiler is expected to generate a single CTF struct type for + struct cmodel (due to Type de-duplication at the time of CTF generation). + + const qualifier in fields of structs should be processed. It appears as a + no-name CTF record with appropriate ctt_info. In this testcase, there are + two const qualifiers - const char and const struct cmodel. However, due to + way the debug information is represented in DWARF die, 3 const qualifier + records appear in the CTF section. + + <1>: Abbrev Number: 14 (DW_TAG_typedef) + DW_AT_name : (indirect string, offset: 0x114): cmodel_t + DW_AT_type : <0x9a> + <1>: Abbrev Number: 13 (DW_TAG_const_type) + DW_AT_type : <0xe1> + <1>: Abbrev Number: 4 (DW_TAG_array_type) + DW_AT_type : <0xed> + DW_AT_sibling : <0x102> + + <2><101>: Abbrev Number: 0 + <1><102>: Abbrev Number: 13 (DW_TAG_const_type) + <103> DW_AT_type : <0xf2> + <1><107>: Abbrev Number: 15 (DW_TAG_variable) + <108> DW_AT_name : (indirect string, offset: 0x57): _models + <10f> DW_AT_type : <0x102> + <1><11d>: Abbrev Number: 0 + + This results in: + + _models -> e: const const cmodel_t [3] (size 0x30) -> d: const cmodel_t [3] (size 0x30) + + Deemed as acceptable for now. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ascii \"cmodel.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"cname.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"cpointer.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"cmodel_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +/* 3 const records are expected. */ +/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 3 } } */ + +struct a +{ + int a1[2]; + struct { int b[3]; } a2; +}; + +struct a my_a; + +typedef struct cmodel +{ + const char *cname; + int ccode; + int cpointer; +} cmodel_t; + +static const cmodel_t _models[] = { + {"ILP32", 0, 4}, + {"LP64", 0, 8}, + {"", 0, 0} +}; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c new file mode 100644 index 00000000000..22005ed0350 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* This tests the following scenario: + + 1. struct foo; + 2. struct foo *a_foo; + 3. struct foo { int bar; }; + 4. void baz (struct foo *f) { f->bar = 0; } + + At 2. a forward for struct foo is generated and at 3. the struct + type is fully defined. When a pointer to foo is encountered at 4., + an additional CTF type for the completed struct shall be emitted as + well. The linker will deduplicate both types. */ + +struct foo; +struct foo *a_foo; +struct foo { int bar; }; +void baz (struct foo *f) { f->bar = 0; } + +/* { dg-final { scan-assembler-times "\[\t \]\"bar.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c new file mode 100644 index 00000000000..569e5e237d9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* This tests the following scenario: + + 1. struct foo; + 2. struct foo *a_foo; + 3. struct foo { int bar; }; + 4. void baz (struct foo **f) { f->bar = 0; } + + At 2. a forward for struct foo is generated and at 3. the struct + type is fully defined. When a pointer to a pointer to foo is + encountered at 4., an additional CTF type for the completed struct + shall be emitted as well. The linker will deduplicate both + types. */ + +struct foo; +struct foo *a_foo; +struct foo { int bar; }; +void baz (struct foo **f) { (*f)->bar = 0; } + +/* { dg-final { scan-assembler-times "\[\t \]\"bar.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c new file mode 100644 index 00000000000..aa40ab0a671 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c @@ -0,0 +1,68 @@ +/* CTF_K_TYPEDEF record generation. + + In this testcase, 7 typedef records are expected. + + Further, the declared variables must be of type typedef + + Variables: + a -> 2: my_int (size 0x4) -> 1: int (size 0x4) + b -> 3: bar_int (size 0x4) -> 1: int (size 0x4) + c -> 4: foo_int (size 0x4) -> 1: int (size 0x4) + d -> 7: my_array (size 0x8) -> 5: struct (size 0x8) + e -> 9: CINT (size 0x4) -> 8: const int (size 0x4) -> 1: int (size 0x4) + f -> c: CINTP (size 0x8) -> b: const int * (size 0x8) -> a: const int (size 0x4) -> 1: int (size 0x4) + g -> f: my_node_t (size 0x8) -> d: struct my_node (size 0x8) + + There is no direct way to check that the variables are of type typedef. + So in this testcase, we simply check that: + 1. The typedef records are generated (Check for 7 specific ctt_info, and + check for the ascii strings for the typedef names). + 2. The ctv_typeidx are distinct (each pointing to a specfic unique type). + Note that if variables were not of type typedef, ctv_typeidx will not be + unique (type of a, b, c will all point to int); hence, the check. + */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 7 } } */ +/* { dg-final { scan-assembler-times "ascii \"my_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"bar_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo_int.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"my_array.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"CINT.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"CINTP.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"my_node_t.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x9\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xa\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xc\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xf\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ + +typedef int my_int; +typedef int bar_int; +typedef int foo_int; + +typedef struct { int a[2]; } my_array; + +typedef const int CINT; +typedef const int * CINTP; + +typedef struct my_node +{ + int flags; + char value; +} my_node_t; + +my_int a; +bar_int b; +foo_int c; + +my_array d; +CINT e = 3; +CINTP f = &e; + +my_node_t g; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c new file mode 100644 index 00000000000..8c9d3bb19ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c @@ -0,0 +1,20 @@ +/* CTF_K_TYPEDEF record generation. + + In this testcase, typedef of type void should be generated. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo_void_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"void.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +typedef void foo_void_type; + +struct bar +{ + int a; + foo_void_type *b; +}; + +struct bar c; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c new file mode 100644 index 00000000000..93d0845b042 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c @@ -0,0 +1,24 @@ +/* Type de-duplication of CTF_K_TYPEDEF records. + + In this testcase, a single CTF record for typedef is expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo_type.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ +/* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*ctf_string" 1 } } */ + +typedef struct foo foo_type; + +struct bar +{ + struct foo * f1; + foo_type * f2; +}; + +struct testme { + struct bar * b1; +}; + +struct testme * t1; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c new file mode 100644 index 00000000000..19e8f496105 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +typedef struct my_int +{ + int upper; + int lower; + struct bitmask + { + int flags; + } my_mask; +} my_int_t; + +my_int_t mit; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c new file mode 100644 index 00000000000..deeb85aab9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c @@ -0,0 +1,17 @@ +/* Test compilation of typedef composition in structs. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +typedef struct +{ + int day, month, year; +} Date; + +typedef struct +{ + Date filedDate, fixedDate; + int severity; +} BugRef; + +BugRef CR2112; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c new file mode 100644 index 00000000000..6d6918b1536 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c @@ -0,0 +1,32 @@ +/* Test CTF generation for a typedef instantiation with CVR quals. + + Caveat: There is no direct way to test that the type of foo is + "const my_int_t" via scanning the assembly. This test instead + checks for the presence of some of the CTF constructs involved + individually. Specifically, it checks for CTF const record and + CTF typedef record. + + Variables: + foo -> 4: const my_int_t (size 0x8) -> 3: my_int_t (size 0x8) -> 1: struct my_int (size 0x8) + + Types: + 1: struct my_int (size 0x8) + 2: int (size 0x4) + 3: my_int_t (size 0x8) -> 1: struct my_int (size 0x8) + 4: const my_int_t (size 0x8) -> 3: my_int_t (size 0x8) -> 1: struct my_int (size 0x8) +*/ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*ctv_typeidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2a000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x32000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +typedef struct my_int +{ + int upper; + int lower; +} my_int_t; + +const my_int_t foo = {10, 20}; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c new file mode 100644 index 00000000000..929d5329839 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c @@ -0,0 +1,14 @@ +/* CTF generation for union type. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1e000004\[\t \]+\[^\n\]*ctt_info" 1 } } */ +/* { dg-final { scan-assembler-times "ctm_name" 4 } } */ + +union c +{ + int c1; + int c2; + int c3; + int c4; +} my_u_c; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c new file mode 100644 index 00000000000..8c3ab1050e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c @@ -0,0 +1,25 @@ +/* CTF generation for global variables. + + In this testcase, 7 records in the variable info section are expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ctv_name" 7 } } */ + +float var1; +double var2; +long double var3; + +char ascii = 'a'; + +int a = 33; +int a1[2] = {22, 33}; + +struct d +{ + int d1; + int d2; +}; + +struct d d_instance; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c new file mode 100644 index 00000000000..75c3ed790f4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c @@ -0,0 +1,16 @@ +/* CTF generation for static variables inside a function. + + In this testcase, CTF record for bstatic is NOT expected. CTF generation + is only carried out for variables at file-scope or global-scope. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "ctv_name" 0 } } */ +/* { dg-final { scan-assembler-times "ascii \"bstatic.0\"\[\t \]+\[^\n\]*ctf_string" 0 } } */ + +int foo (int a) +{ + static int bstatic = 3; + return a + bstatic; +} diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp b/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp new file mode 100644 index 00000000000..46055f8a2bf --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp @@ -0,0 +1,41 @@ +# Copyright (C) 2002-2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# Disable on ptx (in sync with DWARF testsuite) +if { [istarget nvptx-*-*] } { + return +} + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\] ]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c new file mode 100644 index 00000000000..7c5ae85fd0f --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c @@ -0,0 +1,7 @@ +/* Verify that CTF debug info can co-exist with other debug formats. */ +/* { dg-do compile } */ +/* { dg-options "-gctf -dA" } */ +/* { dg-final { scan-assembler "0xdff2.*CTF preamble magic number" } } */ + +void func (void) +{ } -- 2.25.0.2.g232378479e