From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 4B5173858C00 for ; Tue, 30 May 2023 16:08:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B5173858C00 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34UE4jdC021715 for ; Tue, 30 May 2023 16:08:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=message-id : date : subject : to : references : from : cc : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2023-03-30; bh=h72XUPnDul8YuDiUk+aiSa7ZBcjvsEnX5XPUIBS/XBQ=; b=at2NrX+Rvgk6q2dj7T3AJlBYFgkToxUpRer/EIBKBYpT45YJ3a8rolMEPbzGaaryx3wp 9kivvA1IsamlmMkjZT6YG8fuv3W/HRWJNn9goe1F/5irMq+FBnPAleEzo7pGf1I1m5ja 0n0IJfAFMjSMsILzp+XM1zJU2MAK/iLzSI73uVPCvxx4hlzV48N6428keTRnrrWbee8m xB9A5GIbXMdVAeRF6lWG/aOL6N3sPiDanPAeavwFbSdwTdyx3ZnxgPAYFO/4KdlY/L3q 7VX4V+6fZfIzXxegreo0oxPuk3sh4U0qGLFJq8eD1cnT5ayLKB4dCshWO6BHGRrgHAc3 eg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhjh35us-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 May 2023 16:08:49 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 34UFqf4v003688 for ; Tue, 30 May 2023 16:08:48 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2043.outbound.protection.outlook.com [104.47.56.43]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3qv4ybpmrk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 May 2023 16:08:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=izO9XZDAqxXl5vd+aTHDxvSom611uQ3taSlDXeohahLa3q8UDDamQqyT7zrmFQohpJDPGECRXd3MknlJA4Tm5Qz2s9EP6Gy6KyKHur8lp4KWfoyDla9SxaWQ9qcnSaLvdqKIE+mNb6LeKYeYhnIwwYKfWEddg0KqjcgCclHuqBtxsyjzaDNabeMbJ5Vimb1c9GkQ6RcpVtrpDS8wt7D65oBl3LEh+vo20v9UJocThS1FE0eTT+BjmO/sUR83Q0lruQd1iwCW/XnUjCsLn+tBjzDPYswTlEC9+mySLvn33aqLAEhfqU8TBCb7HxCTU3zJP7jO99RM4EmWh5L7Y2QOjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h72XUPnDul8YuDiUk+aiSa7ZBcjvsEnX5XPUIBS/XBQ=; b=gHfE69hs5gs8gUMzh0bnIwGwEdFMXAvg8eHhaQ43hCsCRDol0+IPBsHOeGBgDu47CJ6Errxip0Vz3OKj/GurcBPffUZ0fpJ9JaWMk93LLhLape5CBRj1U/oUSJui3bM3iWmUQ0V4cZj9a+XNUrCKmSTMDDGe6Pq0mJsxFhrknMnhCtJRVmZdpy1HnlmJ01fTJWjZfu/Qv6VNDunr915IoE0DYQcz+EHVLkN+CVYVtqF3oyZOxel6t+HN2K4sFmgRkYkASE42Ha500Fdd5H9FhN2ejX/Pth28sR6HF4kBMysfxmJdXXaMmGPW3O/gIqoBXnhsnKh0R3qrkhKmAbesvQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h72XUPnDul8YuDiUk+aiSa7ZBcjvsEnX5XPUIBS/XBQ=; b=Ap472dCJ6ZYy4PfFXtMxEGYOKjbn/KYlYykPSyY3DSQvFZrauxwESevF8qtT8AQYszYstX60jom5qT/yIgA2cZhQv2u27w3IwI6oR7QMkBnZVPorX4i5m0dLrz14v/zSP7mfInfWmbKihkUtvHvMLaYxP775CdshC3QO+pD008A= Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by DM4PR10MB6767.namprd10.prod.outlook.com (2603:10b6:8:10d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Tue, 30 May 2023 16:08:45 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::6ff6:bf43:d990:858a]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::6ff6:bf43:d990:858a%3]) with mapi id 15.20.6433.022; Tue, 30 May 2023 16:08:45 +0000 Message-ID: <47a761a2-a684-7560-817c-d0f5ff53547b@oracle.com> Date: Tue, 30 May 2023 09:08:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] btf: improve -dA comments for testsuite Content-Language: en-US To: Indu Bhagat References: <20230525163740.6062-1-david.faust@oracle.com> From: David Faust Cc: gcc-patches@gcc.gnu.org In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SJ0PR03CA0078.namprd03.prod.outlook.com (2603:10b6:a03:331::23) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB3213:EE_|DM4PR10MB6767:EE_ X-MS-Office365-Filtering-Correlation-Id: c9f663b6-6ae0-46b9-ffed-08db61282507 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j7AAheNyoozzKwiPb0JfzC6f06/tvW88ObPniAjnNHx1FmIfBkPdbLb1DB46KOrVcujza6Pv7jck/+MXfPyaWGZQz9kmHVzkf9aI5/PMq314/hvsbXD+rgLO801cIIjlv1YLFQfLu39CkhV/RFV1Eze7WuaxU+EoEcbf94CbLTh1sIv5d25OZSa2pi3KzbhuvZT0DlYCsya5UmYp610SMpsLpySkpchg9KL6QX8zUjd9rXn125MC/dvl/wjFTmWtk73lzOPfscZkwB64T/YEbgH0eWm36lCypDIXztmQ7X3QZRf+Y/o/EYCqR3s/J7gPixAOSYSJ9SI3dT2uID3brD4bdSl349NuUOMifjUy9V7KAGIYLt2GZ6eSC3i/rOGY2AU2CpGMReS5Nap8J6dcJOgh9Z0o98PZfr1/UX99U3p306veUepLQJ1+6SOm6MgOnjKk6JxFjkaC6Eukk/VSwdTwLrzK+UT3oZsg6wWsC0JLKgLC4CvVxVk+lWnAJI8lOqQo+KAZrPRLmxKvXoLgLk2VzVJeYvDZ/3Mtp3evut6pkVUBc0SMvsW279CgIKbiLgsY6vPLoIKT4TpzUPt7YaCtuAmcsSWUlVXSmKaeXrdwy3kxBHGFc/BBR5grIAu8vYFjhzkv/zOwBbjzI9xbbA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB3213.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(376002)(396003)(136003)(451199021)(316002)(66899021)(6666004)(66556008)(53546011)(66946007)(6512007)(6506007)(66476007)(36756003)(26005)(44832011)(6636002)(4326008)(6486002)(5660300002)(38100700002)(6862004)(8936002)(8676002)(41300700001)(83380400001)(31696002)(478600001)(86362001)(37006003)(31686004)(186003)(2906002)(30864003)(2616005)(84970400001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RlJMcCtQbHdGK0pleTdpMmM1by96OXh3cW9hL0g1NU1yZVMvcXdaREpUd2hK?= =?utf-8?B?UEk0WnROc0pEQWNEdWtuNzBqZ1VvV0xvcWtCMHVpRWNJKzJaZTdzUmZKL2Jq?= =?utf-8?B?Y056S3lrTk9ONFlxNEQxQzZySnlKT3VnNFN4SVJTcmF5NmtUMENIYXhWL256?= =?utf-8?B?UFMrcFBET093c1hJNE5YZzBVQXE1V1J0SkxSN1dhQ1JVVGdjbXd1ejhaK2li?= =?utf-8?B?NzFLQlZMUXJwNFhjem03NUxmZjdZMElLUGdReFFSZnkzUENYQnE4RzRTdVBo?= =?utf-8?B?eHQrZlVNVUdWTTRFN1ZWVGtzV2dQNS84bytDak1lVDBDWFY0K0dqa1AxSU1W?= =?utf-8?B?UnlYR1RHcUx6TjU4bW1LemlJWnZTM3Z0WHNRWXkyNXppSmQwL0Q0KzBoSnhl?= =?utf-8?B?QU5RVkF5OHUwemE2M205Zlg0UUE1eE5jUnNSc0Y3R05udFFsM3F5NkZBOHdF?= =?utf-8?B?RFF4U2x1Lzh0RTJwQm5LYi9sSHRlUVRWMGVadkZlUFhXVEZ0UXdPa2VRYUpK?= =?utf-8?B?RTA0RHdNTGZOYmpiRXNVdlpCdmpPdW56emVKa0NQYlNHbjNyM0FZekhGaVNa?= =?utf-8?B?aWdYWThRNnQ5ckQ0NFlBb0VoeUdFRlM3Nyt6NXRwTnNETzlrNDNHWVdabC9B?= =?utf-8?B?eTJJeHJaei9QTldvME5sYkVGTkNDcEJFMU9IRTFMNGtjQjQ0VXZORHZHWURi?= =?utf-8?B?cktua1lKWHpuZ1V5VVlISWR1dHlNQlhDdE9sdis5N0VwVEtXMk1xTWJpWlQ5?= =?utf-8?B?ZFhOVFlkdTkvS3NEb2trOTRKM0VXRWJyeEhaS29rZW5XTktGeFlHYnhqaFVo?= =?utf-8?B?aWJraWEraC9nV0EyZzd5LytBOTl4czJsbmVZR2YzWDNlRFhIeVFPWnF0am9T?= =?utf-8?B?VTlRaVhUMWFMTytZVjFIa3dXQW45N1NpaGxGQzdrSjQ0QjZZUEZyMWpiM3lL?= =?utf-8?B?ckt0MnM0YUY4bUxUOCtQMkxhR1FjWHprdzYwRThtZDJCUk53WEZlck1tb01D?= =?utf-8?B?eHZhZW9pVzU4UGZhenJpSEJRUVYxMVNUSTJNaDlBSXNpWjU5TGFXSVRPeXBM?= =?utf-8?B?VDNqT3kzdjlnZC9MWklrV0hvUk8vb2lpcHIxZUFCZjZwc3pGS0NORXYrSllP?= =?utf-8?B?SGViTVNOQ0xqVllLcHdBQzlrZXJacVhqTzNFSjBkYkpuMmxZN3gyZDhjbVJG?= =?utf-8?B?N0RJUjhBRVl6YXp2dmpDSnI0WXNCK2xMMVlaNWpIamhPTTc4WjJSOEd5K2Qx?= =?utf-8?B?bXdSRHpXeUdCTkJIRHlvb1hCSkFKT2lPeFlxUG1jcVVZUDFVSzloOThZQzJ6?= =?utf-8?B?WTdUM2FKOGt5bXllTXZ2S1V0SlNOd2l4Smx1THQ4T1Y5ZnVTS1JzMm1tbHow?= =?utf-8?B?VHRmbTh4RTVBWWZWMkRqMTZQMk1xZXp4NktpS2hWSzZLaUVSZmdtRlA5RkE3?= =?utf-8?B?bHM4dktUbTM5MHdYQWNkdk9saHZGTU53bzMwYlc4d3pWdkZJcDUzZEQ1R0R5?= =?utf-8?B?bWJtN2RJcHZ2SnduT3I2YjBncWxLcHc0NFNnbU9EV2RkekkwNHRkQ1hPS3pv?= =?utf-8?B?UHcyajJFVGxtWGowbDYrY0hjZkxIREF1cmpwdUI5aWgxWTcyZjJvUFUwTlNJ?= =?utf-8?B?R25BRU56emZzU3lPbGc5cXhBWTVsRUlhZmllM2prTE5uenE2WExydjlraUJT?= =?utf-8?B?aW8rVitaeGE5YXRmSDBrT1BqbGNROUZGNzBsSWJqcElpOHFkS0V6NUpXbWlh?= =?utf-8?B?bW5zTHlrV0Zkb3JzQnBoa1NNOEc4WVpyRFE1RFdEWmJvNDhnRnZBNFJaVDBQ?= =?utf-8?B?OTllTjR2WjY4dFppa0dFY0RqemcwL20vSzloUGg4V3pWWEw0Tk84WUF3cVVE?= =?utf-8?B?Slgzd01hOHhNT1I4SE96VmFYT3RkNWdoQ3d1OG4xQkJ2bEVuUGZVVy9vZnJY?= =?utf-8?B?T1JMcEFEekZORDZKWWxZeFB1R0JJbC9CMnVNRjdLRzVXRUxYWDI0SUVsdEhp?= =?utf-8?B?QVBnRURHaGprck80Z3dPWkpmQzZYa2JEUWF4TittaXErdVRRRHBkYzgra2lM?= =?utf-8?B?WjlBb2wvOHR0Sjk2S0kvc0VKVEFUQ2NoaWFUY2xDMVhUa28wWlpveVI4YmJD?= =?utf-8?Q?LGce62ZGs8sdI1g31+BXwQ5Vm?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UhW67HZW97axvQ6XW3fEpyX4iOTqXluIewqp4CWDPUZ6AYzzjJ10pwCdLlKCdBuKb3lWohAUX3qMP9jID/IY7P/RA4TbWg9tm/3KuFjkRLeIJYlrit+tFcgxVtkNJnev5Lg50P5efLTKttaKGfPP2bvGNagE8PWhRu1p33l/VZbfOzdUuIT6C0SVUrco2m6/wD4XjTPCiszsQntFMtfUlwyqr+AoHLBD2He1qR5qrHBH9+rTIG9rTMtRNlxcYiQLuNnRpEi6va/rjLno4oTY4go5m1W5678IunLZcHZ9EMbDhK7bQUqrD0TM3oiCZ9vO7X14+kcjjn4clfnOOSZJWCnBqckTWIst+80m2TCa3eX0K8bfbO7NpSOgmtdlnujKDlrVxz2JGKc/6goZk9pPUUkx0z/O5oPKBHKeqThfkezLjQiRLnPcB70TXQ98ni7miuI+pUeMtyIaYVbc6918GhjABV/uIgXiqTM46aFoWL5YnAzlvQMG/kKGLWf87JZZe8DjAAF5qQRye+JLT3M7a8CzYWbB4CLltc+X7esE3TtoYnwTtrBRnWirG82TlQi/GPS0nenz2mbh4UFFJD3ITWWzU1EMN3q/+qfpvZ75NC7W40e81d46aCX0k8iX0KJioqbRLEpqnMF37DmAn3yjXTxNrqC178IZMVAsXfkwTfyINhUul30K4YaxattQxgPRHuinPYxR4p1hjvsrcgRU+NGPKfYEFnCecAoK3XlfElHSmDeBkygH9x6S9frPpeY4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9f663b6-6ae0-46b9-ffed-08db61282507 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2023 16:08:45.3485 (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: DmXFBb7Js8f9EBUluK8+GCt3ftxU+VgXNEv4qU8uP72Wr1eQwnS7sx+TITpU3vspUUriTkw+wwZmfzwYHW//Ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6767 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-30_12,2023-05-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305300128 X-Proofpoint-GUID: DEVS50Wi4LEM2i6e4H-pwySqlg3YAtVn X-Proofpoint-ORIG-GUID: DEVS50Wi4LEM2i6e4H-pwySqlg3YAtVn X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 5/30/23 00:30, Indu Bhagat wrote: > On 5/25/23 9:37 AM, David Faust via Gcc-patches wrote: >> Many BTF type kinds refer to other types via index to the final types >> list. However, the order of the final types list is not guaranteed to >> remain the same for the same source program between different runs of >> the compiler, making it difficult to test inter-type references. >> >> This patch updates the assembler comments output when writing a >> given BTF record to include minimal information about the referenced >> type, if any. This allows for the regular expressions used in the gcc >> testsuite to do some basic integrity checks on inter-type references. >> >> For example, for the type >> >> unsigned int * >> >> Assembly comments like the following are written with -dA: >> >> .4byte 0 ; TYPE 2 BTF_KIND_PTR '' >> .4byte 0x2000000 ; btt_info: kind=2, kflag=0, vlen=0 >> .4byte 0x1 ; btt_type: (BTF_KIND_INT 'unsigned int') >> >> Several BTF tests which can immediately be made more robust with this >> change are updated. It will also be useful in new tests for the upcoming >> btf_type_tag support. >> > > Thanks for working on this, David. It will be nice to use these > enhanced assembler comments in the output for some of CTF testing as > well sometime. But we can get to that later after this comit. > > Some comments inlined below. > >> Tested on BPF and x86_64, no known regressions. >> OK for trunk? >> >> Thanks. >> >> gcc/ >> >> * btfout.cc (btf_kind_names): New. >> (btf_kind_name): New. >> (btf_absolute_var_id): New utility function. >> (btf_relative_var_id): Likewise. >> (btf_relative_func_id): Likewise. >> (btf_absolute_datasec_id): Likewise. >> (btf_asm_type_ref): New. >> (btf_asm_type): Update asm comments and use btf_asm_type_ref (). >> (btf_asm_array): Likewise. Accept ctf_container_ref parameter. >> (btf_asm_varent): Likewise. >> (btf_asm_func_arg): Likewise. >> (btf_asm_datasec_entry): Likewise. >> (btf_asm_datasec_type): Likewise. >> (btf_asm_func_type): Likewise. Add index parameter. >> (btf_asm_sou_member): Likewise. >> (output_btf_vars): Update btf_asm_* call accordingly. >> (output_asm_btf_sou_fields): Likewise. >> (output_asm_btf_func_args_list): Likewise. >> (output_asm_btf_vlen_bytes): Likewise. >> (output_btf_func_types): Add ctf_container_ref parameter. >> Pass it to btf_asm_func_type. >> (output_btf_datasec_types): Update btf_asm_datsec_type call similarly. >> (btf_output): Update output_btf_func_types call similarly. >> >> gcc/testsuite/ >> >> * gcc.dg/debug/btf/btf-array-1.c: Use new BTF asm comments >> in scan-assembler expressions where useful. >> * 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-bitfields-2.c: Likewise. >> * gcc.dg/debug/btf/btf-bitfields-3.c: Likewise. >> * gcc.dg/debug/btf/btf-function-6.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-struct-2.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-variables-2.c: Likewise. Update outdated comment. >> * gcc.dg/debug/btf/btf-function-3.c: Update outdated comment. >> --- >> gcc/btfout.cc | 220 ++++++++++++++---- >> .../gcc.dg/debug/btf/btf-anonymous-struct-1.c | 3 +- >> .../gcc.dg/debug/btf/btf-anonymous-union-1.c | 4 +- >> gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c | 3 + >> .../gcc.dg/debug/btf/btf-bitfields-2.c | 2 +- >> .../gcc.dg/debug/btf/btf-bitfields-3.c | 2 +- >> .../gcc.dg/debug/btf/btf-function-3.c | 2 +- >> .../gcc.dg/debug/btf/btf-function-6.c | 4 +- >> .../gcc.dg/debug/btf/btf-pointers-1.c | 3 + >> gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c | 4 +- >> gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c | 2 +- >> .../gcc.dg/debug/btf/btf-typedef-1.c | 14 +- >> gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c | 2 +- >> .../gcc.dg/debug/btf/btf-variables-1.c | 6 + >> .../gcc.dg/debug/btf/btf-variables-2.c | 7 +- >> 15 files changed, 215 insertions(+), 63 deletions(-) >> >> diff --git a/gcc/btfout.cc b/gcc/btfout.cc >> index 497c1ca06e6..8960acfbbaa 100644 >> --- a/gcc/btfout.cc >> +++ b/gcc/btfout.cc >> @@ -114,6 +114,23 @@ static unsigned int num_types_added = 0; >> CTF types. */ >> static unsigned int num_types_created = 0; >> >> +/* Name strings for BTF kinds. >> + Note: the indices here must match the type defines in btf.h. */ >> +static const char *const btf_kind_names[] = >> + { >> + "UNKN", "INT", "PTR", "ARRAY", "STRUCT", "UNION", "ENUM", "FWD", >> + "TYPEDEF", "VOLATILE", "CONST", "RESTRICT", "FUNC", "FUNC_PROTO", >> + "VAR", "DATASEC", "FLOAT", "DECL_TAG", "TYPE_TAG", "ENUM64" >> + }; >> + >> +/* Return a name string for the given BTF_KIND. */ >> + >> +static const char * >> +btf_kind_name (uint32_t btf_kind) >> +{ >> + return btf_kind_names[btf_kind]; >> +} >> + >> /* Map a CTF type kind to the corresponding BTF type kind. */ >> >> static uint32_t >> @@ -141,6 +158,57 @@ get_btf_kind (uint32_t ctf_kind) >> return BTF_KIND_UNKN; >> } >> >> +/* Helper routines to map between 'relative' and 'absolute' IDs. >> + >> + In BTF all records (including variables) are output in one long list, and all >> + inter-type references are via index into that list. But internally since we >> + a) translate from CTF, which separates variable records from regular types >> + and b) create some additional tpyes after the fact, things like VARs and FUNC > > typo: tpyes -> types > > Also VAR instead of VARs ? ..."VAR and FUNC records" Oops, thanks. > >> + records are stored in separate vectors with their own indices. These >> + functions map between the 'relative' IDs (i.e. indices in their respective >> + containers) and 'absolute' IDs (i.e. indices in the final contiguous >> + output list), which goes in order: >> + all normal type records translated from CTF >> + all BTF_KIND_VAR records >> + all BTF_KIND_FUNC records (synthesized split function records) >> + all BTF_KIND_DATASEC records (synthesized) >> + >> + The extra '+ 1's below are to account for the implicit "void" record, which >> + has index 0 but isn't actually contained in the type list. */ >> + >> +/* Return the final BTF ID of the variable at relative index REL. */ >> + >> +static ctf_id_t >> +btf_absolute_var_id (ctf_id_t rel) >> +{ >> + return rel + (num_types_added + 1); >> +} >> + >> +/* Return the relative index of the variable with final BTF ID ABS. */ >> + >> +static ctf_id_t >> +btf_relative_var_id (ctf_id_t abs) >> +{ >> + return abs - (num_types_added + 1); >> +} >> + >> +/* Return the relative index of the func record with final BTF ID ABS. */ >> + >> +static ctf_id_t >> +btf_relative_func_id (ctf_id_t abs) >> +{ >> + return abs - ((num_types_added + 1) + num_vars_added); >> +} >> + >> +/* Return the final BTF ID of the datasec record at relative index REL. */ >> + >> +static ctf_id_t >> +btf_absolute_datasec_id (ctf_id_t rel) >> +{ >> + return rel + (num_types_added + 1) + num_vars_added + funcs->length (); >> +} >> + >> + >> /* Allocate the btf_id_map, and initialize elements to BTF_INVALID_TYPEID. */ >> >> static void >> @@ -407,8 +475,7 @@ btf_collect_datasec (ctf_container_ref ctfc) >> info.type = 0; >> unsigned int *var_id = btf_var_ids->get (dvd); >> if (var_id) >> - /* +1 for the sentinel type not in the types map. */ >> - info.type = *var_id + num_types_added + 1; >> + info.type = btf_absolute_var_id (*var_id); >> else >> continue; >> >> @@ -620,6 +687,48 @@ btf_dmd_representable_bitfield_p (ctf_container_ref ctfc, ctf_dmdef_t *dmd) >> >> /* BTF asm helper routines. */ >> >> +/* Asm'out a reference to another BTF type. */ >> + >> +static void >> +btf_asm_type_ref (const char *prefix, ctf_container_ref ctfc, ctf_id_t ref_id) >> +{ >> + if (ref_id == BTF_VOID_TYPEID || ref_id == BTF_INVALID_TYPEID) >> + { >> + /* There is no explicit void type. >> + Also handle any invalid refs that made it this far, just in case. */ >> + dw2_asm_output_data (4, ref_id, "%s: void", prefix); >> + } >> + else if (ref_id >= num_types_added + 1 >> + && ref_id < num_types_added + num_vars_added + 1) >> + { >> + /* Ref to a variable. Should only appear in DATASEC entries. */ >> + ctf_id_t var_id = btf_relative_var_id (ref_id); >> + ctf_dvdef_ref dvd = ctfc->ctfc_vars_list[var_id]; >> + dw2_asm_output_data (4, ref_id, "%s: (BTF_KIND_VAR '%s')", >> + prefix, dvd->dvd_name); >> + >> + } >> + else if (ref_id >= num_types_added + num_vars_added + 1) >> + { >> + /* Ref to a FUNC record. */ >> + size_t func_id = btf_relative_func_id (ref_id); >> + ctf_dtdef_ref ref_type = (*funcs)[func_id]; >> + dw2_asm_output_data (4, ref_id, "%s: (BTF_KIND_FUNC '%s')", >> + prefix, ref_type->dtd_name); >> + } >> + else >> + { >> + /* Ref to a standard type in the types list. */ >> + ctf_dtdef_ref ref_type = ctfc->ctfc_types_list[ref_id]; >> + uint32_t ref_kind >> + = get_btf_kind (CTF_V2_INFO_KIND (ref_type->dtd_data.ctti_info)); >> + >> + dw2_asm_output_data (4, ref_id, "%s: (BTF_KIND_%s '%s')", >> + prefix, btf_kind_name (ref_kind), >> + ref_type->dtd_name); >> + } >> +} >> + >> /* Asm'out a BTF type. This routine is responsible for the bulk of the task >> of converting CTF types to their BTF representation. */ >> >> @@ -689,7 +798,10 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd) >> btf_kind = BTF_KIND_ENUM64; >> } >> >> - dw2_asm_output_data (4, dtd->dtd_data.ctti_name, "btt_name"); >> + dw2_asm_output_data (4, dtd->dtd_data.ctti_name, >> + "TYPE %lu BTF_KIND_%s '%s'", > + get_btf_id (dtd->dtd_type), btf_kind_name (btf_kind), >> + dtd->dtd_name); >> dw2_asm_output_data (4, BTF_TYPE_INFO (btf_kind, btf_kflag, btf_vlen), >> "btt_info: kind=%u, kflag=%u, vlen=%u", >> btf_kind, btf_kflag, btf_vlen); >> @@ -705,33 +817,41 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd) >> dw2_asm_output_data (4, dtd->dtd_data.ctti_size, "btt_size: %uB", >> dtd->dtd_data.ctti_size); >> return; >> + case BTF_KIND_ARRAY: >> + case BTF_KIND_FWD: >> + /* These types do not encode any information in the size/type field >> + and should write 0. */ >> + dw2_asm_output_data (4, 0, "(unused)"); >> + return; > > Ideally I would split this out into a separate commit as it is unrelated > to improving -dA comments for testsuite. > OK >> default: >> break; >> } >> >> - dw2_asm_output_data (4, get_btf_id (dtd->dtd_data.ctti_type), "btt_type"); >> + ctf_id_t ref_id = get_btf_id (dtd->dtd_data.ctti_type); >> + btf_asm_type_ref ("btt_type", ctfc, ref_id); >> } >> >> /* Asm'out the variable information following a BTF_KIND_ARRAY. */ >> >> static void >> -btf_asm_array (ctf_dtdef_ref dtd) >> +btf_asm_array (ctf_container_ref ctfc, ctf_arinfo_t arr) >> { >> - dw2_asm_output_data (4, get_btf_id (dtd->dtd_u.dtu_arr.ctr_contents), >> - "bta_contents"); >> - dw2_asm_output_data (4, get_btf_id (dtd->dtd_u.dtu_arr.ctr_index), >> - "bta_index"); >> - dw2_asm_output_data (4, dtd->dtd_u.dtu_arr.ctr_nelems, "bta_nelems"); >> + btf_asm_type_ref ("bta_elem_type", ctfc, get_btf_id (arr.ctr_contents)); >> + btf_asm_type_ref ("bta_index_type", ctfc, get_btf_id (arr.ctr_index)); >> + dw2_asm_output_data (4, arr.ctr_nelems, "bta_nelems"); >> } >> >> /* Asm'out a BTF_KIND_VAR. */ >> >> static void >> -btf_asm_varent (ctf_dvdef_ref var) >> +btf_asm_varent (ctf_container_ref ctfc, ctf_dvdef_ref var) >> { >> - dw2_asm_output_data (4, var->dvd_name_offset, "btv_name"); >> + ctf_id_t ref_id = get_btf_id (var->dvd_type); >> + dw2_asm_output_data (4, var->dvd_name_offset, "TYPE %u BTF_KIND_VAR '%s'", >> + (*(btf_var_ids->get (var)) + num_types_added + 1), >> + var->dvd_name); >> dw2_asm_output_data (4, BTF_TYPE_INFO (BTF_KIND_VAR, 0, 0), "btv_info"); >> - dw2_asm_output_data (4, get_btf_id (var->dvd_type), "btv_type"); >> + btf_asm_type_ref ("btv_type", ctfc, ref_id); >> dw2_asm_output_data (4, var->dvd_visibility, "btv_linkage"); >> } >> >> @@ -739,7 +859,7 @@ btf_asm_varent (ctf_dvdef_ref var) >> BTF_KIND_UNION. */ >> >> static void >> -btf_asm_sou_member (ctf_container_ref ctfc, ctf_dmdef_t * dmd) >> +btf_asm_sou_member (ctf_container_ref ctfc, ctf_dmdef_t * dmd, unsigned int idx) >> { >> ctf_dtdef_ref ref_type = ctfc->ctfc_types_list[dmd->dmd_type]; >> >> @@ -762,15 +882,19 @@ btf_asm_sou_member (ctf_container_ref ctfc, ctf_dmdef_t * dmd) >> sou_offset &= 0x00ffffff; >> sou_offset |= ((bits & 0xff) << 24); >> >> + dw2_asm_output_data (4, dmd->dmd_name_offset, >> + "MEMBER '%s' idx=%u", >> + dmd->dmd_name, idx); > > I understand that the current commit can be improved further. There are > two places, however, which I thought could be included now for a more > complete implemenation: > > 1. Enum constant name dmd->dmd_name_offset ("bte_name") in > btf_asm_enum_const (). > 2. BTF_TYPE_INFO in btf_asm_datasec_type(). Perhaps we could dump the > number of datasec entries if you think that is useful for testing. > > WDYT ? Sure, I will add them. Thanks for pointing these out. > >> /* Refer to the base type of the slice. */ >> - dw2_asm_output_data (4, dmd->dmd_name_offset, "btm_name_off"); >> - dw2_asm_output_data (4, get_btf_id (base_type), "btm_type"); >> + btf_asm_type_ref ("btm_type", ctfc, get_btf_id (base_type)); >> dw2_asm_output_data (4, sou_offset, "btm_offset"); >> } >> else >> { >> - dw2_asm_output_data (4, dmd->dmd_name_offset, "btm_name_off"); >> - dw2_asm_output_data (4, get_btf_id (dmd->dmd_type), "btm_type"); >> + dw2_asm_output_data (4, dmd->dmd_name_offset, >> + "MEMBER '%s' idx=%u", >> + dmd->dmd_name, idx); >> + btf_asm_type_ref ("btm_type", ctfc, get_btf_id (dmd->dmd_type)); >> dw2_asm_output_data (4, dmd->dmd_offset, "btm_offset"); >> } >> } >> @@ -793,7 +917,8 @@ btf_asm_enum_const (unsigned int size, ctf_dmdef_t * dmd) >> /* Asm'out a function parameter description following a BTF_KIND_FUNC_PROTO. */ >> >> static void >> -btf_asm_func_arg (ctf_func_arg_t * farg, size_t stroffset) >> +btf_asm_func_arg (ctf_container_ref ctfc, ctf_func_arg_t * farg, >> + size_t stroffset) >> { >> /* If the function arg does not have a name, refer to the null string at >> the start of the string table. This ensures correct encoding for varargs >> @@ -803,31 +928,33 @@ btf_asm_func_arg (ctf_func_arg_t * farg, size_t stroffset) >> else >> dw2_asm_output_data (4, 0, "farg_name"); >> >> - dw2_asm_output_data (4, (btf_removed_type_p (farg->farg_type) >> - ? BTF_VOID_TYPEID >> - : get_btf_id (farg->farg_type)), >> - "farg_type"); >> + btf_asm_type_ref ("farg_type", ctfc, (btf_removed_type_p (farg->farg_type) >> + ? BTF_VOID_TYPEID >> + : get_btf_id (farg->farg_type))); >> } >> >> /* Asm'out a BTF_KIND_FUNC type. */ >> > > Lets keep the function level comments updated. Apart from > btf_asm_func_type, this comment applies to other functions touched in > this commit, like btf_asm_datasec_type. I don't follow. All those functions are still doing the same thing. What needs to be updated exactly? > >> static void >> -btf_asm_func_type (ctf_dtdef_ref dtd) >> +btf_asm_func_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd, size_t i) >> { >> - dw2_asm_output_data (4, dtd->dtd_data.ctti_name, "btt_name"); >> - dw2_asm_output_data (4, BTF_TYPE_INFO (BTF_KIND_FUNC, 0, >> - dtd->linkage), >> - "btt_info: kind=%u, kflag=%u, linkage=%u", >> - BTF_KIND_FUNC, 0, dtd->linkage); >> - dw2_asm_output_data (4, get_btf_id (dtd->dtd_data.ctti_type), "btt_type"); >> + ctf_id_t ref_id = dtd->dtd_data.ctti_type; >> + dw2_asm_output_data (4, dtd->dtd_data.ctti_name, >> + "TYPE %lu BTF_KIND_FUNC '%s'", >> + num_types_added + num_vars_added + 1 + i, >> + dtd->dtd_name); >> + dw2_asm_output_data (4, BTF_TYPE_INFO (BTF_KIND_FUNC, 0, dtd->linkage), >> + "btt_info: kind=%u, kflag=%u, linkage=%u", >> + BTF_KIND_FUNC, 0, dtd->linkage); >> + btf_asm_type_ref ("btt_type", ctfc, get_btf_id (ref_id)); >> } >> >> /* Asm'out a variable entry following a BTF_KIND_DATASEC. */ >> >> static void >> -btf_asm_datasec_entry (struct btf_var_secinfo info) >> +btf_asm_datasec_entry (ctf_container_ref ctfc, struct btf_var_secinfo info) >> { >> - dw2_asm_output_data (4, info.type, "bts_type"); >> + btf_asm_type_ref ("bts_type", ctfc, info.type); >> dw2_asm_output_data (4, info.offset, "bts_offset"); >> dw2_asm_output_data (4, info.size, "bts_size"); >> } >> @@ -835,9 +962,12 @@ btf_asm_datasec_entry (struct btf_var_secinfo info) >> /* Asm'out a whole BTF_KIND_DATASEC, including its variable entries. */ >> >> static void >> -btf_asm_datasec_type (btf_datasec_t ds, size_t stroffset) >> +btf_asm_datasec_type (ctf_container_ref ctfc, btf_datasec_t ds, ctf_id_t id, >> + size_t stroffset) >> { >> - dw2_asm_output_data (4, ds.name_offset + stroffset, "btt_name"); >> + dw2_asm_output_data (4, ds.name_offset + stroffset, >> + "TYPE %lu BTF_KIND_DATASEC '%s'", >> + btf_absolute_datasec_id (id), ds.name); >> dw2_asm_output_data (4, BTF_TYPE_INFO (BTF_KIND_DATASEC, 0, >> ds.entries.length ()), >> "btt_info"); >> @@ -845,7 +975,7 @@ btf_asm_datasec_type (btf_datasec_t ds, size_t stroffset) >> loaders such as libbpf. */ >> dw2_asm_output_data (4, 0, "btt_size"); >> for (size_t i = 0; i < ds.entries.length (); i++) >> - btf_asm_datasec_entry (ds.entries[i]); >> + btf_asm_datasec_entry (ctfc, ds.entries[i]); >> } >> >> /* Compute and output the header information for a .BTF section. */ >> @@ -906,7 +1036,7 @@ output_btf_vars (ctf_container_ref ctfc) >> if (num_ctf_vars) >> { >> for (i = 0; i < num_ctf_vars; i++) >> - btf_asm_varent (ctfc->ctfc_vars_list[i]); >> + btf_asm_varent (ctfc, ctfc->ctfc_vars_list[i]); >> } >> } >> >> @@ -940,9 +1070,13 @@ output_asm_btf_sou_fields (ctf_container_ref ctfc, ctf_dtdef_ref dtd) >> { >> ctf_dmdef_t * dmd; >> >> + unsigned idx = 0; >> for (dmd = dtd->dtd_u.dtu_members; >> dmd != NULL; dmd = (ctf_dmdef_t *) ctf_dmd_list_next (dmd)) >> - btf_asm_sou_member (ctfc, dmd); >> + { >> + btf_asm_sou_member (ctfc, dmd, idx); >> + idx++; >> + } >> } >> >> /* Output all enumerator constants following a BTF_KIND_ENUM{,64}. */ >> @@ -968,7 +1102,7 @@ output_asm_btf_func_args_list (ctf_container_ref ctfc, >> ctf_func_arg_t * farg; >> for (farg = dtd->dtd_u.dtu_argv; >> farg != NULL; farg = (ctf_func_arg_t *) ctf_farg_list_next (farg)) >> - btf_asm_func_arg (farg, farg_name_offset); >> + btf_asm_func_arg (ctfc, farg, farg_name_offset); >> } >> >> /* Output the variable portion of a BTF type record. The information depends >> @@ -1004,7 +1138,7 @@ output_asm_btf_vlen_bytes (ctf_container_ref ctfc, ctf_dtdef_ref dtd) >> break; >> >> case BTF_KIND_ARRAY: >> - btf_asm_array (dtd); >> + btf_asm_array (ctfc, dtd->dtd_u.dtu_arr); >> break; >> >> case BTF_KIND_STRUCT: >> @@ -1068,10 +1202,10 @@ output_btf_types (ctf_container_ref ctfc) >> /* Output all BTF_KIND_FUNC type records. */ >> >> static void >> -output_btf_func_types (void) >> +output_btf_func_types (ctf_container_ref ctfc) >> { >> for (size_t i = 0; i < vec_safe_length (funcs); i++) >> - btf_asm_func_type ((*funcs)[i]); >> + btf_asm_func_type (ctfc, (*funcs)[i], i); >> } >> >> /* Output all BTF_KIND_DATASEC records. */ >> @@ -1082,7 +1216,7 @@ output_btf_datasec_types (ctf_container_ref ctfc) >> size_t name_offset = ctfc_get_strtab_len (ctfc, CTF_STRTAB); >> >> for (size_t i = 0; i < datasecs.length(); i++) >> - btf_asm_datasec_type (datasecs[i], name_offset); >> + btf_asm_datasec_type (ctfc, datasecs[i], i, name_offset); >> } >> >> /* Postprocess the CTF debug data post initialization. >> @@ -1209,7 +1343,7 @@ btf_output (const char * filename) >> output_btf_header (tu_ctfc); >> output_btf_types (tu_ctfc); >> output_btf_vars (tu_ctfc); >> - output_btf_func_types (); >> + output_btf_func_types (tu_ctfc); >> output_btf_datasec_types (tu_ctfc); >> output_btf_strs (tu_ctfc); >> } >> 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 >> index 89a5701bba0..05996fe195a 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c >> @@ -11,10 +11,11 @@ >> /* { dg-options "-O0 -gbtf -dA" } */ >> >> /* Struct type with 2 members (struct foo). */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_STRUCT 'foo'" 1 } } */ >> /* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */ >> /* Struct type with 1 member (anon struct). */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_STRUCT ''" 1 } } */ >> /* { 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 >> { >> 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 >> index f3b120bb458..49cdc87cf59 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c >> @@ -9,9 +9,9 @@ >> >> /* Struct type with 1 member. */ >> /* { dg-final { scan-assembler-times "\[\t \]0x4000001\[\t \]+\[^\n\]*btt_info" 1 } } */ >> -/* Union type with 2 members. */ >> +/* Anonymous 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 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_UNION ''" 1 } } */ >> >> struct foo >> { >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c >> index ab55445bd35..967b1e8746a 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c >> @@ -18,6 +18,9 @@ >> /* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*bta_nelems" 1 } } */ >> /* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*bta_nelems" 1 } } */ >> >> +/* { dg-final { scan-assembler-times " bta_elem_type: \\(BTF_KIND_INT 'int'\\)" 4 } } */ >> +/* { dg-final { scan-assembler-times " bta_elem_type: \\(BTF_KIND_ARRAY ''\\)" 1 } } */ >> + >> int b1[2] = {0,1}; >> int c1[5] = {0,1,2,3,4}; >> int a1[2][3] = { {3,4,5}, {2,3,4} }; >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c >> index 9665ab67145..03c323a6d49 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c >> @@ -16,7 +16,7 @@ >> /* { dg-final { scan-assembler-times "\[\t \]0x20000020\[\t \]+\[^\n\]*btm_offset" 1 } } */ >> >> /* Only 2 members. */ >> -/* { dg-final { scan-assembler-times "btm_name" 2 } } */ >> +/* { dg-final { scan-assembler-times "MEMBER" 2 } } */ >> >> struct foo >> { >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c >> index 2984a3357eb..78b8b7d49ad 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c >> @@ -22,7 +22,7 @@ >> /* { dg-final { scan-assembler-times "\[\t \]0x84000001\[\t \]+\[^\n\]*btt_info" 1 } } */ >> >> /* Bitfield "f" points to type ID 1. */ >> -/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*btm_type" 1 } } */ >> +/* { dg-final { scan-assembler-times " btm_type: \\(BTF_KIND_ENUM 'foo'" 1 } } */ >> >> enum foo >> { >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c >> index 884d25cfbda..7ca0890884e 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c >> @@ -1,6 +1,6 @@ >> /* Test BTF generation for a function with an unrepresentable parameter. >> >> - BTF has no encoding for floating point types, among others. Function >> + BTF has no encoding for vector types, among others. Function >> parameters of unrepresentable types are emitted as 'void' types. >> >> We expect one BTF_KIND_FUNC_PROTO with 3 parameters, one of which >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c >> index 48a946ab14b..e014d9990a9 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c >> @@ -6,8 +6,8 @@ >> /* { dg-do compile } */ >> /* { dg-options "-O0 -gbtf -dA" } */ >> >> -/* { dg-final { scan-assembler-times "btt_info: kind=12, kflag=0, linkage=2" 1 } } */ >> -/* { dg-final { scan-assembler-times "btt_info: kind=12, kflag=0, linkage=1" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_FUNC\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*linkage=2\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC_PROTO 'extfunc'" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_FUNC\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*linkage=1\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC_PROTO 'foo'" 1 } } */ >> >> extern int extfunc(int a, int b); >> >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c >> index a14ac0f89b2..f80d8089877 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c >> @@ -9,6 +9,9 @@ >> /* { dg-options "-O0 -gbtf -dA" } */ >> >> /* { dg-final { scan-assembler-times "\[\t \]0x2000000\[\t \]+\[^\n\]*btt_info" 2 } } */ >> +/* { dg-final { scan-assembeler-times " BTF_KIND_PTR ''\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_INT 'int'"}} */ >> +/* { dg-final { scan-assembeler-times " BTF_KIND_PTR ''\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_STRUCT 'st'"}} */ >> + >> /* { 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 } } */ >> >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c >> index bc3281437c9..79156cd7bcf 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c >> @@ -9,7 +9,9 @@ >> >> /* { 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 } } */ >> +/* { dg-final { scan-assembler-times " btm_type: \\(BTF_KIND_INT" 3 } } */ >> +/* { dg-final { scan-assembler-times " btm_type: \\(BTF_KIND_ARRAY" 1 } } */ >> +/* { dg-final { scan-assembler-times " btm_type: \\(BTF_KIND_STRUCT" 1 } } */ >> >> struct foo >> { >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c >> index c3aff09ed9a..e9ff06883db 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c >> @@ -1,7 +1,7 @@ >> /* Test BTF generation for struct type with a member which refers to an >> unsupported type. >> >> - BTF does not support floating point types (among other things). When >> + BTF does not support vector types (among other things). When >> generating BTF for a struct (or union) type, members which refer to >> unsupported types should be skipped. */ >> >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c >> index 472cc63f600..36bbb292f5c 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c >> @@ -41,13 +41,13 @@ >> /* { 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 } } */ >> +/* { dg-final { scan-assembler "BTF_KIND_VAR 'a'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_TYPEDEF 'my_int'" } } */ >> +/* { dg-final { scan-assembler "BTF_KIND_VAR 'b'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_TYPEDEF 'foo_int'" } } */ >> +/* { dg-final { scan-assembler "BTF_KIND_VAR 'c'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_TYPEDEF 'bar_int'" } } */ >> +/* { dg-final { scan-assembler "BTF_KIND_VAR 'd'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_TYPEDEF 'node_t'" } } */ >> +/* { dg-final { scan-assembler "BTF_KIND_VAR 'destination'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_TYPEDEF 'CBAR'" } } */ >> +/* { dg-final { scan-assembler "BTF_KIND_VAR 'ticket'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_TYPEDEF 'CBARP'" } } */ >> +/* { dg-final { scan-assembler "BTF_KIND_VAR 'suitcase'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_TYPEDEF 'arena_t'" } } */ >> >> typedef int my_int; >> typedef int foo_int; >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c >> index d66843717b3..e3a19028843 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c >> @@ -5,7 +5,7 @@ >> >> /* 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 } } */ >> +/* { dg-final { scan-assembler-times "MEMBER" 4 } } */ >> >> union 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 >> index a79ed1d53b7..42503df396f 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c >> @@ -5,6 +5,12 @@ >> >> /* We expect 6 variables */ >> /* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 6 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'x1'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_INT" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'bar'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_UNION" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'lala'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_ENUM" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'arr'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_ARRAY" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'plong'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_PTR" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'st_inst'\[\\r\\n\]+\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_STRUCT 'st'" 1 } } */ >> >> unsigned int x1; >> >> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c >> index db0bdd7be16..5f0c0b6e02d 100644 >> --- a/gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c >> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c >> @@ -1,7 +1,7 @@ >> /* BTF generation for variables with removed type. >> >> - BTF does not support floating point types, so no representation for the type >> - 'float' will be emitted. In this test, we check to also ensure that the >> + BTF does not support vector types, so no representation for the type >> + of 'bar' will be emitted. In this test, we check to also ensure that the >> variable 'bar' is not emitted, as it references a type that is not supported >> in BTF. */ >> >> @@ -11,6 +11,9 @@ >> /* We expect only 3 variables. */ >> /* { dg-final { scan-assembler-times "\[\t \]0xe000000\[\t \]+\[^\n\]*btv_info" 3 } } */ >> >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'foo'" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'baz'" 1 } } */ >> +/* { dg-final { scan-assembler-times " BTF_KIND_VAR 'myst'" 1 } } */ >> /* { dg-final { scan-assembler-times "ascii \"foo.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ >> /* { dg-final { scan-assembler-times "ascii \"baz.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ >> /* { dg-final { scan-assembler-times "ascii \"myst.0\"\[\t \]+\[^\n\]*btf_string" 1 } } */ >> >