From patchwork Tue Jun 7 21:43:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54916 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51CE83856DEF for ; Tue, 7 Jun 2022 21:44:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51CE83856DEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638274; bh=E67L052JWpaa/KUQcQsrrtwvePZEelUMJ5rNiRtzUxc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hgP1Z0FBc2UMlnnobNiN9ZqE43L9JXY1vxyUFrPeKBSksONlU6FzZx+Z/lMmMPWXu I0nRlgtBRy+l9k3o3FWUpXsibDRpyEhPC80k1QcuYAz45/NVWhOjmejbC/s7uJmz4R isEZ6+q8WzNVcJcdJ/u7RU27Kdo9nDU4lbNW4YVM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 616AC3838E7C for ; Tue, 7 Jun 2022 21:44:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 616AC3838E7C Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IRMNv014271; Tue, 7 Jun 2022 21:44:03 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ggvxmw5jy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:03 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257LfL3M022839; Tue, 7 Jun 2022 21:44:02 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gfwua3c8f-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qi5PlOXA8EqRM74NRFnIDHY4A4dQK2L2AxPSpyxeK+/J9XxEw0GPY56gLTfY+19ffgJ/LlQQBnQPNiJXJF2Zuw4q/K4SELjnIZfDqeyQ7aFVrcOb6l1cvGbln8gXpsWkZOExojNHTyYyZPK0pTLF7v8/411HjS1h5cgKK3g+SzgXc7Q99xghCQ11tA9D5Tb4lz0lU/CodZewI5iuiszfXTRRW5cKhpp7BVsqkfQgOfhL+O/bxeY5dlowMtHuXPkf5V0qQBIWhUba7Mt706y4U4Dyatgv+YeT0gyF3fbFLmUV2vvoMnyyg4rJD0p8xXVO+u9ZlA6syShO/5v+vKQhCA== 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=E67L052JWpaa/KUQcQsrrtwvePZEelUMJ5rNiRtzUxc=; b=ndDO3CR2z8u6ALaZTl8zrV1X2VMFl38UJBXoTrZAoTZzUW3ngC2WzrfCYegWFd+CwXWqkyu4b0KO13ag8zZcGqiq8Gc4cpvr/yDeZNRjL3310Qsp5N56fWd8j4tWZc+DIkb134YZrIPcEdN/AH6WQ3H/V93qwSL/idwVUfwljGmZ+OC+YhI+LdWN6klt+py3TWThHHdaIS5w6XAR4zCZvuh/22F89kHBxwW4gMq8jURab4/Ilv3+//pMlU0RLlcnEdM7Zs8UC5nyGPvw/iQhW1nKTTVgA+anN4rd7lay0e0eBEGMY7rPLM4NoKo/nZHt75mLsuK4SVGMBgCj44cEWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:01 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:01 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/9] dwarf: add dw_get_die_parent function Date: Tue, 7 Jun 2022 14:43:34 -0700 Message-Id: <20220607214342.19463-2-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 704300eb-31a0-4646-757e-08da48ced598 X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zCz+70tuHVNyB49YPjVcLHry5GjQeG4405EeCzJxUZA69A1kQCMBBWxsDvjZ/RNFBcETDx3VxknSW/qGTevlmI28UfOkrCROXJZLFkSgqFKhQSW1y2Jmv0RzuGksxA3n13kvPpjmjxUaZ9K2vZEv6yWu+9TfO+7W6asCevrQ3uMJ5SbGCekCOSAE+ApTF+69TCeUIp8+Q+N1tE+6C/wsRiBB0yKP26jmf1Mflg6yuuQfvoYLM8wiGH6EVR9xsXC8k8CfrBqMTijqxvGEvF/CkxNcsv4l8GfUKeM/GaG80v/IyJpLt5fzrcOqGKrI37bjVXhChAJvFk8jE26Xp4IkDRy9tuWDw57GW0wEtVsejHpXwX5YdUbJTzsXgwX7OG7+fxTa02qvbXyjtucO0Ae6OKrmgXwRGWW3dWnjxad8UEM7bZNVfZoggJg8xnI/Tn9TtZ28wR4E012EazAA0p9YwPAoWpJ7bmjCBM1lMheE40KO5nroF4UeRS+HbGL/gYpWEMCKpQPSLRe7sqPO3ocWlJxlGHErPOXGTB0ysn1ZmVlgWlIKjtZ+9rk5Y6lTgG+gUhZVhOoNwgAQoKpoQKjxIGIwwk3KHRbr+neb8E7lMhgBtCjuIyd44DhDVUv5cnjabaPiO74qr+kN7DQWBGmnmg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0ArQ42XAkTvWvg+mN392Gw9N6l0Hl7R/KJKIBrlYbMUnOrfjnNvY1IaVWB28KLhoRhiXA7z1T3FL5E+4DopxtA9lfDjmhMYhg2MRMwaKXaGt3GHVr7fAQ0qL2K38pfA/4RGiueYvTJpx/yqJIOn+ubmdfDmtvn/BRoueBAxJnSTaSQ+u4E1TZzvW9gfC+NXxAww4F2Ez1n1tzfGT/lhaJl23RYG+VcE+LrqcNVvjYeScn4R/c1RyiUvC95rl5NrFONeJqdOANV4Zj4+2XniZ8hudhchUk29gr43lYfPwAwfLubXaFMG7z9jKQtD2nesX4612SuDqK6KWfHlfiQk8WBVqm86COF9z7VmWri3m97ddbH0wByzpfp53ByP7IJZi6a9Dz4BV9ZcS5zee119oEVIgD+rvhgaxkXpE9cVzs3zSAQUruNKrIFNaW+rPHB9pF4q6pAkXB00YBJFDC3lQ4dIUsUxIvh6BGQvH3038+kEB2ochXXFSgQKWvLDl6PAo4hOJj9DLjv+Dj3/2tBmfmbzvmv6CFg63BhNu+qCXPvepjy2qOolB9bOXCIDgOwMQA5kVdllniHZONCsqeD8qFM5ondTffY8FUIDtHgXiZA+ot9S6rJXTzFiMnmlB72GKdSWCoWq+n1k3giPGqqjpcnYkBWyXW4yn8yyLHlM+KynCCcZ2g8Gcvge3hEMnB3VoUaKGvfam8TMFefaHToEOh/VoneqfeY6rdAfcxi3dxkdWdo9neZRK7UPzhFXPbjhgNrqDTaCeu02Plu2YI4tJ0Kk/vGdQJ77VJvwysX3ERYidCzWRAdPhpVOgmjYAn0voZi8RaLspAVGez07LPPcPD1mCT+f984VuoAEmMyd8mAel4jyR8AcOpgKsRa9Wq2Z4sA/qflpktPxbKf8L2FTnyQs43iO94DHVi7HpEmgKbRuSbD6QObQfNkXLACVPqnw8TqNbhcHOo81kYeb5Iv30iiaCyBgH0lsvZ/3oobljQBYFkVcCn7esBETsQiaX17MNzqOtg7ppoC+JF7COW8fK6kWQuHLk4yZtpC9Zla7ao3iOTDQnJDjY573z3VkbDWB5PtRil6COEI17HZ3+QEGb9n5nuFuDKHpCniDMwdvw4Tc67WiY8+QRuCFZO1Ox7Hhbg0HZCRpZO261OkDp0Okiwp/4jD2gQFIZSQ3siNb+5r2M7nsDkO+DGe9Sd7WhJ6zteNLuIAJSJS9c4Z8Ro23HdP2HbgslSrfeTANWWrF46yPK7jl22Gopo0d0JLw/8Bl36xycwiTCn4q7fUhfRx9fS+xU/2J7qHXkZ/UKzvV1YE7PAkgrLTenjxKzOVizv9PQMATDP29FjIJwIc6CNHcDBA125p1Bm4KiJZGapBYAzinlFw3WQO0qdQvUpRcB81TFmbc0+KPTkOY65BFe9QETnr6OoH+zeV8vWOknEiLuuyrhHqQIHQOuQArNG+FhczoDiMejQb6X8kCsbd4q2sJvlYYFNQ5OmydVposyIBWxNUfCdxRML5MKjiLzxy3IaPeBvZLqfdPUJ2fe3BGOb7gU4UX9Y3ZpYOkkQOppsrrxvoKagkInXA66IDrwMkaWbzhcLpXLDUhlZKk1Pve210a9Ug8tmjX/HY3S77qtLUwPCvMKI2op8MRzULKtseBzljYmwIKZBDLllcewMC0H133Oe2+oS61X50Tpp0t6rLvqZZc5Q148pDNATlvVqzhg5n2ufsPNHL/EGEuC29xP16++819EQQB93Cm2/nknKo5Z60h8s47a8fSLnskk9TCaL3ro X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 704300eb-31a0-4646-757e-08da48ced598 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:01.2066 (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: 8e9Zpvv6zuvDVH01nwnmO8KG2lGySzCfV/WIh/+PcYW38Ax2U7Jru6a9EmUn9FYg+GMMqnY6vYaXmBPLMxNpZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=843 adultscore=0 mlxscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-GUID: KnrofmrnuCvh9bUpwNkffgk0hdPGmCiS X-Proofpoint-ORIG-GUID: KnrofmrnuCvh9bUpwNkffgk0hdPGmCiS X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ * dwarf2out.cc (dw_get_die_parent): New function. * dwarf2out.h (dw_get_die_parent): Declare it here. --- gcc/dwarf2out.cc | 8 ++++++++ gcc/dwarf2out.h | 1 + 2 files changed, 9 insertions(+) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 29f32ec6939..9c61026bb34 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -5235,6 +5235,14 @@ dw_get_die_sib (dw_die_ref die) return die->die_sib; } +/* Return a reference to the parent of a given DIE. */ + +dw_die_ref +dw_get_die_parent (dw_die_ref die) +{ + return die->die_parent; +} + /* Add an address constant attribute value to a DIE. When using dwarf_split_debug_info, address attributes in dies destined for the final executable should be direct references--setting the parameter diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h index 656ef94afde..e6962fb4848 100644 --- a/gcc/dwarf2out.h +++ b/gcc/dwarf2out.h @@ -455,6 +455,7 @@ extern dw_die_ref lookup_type_die (tree); extern dw_die_ref dw_get_die_child (dw_die_ref); extern dw_die_ref dw_get_die_sib (dw_die_ref); +extern dw_die_ref dw_get_die_parent (dw_die_ref); extern enum dwarf_tag dw_get_die_tag (dw_die_ref); /* Data about a single source file. */ From patchwork Tue Jun 7 21:43:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54918 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B4E53954438 for ; Tue, 7 Jun 2022 21:46:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B4E53954438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638392; bh=P61OCTga7/L7sv2b8pYEkMFxQMAu92huSq5CN9OqBfU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gnVLOLZYGrMo+IcaMtNsN6ybn/UMgNOiBmwPyK2XQgMC2dhVSCRvbw7V6XoHhMoTq jN09Jn2mL36e0wiyHbNv+MpH0wxpcZYJW4b9kiKrwuRUu7ytl6PWgo3mLwAzQRkxnV IWGMfqSfzfW7bRcdETtkzaYV4TUTfbQ12T7zTnUg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id A251F3948A57 for ; Tue, 7 Jun 2022 21:44:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A251F3948A57 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IJH8J006530; Tue, 7 Jun 2022 21:44:04 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ghexecbfm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:04 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257Le3jT016431; Tue, 7 Jun 2022 21:44:03 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gfwu31y4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iowCBr5YtYqGoKwkvrdnHmnvrk1aB2rv75SNiQJTAnkAKquAd0Bi8/VyzdH1w1D1mFuU0XQv10fZ4IvJ8o0fun9noT3SbhS8somnug1/ROqqSQs6N/5TlCflR05cU4oHvcPQzPcBBnEAE/u+UMMo0YMSrsFnrmwrwUaa0C82XMq/otisfA9lo+s3aURomAOaLUpM9MHVTYIjqTQ5FHZnNv/a7G8CBoM/gQxetuMVwum5Cp4kztwx2aMmOUXV7Dcmw8YF6pm85X8itR+IDfgWXKjUO+pKU0oAyPF/8v5hGB+pxqwJyYuT1+zuX6A1xYnPEHF2flgjxiz2vspfTEaUcQ== 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=P61OCTga7/L7sv2b8pYEkMFxQMAu92huSq5CN9OqBfU=; b=AHxg6SgMb5a8xKCQgBwVYNYQdD0wQoKoOjtA3F+kKr/EnN79zXH60YrWDqFCukUjfmkalNbVXEJCOzEHn7sYPL0cFDzT4xr8XOGQofLx/43E5VP7RO9iZ+yj5VDxYHCcoqYlSgFd05gioy4RetNdWtqt8upfm1L7Gn9O/2X4ZBmJ0hnSWFoA7l36/Yy0kFVEe71UDDN363hnibyuiFIbha+vXtuThzF+xBP3/KiRZN3zkNMg3SMPxS5ByF8zNPWANTwz6+I3H9tuxvMMOxzCjJu+2Dw+s0SStr3nTOES9ZXrECxx2zGPqKYN8Yo641L6qE5hxFedy6/2ATwhaQnG0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:02 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:02 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/9] include: Add new definitions Date: Tue, 7 Jun 2022 14:43:35 -0700 Message-Id: <20220607214342.19463-3-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d435fb70-c988-45f5-4491-08da48ced62c X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5QzetSJl+7gnUQO8Wh/oprZ5jMuuB6yE3glaNEwTXL0QvGe2S5THL9qNbsiQsXjVRnC/NDUWtI84nAbVQImBLdxDBApUXcuE+5CeUS0kixujY4FvphAMOcV6CmOI/z/6YDY2tP8tJRK6+cfnD4FNHHX4XJy0qjvvV6wo9Z6zDu/TzWHSZ2kUsiokEKuL+aKt77/gm7bel32Lcsdo38tRSrCeNiRcg8VhDU+E5GktGClMhOl1gpiUYyPjIbKmkHiAT53U+aA7Ibd0f8Fwcz8605XFSydWw5ybBROs1QZvThbe2DQj79lwBW1akJYIumIurSlLGU80Bc/0he9qOFpQt8gOo9EH2ySBDxm0QhTKDbvrhOR842tnT8FiOxFX6ph1rUT11jY+vZEjh2PRaTkwF5LHJCz7jQab3J9wS/MZ8kh9izXkJWiFbhuxuPaP2hS2pN3t3Qrxi1KP1Ty6vJc4c8zMoVu8GAYfOU6Mwcjzd15KkIm+C9gzIHTvegclkhpqUbVSzEFnSoM14LQtbUdyaT3uli4eCFZJQO9ksR3H4vExKASAiGmT/RgzL0iP1aewXIxK8R1XUJ2vENYZYnoCYqVQlznNTY0WxyyVpSLnnT0YgI52BxKCKZJzH4noyBn7FP9lgKbi1j3mvwehLdc7gSfqRxUkJZM8xw0Psn0enVqI/dfIe3SYNOi9yVo1qTpEc2s40UxzAXAZaU1iv/KY//rYLLF97O3ZilwutTrOC6A= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(83380400001)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(966005)(6506007)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u+V5RHV2HoYp/zUiI0SJufqzCG5zOmyFAOgOwqnSgXiK5jjnM5NouEWIIlNj6RmdDzhFyK+W0oVOsYpAe8J8AAEZvmuk1MEc8PKWcJW9Cjr7nA33fxFd3EbBFqiTt48PlNZJRY6t1ubeQrnfKTPf8O8Hs5T6eBQkcqcy8G488MTIxr93Tm8+n52aFkUL4oPvNBq/5icj/N8c7XkuR9vMAg+YpNdrHFBZFjVtAKFok28WlVjcuK/JbAsCfX/PT0xS3iuoFHH/4K6K6Y6sG4LfP7AdcpkJHNmnzUa/j35y116WnGgQDOkUz7NQwxdoIB8FL+1akqtyRPNA5m0m8fGrdw/KMjcDmduSvmGEIeRd84Hbn3mdYKEEWl3PeXmX34HEMa6Clyhjw3JgZz3jdBLLtmdEyCKgS57odJ0wZqnqmKRM/z49TuRBiXno7UzlmkHgVq9oYoketmkNhRb+UiRnibRtSC7L30zLeCMAVt1+s6GAbGSRP1aBZc9OLNcvVJbbXB2a5//rmP+QNNsWWO41Ym4zRAXMzSxTfNvyFH83gXnx8NwrnD1Vz4QzbhI3VcJMYz/rkCv1i/3cpQdryB8ZFZVbcISVB4V3MaSumOxPF7rTGcbibcd2C3FyJj1nGqUAoAc0VtpQUYepal+Wl+rB787t3lypkYH4a1nS8qk23kJPoME/3Z0QirLdX2/4J5YNbgAtM20rCoYnB3gCdDedoxrPxZ7MT8dqr9WBQK5uwG9G6HNJuknUSUZJdGZybmzrROfigK6GgzxpQjdwT+92xlBR3MkAYNDxwwl1hF59ESOWVPkCDh0UL20uJbT6uXTx5Eyq7IIlVQRaNWP3LRsMMdno3Pr7Vm1AxLnVtt2MJOl4wqf7iRDso395VFW2vkBN/ubfyMMCTGJXOtCy3uQOa/it633Vr78a7S6VfkU8d1wxXc9CEEcpL3KqZJUL/Eh8pK09xY5VINgLTyoL9bFnn4urCOTQEOPNtMfXj0Ptfxeb3yE7ZbfjAMQD+GOa7/+DBWzcVjlYPAnlY7dsYj3aJhq6tAHg1JZC6+H9hzdyftMucdwWsePObau+pZ4H7ooCwIKUDydusw78jxY5gj66i/vcSVFDnExrtH2QjWO6KPPHHoOyPzULqHH5knDr+l6xUdQKU2nyaD/TxRikUWPtg728zaqW1vdBOXgCjPilUltjeRSdLn450vO9hBM582KiXCRW4CkaVYELzU/I2QTif6jzQHnz97LAiMlDajHn7hAQLK0g3Dnx1ME2HQlCoPkiZFns0d0H96Eu25O38jrgjOI4M79or3Pp92ooRnjx+jEjVzUN3lrTHEZ3ylfkts1y2hCYmTDLU9lPMXBL/b85z9fvG7QIQ7qgSDd4LZGaDajTFVtI8xkGiO5utKtrAIXq+mJ01rTez+kA38Fb3755fxpYKi/IHWXG0VRE014ZlzcK5zZ1obQGbTUE02uwPJwvajpfKzFb4yl2dFEPfiHYcH1VROj2aK1Tv4LL4QnGmD57JEMUH2jUbUq89GhOL0Pas8U4Ip6gxOAIIkxnHV6xcvqjEhLF7g/VrnFpBX36ShXeIgOQCHeSGRhMg9i4JkmR7mq+uRqzIB+RDjzdpbVBQQNy7nfdwWUky9sYYrZrBmUpDnKFFIpQmSieBqPUBVP6lYGkBTksETDmnOjQ2+MHB2EOmCK9kaHUFznzjm6Ap0KsYN3+ipTuOpzmBBmsEAm4VUfXBgccKdyOYIVbCeEA6UGYF9Coc6h0usulFUmxBFJToI1w3py7mqZETTvawwjb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d435fb70-c988-45f5-4491-08da48ced62c X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:02.1440 (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: VW0g+mufL6AkEJ3ik0QIg1cn14wT7PjP4KhOk7AZ7vH12Y/B9POtrbFlJC1nmEwP6VYgCapewpPiLGPsfQ/Zog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=817 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-GUID: ySyJFONiNKTB5y6L8pnc1Fxk78H64P1k X-Proofpoint-ORIG-GUID: ySyJFONiNKTB5y6L8pnc1Fxk78H64P1k X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" include/ * btf.h: Add BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG defines. Update comments. (struct btf_decl_tag): New. * dwarf2.def: Add new DWARF extension DW_TAG_GNU_annotation. --- include/btf.h | 17 +++++++++++++++-- include/dwarf2.def | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/btf.h b/include/btf.h index 78b551ced23..37deaef8b48 100644 --- a/include/btf.h +++ b/include/btf.h @@ -69,7 +69,7 @@ struct btf_type /* SIZE is used by INT, ENUM, STRUCT, UNION, DATASEC kinds. TYPE is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT, FUNC, - FUNC_PROTO and VAR kinds. */ + FUNC_PROTO, VAR and DECL_TAG kinds. */ union { uint32_t size; /* Size of the entire type, in bytes. */ @@ -109,7 +109,9 @@ struct btf_type #define BTF_KIND_VAR 14 /* Variable. */ #define BTF_KIND_DATASEC 15 /* Section such as .bss or .data. */ #define BTF_KIND_FLOAT 16 /* Floating point. */ -#define BTF_KIND_MAX BTF_KIND_FLOAT +#define BTF_KIND_DECL_TAG 17 /* Decl Tag. */ +#define BTF_KIND_TYPE_TAG 18 /* Type Tag. */ +#define BTF_KIND_MAX BTF_KIND_TYPE_TAG #define NR_BTF_KINDS (BTF_KIND_MAX + 1) /* For some BTF_KINDs, struct btf_type is immediately followed by @@ -190,6 +192,17 @@ struct btf_var_secinfo uint32_t size; /* Size (in bytes) of variable. */ }; +/* BTF_KIND_DECL_TAG is followed by a single struct btf_decl_tag, which + describes the tag location: + - If component_idx == -1, then the tag is applied to a struct, union, + variable or function. + - Otherwise it is applied to a struct/union member or function argument + with the given given index numbered 0..vlen-1. */ +struct btf_decl_tag +{ + int32_t component_idx; +}; + #ifdef __cplusplus } #endif diff --git a/include/dwarf2.def b/include/dwarf2.def index 530c6f849f9..a1f7a47a036 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -174,6 +174,10 @@ DW_TAG (DW_TAG_GNU_formal_parameter_pack, 0x4108) are properly part of DWARF 5. */ DW_TAG (DW_TAG_GNU_call_site, 0x4109) DW_TAG (DW_TAG_GNU_call_site_parameter, 0x410a) + +/* Extension for BTF annotations. */ +DW_TAG (DW_TAG_GNU_annotation, 0x6000) + /* Extensions for UPC. See: http://dwarfstd.org/doc/DWARF4.pdf. */ DW_TAG (DW_TAG_upc_shared_type, 0x8765) DW_TAG (DW_TAG_upc_strict_type, 0x8766) From patchwork Tue Jun 7 21:43:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54919 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE66C3954437 for ; Tue, 7 Jun 2022 21:47:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE66C3954437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638456; bh=tBdF04BHYVsVFyXdnLNcmnnX8A6RQChamTOmNPTlR6I=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=T5oAh/4jCUK79FHGiX+Ehr73zkuhv4qrFrTlLAbnKHrdZjOsGx6ef7xFs0jfJ5Um8 qaOi263eEt+EbYSUD98yOevfLWPg4+P7mOtTSXrILfoaNh79em2Ip8Yf12e62KCxrZ 1sb7h5Aaog8aveshJemDLB7Fmd/TSn6yPdgAXjXk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 081E83954430 for ; Tue, 7 Jun 2022 21:44:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 081E83954430 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IQHSm010464; Tue, 7 Jun 2022 21:44:05 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gfyxsf1s6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:05 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257Le3jU016431; Tue, 7 Jun 2022 21:44:04 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gfwu31y4p-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mazvZwKCgCtWxwgLt1cZdmyOy6G/YGAjC43DLFU2NHn7kZiyRDbsLEeaY/sgzmOzKFtT5dwqi2Wa+qla+vNZSZfiF+JPJ5/5GE0MGqpMBpruXJK14euOme4S+2/jtW7yoiJHyfqkmUQkPWdb5ka4C6F1pRZXjGqUi15kV+9PTYoHKscIUqg7vzExeUVQ3MyUay5/p8r0mAMssEjbHOOZzdl8tKKNPaijmp+UKJ+2Hnd5oUhjfPQ7LkbILm2oaxKDjwH/2dcJUNh+4m7hvs1r6d0QXGpcnk1dIS6aJQWFYm5Hhn4hzHhg/GpA5Wclv7fJ2ISQIm4N1T6PlurF4NCeGw== 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=tBdF04BHYVsVFyXdnLNcmnnX8A6RQChamTOmNPTlR6I=; b=hIKWBPaaXK2GZridsTyaBAd+9c6e/gW545dSC4I/lOMbzv9ofIPw5WccjhID3lZKN/Qz6OAhKpvYZFNsrtHkrJ0QTHbTdHSSr6KbClg8CqNAbzn+npd3xePOnGbnWcP16aZBRYL1nlGxu6X359hPJgnnnMH9OcDX7JNkubCtwt1przBce+wOdRW3pUnT2MUYC4Gu4459RU1mu+qfdfq2EL6w+ZIi5rFQEFA79Achh6YXxbm2LgCgVSNFigUVfsahpfFk6PyxdO069fO/Dq/fc86O5uuRWEsd1H747X/4R56HzamT449JMowM6ZHqxtD7Sg2dp7TT9Ai/t2jd46yB2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:03 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:03 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/9] c-family: Add debug_annotate attribute handlers Date: Tue, 7 Jun 2022 14:43:36 -0700 Message-Id: <20220607214342.19463-4-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 40f6969a-30aa-4d3c-b14b-08da48ced6bd X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uQ3uMSbAo2Ai1BGD2qmM4ePDaCIVf5I5XN36zAOZToJDtNqKnLwQrNlKRkdSFdwmXUAxqnDkudPJDLn8Y7sPCC+jV6ceR4tJk2L0Crvxo1IlpTBaZ6bTlk7ktB5OREbTClS7SmWn78LVlU4/zjjo+mU5SdfZqyVc0Y4tVepWYDxSiK6kAASJEpTVsHib7MhH8ERb41/MW7o0kh7aqc+3eU5GMzA5ppjqo7apqggZ8t5lkg2SS1PYz2eMI+tBc33mEHpnBVFozWNbHLP2draOJ2xcdqZxM5/zEruZrB20fCyJqGBjBVK4bgl9VGQ9RFsX9Ylv0wFRNrWMcvSaMh6zddDAYllkEqOTIVqvPfqfybmZiTyXjDSzIixWMTjWIIg7PdR66zxX8dlgiG4Gg1lnohTrz/+9MInnGcSXCjy9gS0c6uxIwXEHchnlGY8k5nZPmsEK08P7mDY1IQ5Kcg/+QOvwAO9a15HdeXfoFJ4sZU27mBVQP7tSpO8htGw3/QlApKBxKVgxJ3QrqmItve5o2S+/OjY3dvb+k9du5+NxJDsEjQF8cEisdbPYYPnGX60z47qH9WQU4ZU2yuJJ9m52YIv39njkBF6MWyyFhm++z8/eP9noE6PUTrmDH1jdQgP13iiydcYDJurLZqM7bSVFJQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(83380400001)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kNhtFa30iRqmGsHM5gXY/cgFG8+CRwPDP9ru8FXIkGvRDvZkpt9J63OnVdz4zguX3LHeSccXGqwggOddVUvFGbW0Wd2asQWd9kBPqAnVHIoWkVKiAteMYAShpz7KrW3MSVawOFkNqy9yldIG9ePPMne3HcuE0l1FXCKTOaGJ1P8A2iugvyVQ2u0EipuUCTipmiIXDfyXIRev4oOzJ7rxuOW0faJZin4puQKmjI/KTXnel3vjdS6H9nBvPrpwbzA9jaJQPdLW0rdi3O3RZp4Fu2BbqYCOu873V7UZsoWNYxLliSVix/Cjg6IbbZ08gvprs/EnGy56cuSACqgJem8ghDPimYdYGbX3CbZDgfieb5G5ciyFuGwBEnioSx+Z7Guxqev8ZsFoJCeF08Xo4muWm7scOlsmRivBf5J3IMCEGhdqmNa1G+3giPjRR+aFSKfzvPVWdXddswxjArrGJjEBwOotT3unNWYXdgg2QuRfJtBt8uVEDeCk8e1zHvzsZa4eLH+GYy6ZOGC6DnSC/OTTt9OxtjZgAyLgG1BsFXZeYRq8KqmGz7aXoJFcWUt4N0vjLRsXj8UrVH1HCqBoNhKKi5ZGNy5fApUlwZQPYIbY4zDXhJzj+2XXbE813vJwuNGeEBVTIjG4zjkiN+McnUnHIgm+9W8f+fMYsXWB1Xvm0fnG9xwRFG5/rCODHIkXj2zAeINo5Tgea2YLMleJ+ZlmYi40oxmFdaEnWRUAd9da2FlrIvLpmWDbb2HgqlBAhlSPtKJCgm5nvFYRXvEJJGsyaHpS3GpzhLOVejLWLaAwCiK8y/adFVzdoV4M2lOpIx3QFRBsmud9y9lzZKxXVy4gGWTATS6aqNqAhX241ojAmIz+neuTWMm8LiCDihjdo+4scanFGzg7xfcHD8633vuI4ukNCEZoRm3+rWHdGICornEKqPlfiRChEINSj6pu7KpKdf0znghHnhRz/gBlO64ahbiIz5ZxmAv2nrtOtH26okBOILE8bY7pEFoEiyqO2mFS5p2nCmiUmTnaInmadDIeFJiuZnDKgXQ0eAIiGuHhFEA9qoj7GUAEAAGHCy7Qg0KezBcKDuTpzAfSlXRgL4XCHe/wUeWm2LoqVBOEEHWiXoV7AjtCzRUavKenlUpfueLlpczojVNheepYjeMKeaB05nLCwjfd4MFUz1wAW2C7hspfxSjhFxj/POxnymUR+at1QY2GYdtZaV7O+GLIhrDaCj5vFJu2SUPbiDAs/PCebnxSbzbCdX15crEZU35khF4acoMt+qNMCGZXnUzNkKPLWe+ZniNlmIdESwz0QSnr21WZviLD9BLCwj+4iVWL5/h989TAd7PX8bcA5Cyr8G8R9oR0dOEQS/3AK+hW+oI9iLl/PlQxDx+XS+GxcGQytAvn42CCcCSRIQ3OX3o78DDhm2XcHXBULc4gYYbzJ4zkXnLoy1gHhFklDXPWIAHMfm/frmeJZTgTc0S6BenvUzQ1vI8m48wYpTYdzbBAPL/RQGvqQGh0wj2pGBFjBRzZLnVkAucx+DALNB6xkidSU0VF9lI4h1ehJjmISOK3q29J54k6r/MQ0PzWNfmrGHxqhU0l+9ta0+78E3/lrcL+OtfSnfdZ6DqrF6DXi2VQsFGs9FJaIgexGOOBV/s8YLjIn+w5XSiMWoNhOlxF921kfuCavvNvam9CwmH8mIt4sTHbaef4HO96ZTi58phss8xo/EZBkyYtDUbPthAFKSelv1eYZfZVIyPKvK9xxD2Ki6tqPWXm9jmO5EhB23zhnwtJkKol X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40f6969a-30aa-4d3c-b14b-08da48ced6bd X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:03.0971 (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: d5MPrkU+0/MBVEp5jH9W5XBUoWjSCRgxeY/iHACf28YAjP3bzV/9a0gnBHjGQiu7gGgFk1nys296+AaEi610hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-ORIG-GUID: gLu9-EgrDOXWzdrO_SFt7qWcSFl5glA0 X-Proofpoint-GUID: gLu9-EgrDOXWzdrO_SFt7qWcSFl5glA0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch adds attribute handlers for two new attributes: "debug_annotate_decl" and "debug_annotate_type". Both attributes accept a single string argument, and are used to add arbitrary annotations to debug information generated for the decls or types to which they apply. gcc/c-family/ * c-attribs.cc (c_common_attribute_table): Add new attributes debug_annotate_decl and debug_annotate_type. (handle_debug_annotate_decl_attribute): New. (handle_debug_annotate_type_attribute): Likewise. --- gcc/c-family/c-attribs.cc | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index c8d96723f4c..50e8fc1b695 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -174,6 +174,9 @@ static tree handle_signed_bool_precision_attribute (tree *, tree, tree, int, bool *); static tree handle_retain_attribute (tree *, tree, tree, int, bool *); +static tree handle_debug_annotate_decl_attribute (tree *, tree, tree, int, bool *); +static tree handle_debug_annotate_type_attribute (tree *, tree, tree, int, bool *); + /* Helper to define attribute exclusions. */ #define ATTR_EXCL(name, function, type, variable) \ { name, function, type, variable } @@ -555,6 +558,10 @@ const struct attribute_spec c_common_attribute_table[] = handle_dealloc_attribute, NULL }, { "tainted_args", 0, 0, true, false, false, false, handle_tainted_args_attribute, NULL }, + { "debug_annotate_decl", 1, 1, false, false, false, false, + handle_debug_annotate_decl_attribute, NULL }, + { "debug_annotate_type", 1, 1, false, true, false, false, + handle_debug_annotate_type_attribute, NULL }, { NULL, 0, 0, false, false, false, false, NULL, NULL } }; @@ -5868,6 +5875,42 @@ handle_tainted_args_attribute (tree *node, tree name, tree, int, return NULL_TREE; } +/* Handle a "debug_annotate_decl" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_debug_annotate_decl_attribute (tree *, tree name, tree args, int, + bool *no_add_attrs) +{ + if (!args) + *no_add_attrs = true; + else if (TREE_CODE (TREE_VALUE (args)) != STRING_CST) + { + error ("%qE attribute requires a string", name); + *no_add_attrs = true; + } + + return NULL_TREE; +} + +/* Handle a "debug_annotate_type" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_debug_annotate_type_attribute (tree *, tree name, tree args, int, + bool *no_add_attrs) +{ + if (!args) + *no_add_attrs = true; + else if (TREE_CODE (TREE_VALUE (args)) != STRING_CST) + { + error ("%qE attribute requires a string", name); + *no_add_attrs = true; + } + + return NULL_TREE; +} + /* Attempt to partially validate a single attribute ATTR as if it were to be applied to an entity OPER. */ From patchwork Tue Jun 7 21:43:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54922 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 99D2F3856DEF for ; Tue, 7 Jun 2022 21:50:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99D2F3856DEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638631; bh=p0rT+e/BsYBNuLmMzaxIBx0hjMcu/QYFugJzbyFARik=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=KrU8htzQoff9nn+/Fp4kU8nmz9IOIjDeX4HT1me8AMjU6rtMJ3HZ8NGfZWBIEjutu CQZebVpZAv2Ck+9Pll8acm9QNyk66plKDyeNBEUZLXSTZkaOOp8EDGXIb6EkEAnaOA SxrLLdpRttFrWNWkL0DTT9nTbDNIlO4gS/uHreJQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id CCCEC3954450 for ; Tue, 7 Jun 2022 21:44:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCCEC3954450 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IYMBk010570; Tue, 7 Jun 2022 21:44:08 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ghvs3ac1v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257Ldwat016135; Tue, 7 Jun 2022 21:44:06 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gfwu31y54-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HI7LlRFhFGZIifT51aooHV5MPxCQI4yPnMHlqn9V7N759sKzx5+G6BTVWvXbduv0sOIam4zb6G+8zVq7Z+Uj7Zn3tGgDk8eunL2uP4N013ERu1Nl0YSoCpDupn9n6np0H6zr5xIvOd3gR2LGl0Mi1iYfLg0OanM6KIyDNUFye84GtBkTw1ynpRa367QqdXfGWrKcmtHdThuBMN5+TrqF1JtNWzs7LQPjMcGNQ1btNg+X/QWuteM/Rs3k4wjGbGUHaqRDmXCaBRflLRiZTUoo6jQXd/FYTZSl10Xes826+JrJFwvB+e+9qeBTiyRVNopIK4hj1m8V+fhbdsE1f2ugMQ== 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=p0rT+e/BsYBNuLmMzaxIBx0hjMcu/QYFugJzbyFARik=; b=lrQWmEswRLSVejIF0WUdQFAe5fqekQtwae71k+GonbEblr5D56Wn3i4oEt6C8eQP5R+c7HBOtTROdpVH/Fu3rvc3pwFl8Rt84zQN8zpD0+6Rcvdfhx2CBIS4e6H+j/wCgyykz5JJn8kbOQ+aJ9szFFu0I4onPEOFCg5uKP+l6tmlAgX6Po2q0dORyxmzOfwEvBOZFniEIeOJmPF4aMTaDG9LXThD5hzkArxnnNVpiaVH9RgQCrrU49MO5wUsI7jjG15nWl9Isfjdp00v6QvIPmHKlvWqVWW3YLNOnee91VeP86sZZ9qo/+Rm9/kVo/3JTLL4rKy5xQOBHh/2NBox+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:04 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:04 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 4/9] dwarf: generate annotation DIEs Date: Tue, 7 Jun 2022 14:43:37 -0700 Message-Id: <20220607214342.19463-5-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03fc503e-2f33-4e1d-805c-08da48ced751 X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2LEhax8tZT90sj7Fea8zc6cWSGRoH3PLT/s4zRC7R5dgB3WrfCNOjOHJf9nVRzZnJWLhjZ+Vvjcm3WSjKI6IK/eQFgQno8Q8DbYQZNk/6m4ig2QvaKlAYqK4cSoeQSNG4BQqCdGWYsaRW3+S/3CSON50Cbq2jKdC7crnPe9flzYO8rx6Fk0U/GLF8tK2tFCj7uSYMNAT0n21aVMzpkrRjk+dGzCpZzANdqBfap/PgmUIZWyBA9zjRYYLPJobAAgKPDSpuE8JlYn4F3c+yYGgJ0f+epJSJnd/vMeU5HwQUVGL6tueGjfRi2Byv5bpFF848Uxnf9+NxIq3y/cjxHDbPNV6fUvI3sKNBQU2jkx491JOIMSeaXPvMzbZJNwXSgjhDQA4gZ5hQX3oRbLYPwtmoTTqKuvSVHkFUVu7OIGtoJOiCQ9N0YVwqK01pixGlvpoXBsIJxsO9akcZQAB0BEJWjTjuq0ghkGl7Q0bJc+QERnfGlUtDD+NTO8mkASqA30ITzk21G1EQtoVEupxGoN/sAXYvXuoUO5wGvsX0EDEkVN2NBN25iqKVvwhoLw6Lhb/rzsxxV3DFM3a0F06adfcsYRwOujn+GfVPPVRD6QjhE1PUY/Dc85C0O8GBark7mTExgCeAKTN1Q9kPaH/lqFtJQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lNCRJ6SV4fnHF4A6EJ98VnLzNp/qiQL/oe1dLgiWRynerezpGQydG3TG7Bs67bFE+Fg2ZcabYYezlvIZqx1a7ZMeYEWaNozeJHVH6i1OBGeI+cQOAyVbQHtpBQ446UpPqrjR7TocuFrz8fXjsuIhHEHVDsSKKMlnT8R5VOPcJFpnsj5EgD/zkt8BSS5ru/J5A2aLqt+RJlQWNIXOOJedieGdDxHkJpn7lQZKi4SPHqkuVW03Rq2nms5G2qMnTzb4TQityaCyWysDDGvcp0HXjMleth7x0GOTkgFrgeE16q4LKqMd8mHhPJYWTsnxo1Bltr0+u6m/4dVob0VW9kTQUTkGkLFhMJuz9jbawqyjdoc5oeob1W/O+l8TsOPmSGDSs2bz+kox4c1ms2WBhUk9MpizNitRtm51YaKoUK3FevMuNcPNvbpIgdBnqqSdkYAerTAx7X3LJvdWQhPYNiW+2g4WgeCBl8fcdhx72sHjF8WzMfIEqaxF5jZj9o62mdbQ5tRcf51JbWvJvDCqT7nWwYPJiA4MEKqp7EyqGS+HAKEcdSNMBvsCEJA1kbt+vkUtJy29i3nONnpnQuIZnaTSgTWByOkLt4fPGF14m+Dz8wJ53a7vKWHUcGz1XOWXPh/SF8v5uYdMsU0sRxddUl9OuxwY1mgtiLTExURUduZaRs+otzupwvZraij8z7o69HMZR7WXzTT3AkppsRUqsDnwOwtbjS+cWY3TYFUvbQe7Wpyhr0u30bd699PZrWJ4z68axlJeFv5DfW8hTF6hbX/O5mKNo1vQ+A/dG6GRdKmfEv5/6JEFEuI0gdozFompz/OU8z1XdWzkMmi6Ll9TyaspxwAnAFA/ctHhAEV4t2bsLqb2WWnTUydSavXecDCPbYguzKRGo/dgX7rtPT9yxnASMC+t3Tnpmdk4X4zvEc3lCTEFtzVVJKYH7b6f9G31EkQidimeJ9HM3G0xy3zCIfwq5hr1nTgSmMNsBfL/plpy5icP2tfFsmNcPqfD8J6i9YLP+M5bVU6hwiqplf7EKz7xDfXclISLwIkJFM+H4TLuZ58lTRVmFRdTDwo6fHpT2289h9xXHZ9dWkBhjpgqBRcLJJl+q4dX+1SUc9QMOb2z4N/M/M/SQ6h/mH9m9gX0GiFX3IAO+3hPhjNzkarAC0d0PGtPmK/C423Mr2Bs3sx5VxxQfpT1r3dpaTqm4Ns/RmlCOmg8Yww2S4hYbE5bAohG4C1wnAXW9/DXqu6duG7MS9VYZAIVLbBZNAm0cCYCa8lsGsQoxAY57X0eq+nwBnC3Ay6np8oEKp8CGNQv53dgYU2chS7HdOamv6KWqdEnyTkN769U5omLd2SoEIr37CApcZ3GqJ/4ikFhhgcQcwnNwn3QkCEBii18dOPJwujct1qz3Rj9FeVXVg51w+pi6jetX06cIA2GSRV71Uo8Tab8gbbrQffj1v2HXqsYJgmSh5m0WuMNju7M0FdTccMKI6K2y8Jl6qEd5nZdd7i9gHdsh9RfXz/G49wzaHcZJznzw2msW4RBX/Z/ypbLxKu9W1BRxjAUx3/6hZ7hSclu03ojNE99yyet/aJiZZ45p1r+T5ympu2RYDszvbK6xyNF7T872me8gfgEyo9AwywirXPmMuOioL2mVuFDaVb/rNYhWt+uapQ1UvbSx6wUvrlhFc+gVgMsShiQ6hSmeqPpyxtKeHcTGMWS/cVlDWXECn5b+56dyIQcCBNLbLRrwfeNB1Ue8EvjacxG1kYq2K+9lPnhnw2q5u20oRKdV+qchOIFtluw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03fc503e-2f33-4e1d-805c-08da48ced751 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:04.0814 (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: h1psVi6aJeyijtzt4/C/nA42mssOD4WFsJAar5uVr77Q6qG/hXRSt5xxnEjgTvLyjbSBr033FDrRp7PWeg3zzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-ORIG-GUID: bvWPjpjHeTi-YzXRi9uHhTAZ6FumenGB X-Proofpoint-GUID: bvWPjpjHeTi-YzXRi9uHhTAZ6FumenGB X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" The "debug_annotate_decl" and "debug_annotate_type" attributes are handled by constructing DW_TAG_GNU_annotation DIEs. These DIEs are children of the declarations or types which they annotate, and convey the information via a string constant. gcc/ * dwarf2out.cc (gen_decl_annotation_dies): New function. (gen_type_annotation_dies): Likewise. (modified_type_die): Call them here, if appropriate. (gen_formal_parameter_die): Likewise. (gen_typedef_die): Likewise. (gen_type_die): Likewise. (gen_decl_die): Likewise. --- gcc/dwarf2out.cc | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 9c61026bb34..aff9f72bd55 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13611,6 +13611,78 @@ long_double_as_float128 (tree type) return NULL_TREE; } +/* Given a tree T, which may be a decl or a type, process any + "debug_annotate_decl" attributes on T, provided in ATTR. Construct + DW_TAG_GNU_annotation DIEs appropriately as children of TARGET, usually + the DIE for T. */ + +static void +gen_decl_annotation_dies (tree t, dw_die_ref target) +{ + dw_die_ref die; + tree attr; + + if (t == NULL_TREE || !target) + return; + + if (TYPE_P (t)) + attr = lookup_attribute ("debug_annotate_decl", TYPE_ATTRIBUTES (t)); + else if (DECL_P (t)) + attr = lookup_attribute ("debug_annotate_decl", DECL_ATTRIBUTES (t)); + else + /* This is an error. */ + gcc_unreachable (); + + while (attr != NULL_TREE) + { + die = new_die (DW_TAG_GNU_annotation, target, t); + add_name_attribute (die, IDENTIFIER_POINTER (get_attribute_name (attr))); + add_AT_string (die, DW_AT_const_value, + TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr)))); + attr = TREE_CHAIN (attr); + } + + /* Strip the decl tag attribute to avoid creating multiple copies if we hit + this tree node again in some recursive call. */ + if (TYPE_P (t)) + TYPE_ATTRIBUTES (t) = + remove_attribute ("debug_annotate_decl", TYPE_ATTRIBUTES (t)); + else if (DECL_P (t)) + DECL_ATTRIBUTES (t) = + remove_attribute ("debug_annotate_decl", DECL_ATTRIBUTES (t)); +} + +/* Given a tree TYPE, process any "debug_annotate_type" attributes on + TYPE. Construct DW_TAG_GNU_annotation DIEs appropriately as children of + TARGET, usually the DIE for TYPE. */ + +static void +gen_type_annotation_dies (tree type, dw_die_ref target) +{ + dw_die_ref die; + tree attr; + + if (type == NULL_TREE || !target) + return; + + gcc_assert (TYPE_P (type)); + + attr = lookup_attribute ("debug_annotate_type", TYPE_ATTRIBUTES (type)); + while (attr != NULL_TREE) + { + die = new_die (DW_TAG_GNU_annotation, target, type); + add_name_attribute (die, IDENTIFIER_POINTER (get_attribute_name (attr))); + add_AT_string (die, DW_AT_const_value, + TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr)))); + attr = TREE_CHAIN (attr); + } + + /* Strip the type tag attribute to avoid creating multiple copies if we hit + this type again in some recursive call. */ + TYPE_ATTRIBUTES (type) = + remove_attribute ("debug_annotate_type", TYPE_ATTRIBUTES (type)); +} + /* Given a pointer to an arbitrary ..._TYPE tree node, return a debugging entry that chains the modifiers specified by CV_QUALS in front of the given type. REVERSE is true if the type is to be interpreted in the @@ -14009,6 +14081,9 @@ modified_type_die (tree type, int cv_quals, bool reverse, if (TYPE_ARTIFICIAL (type)) add_AT_flag (mod_type_die, DW_AT_artificial, 1); + /* Generate any annotation DIEs on this type. */ + gen_type_annotation_dies (type, mod_type_die); + return mod_type_die; } @@ -23002,6 +23077,9 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, gcc_unreachable (); } + /* Generate any annotation DIEs for this decl. */ + gen_decl_annotation_dies (node, parm_die); + return parm_die; } @@ -26076,6 +26154,9 @@ gen_typedef_die (tree decl, dw_die_ref context_die) if (get_AT (type_die, DW_AT_name)) add_pubtype (decl, type_die); + + /* Generate any annotation DIEs for the typedef. */ + gen_decl_annotation_dies (decl, type_die); } /* Generate a DIE for a struct, class, enum or union type. */ @@ -26389,6 +26470,16 @@ gen_type_die (tree type, dw_die_ref context_die) if (die) check_die (die); } + + /* Generate any annotation DIEs on the type. */ + dw_die_ref die = lookup_type_die (type); + if (die) + { + gen_type_annotation_dies (type, die); + + /* "decl" annotations may also be attached to a type. */ + gen_decl_annotation_dies (type, die); + } } } @@ -27145,6 +27236,9 @@ gen_decl_die (tree decl, tree origin, struct vlr_context *ctx, break; } + /* Generate any annotation DIEs for the decl. */ + gen_decl_annotation_dies (decl, lookup_decl_die (decl_or_origin)); + return NULL; } From patchwork Tue Jun 7 21:43:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54920 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED137395440F for ; Tue, 7 Jun 2022 21:48:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED137395440F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638515; bh=FpSmdvvF7DXm39z3U3I05X7+UUt0Koo4Rs+QANFnXso=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=miBP8HkWRoYlCYiPaVqoXKPqPFp6jHFsSIIokkYiqKHMumhocs1WuWmXewPMgGJfC na2EiKYNx4BSXDO0ALgzsCuY1zsgif7nt+OxXrztV8UX6l3iuPacq5QL+EI9VaenJ1 V+FheNaqdFOgkMo4tr5lIJejfLExBSiUWFrX4vVc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id C917E395253A for ; Tue, 7 Jun 2022 21:44:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C917E395253A Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IJH8N006530; Tue, 7 Jun 2022 21:44:07 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ghexecbft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257Ldwau016135; Tue, 7 Jun 2022 21:44:07 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gfwu31y54-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UcV3VoW8CKmzhxC/Yk1OfkObeLNF6ydYPnoai+DX9Q709yNuI12oxeyVUQ5tkQ0RrOO7w3Y8bIg1HqwjCtOQ3YHd6nnr61eVPyzWjrQ+6sqmLZoEhTIVuq+9Plp8UHbX0qs4bLEI9EfQ6X1thK+WaH/WGnECzTjPOJSugiqu0ro+bYEFUMkV9+DzYgmeWXqBK1jV7lb4wnGKym9zbOwpaXlI2AssrUw7nwunRYMFlhNJNpwxYdDAOVxNZLn/SjxNmyEh+HZUX0s5fY/PE18kxr5kbORQ0boFisEgepApS6LjjBmDW6DW2bQ3LVQ6JX7vwo26L4QS2mIIdRg/7bDLbA== 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=FpSmdvvF7DXm39z3U3I05X7+UUt0Koo4Rs+QANFnXso=; b=dYAcPZC5sfEvbtUC+KlUdxQqa8TzpWYdE35xF41RxOPSkO+JN4PNfVG6ztjK3B4aPXjb+FdHPtgmKxyqymn9bdZRonPCHAkyxo3Jn+p7jAI+sJFVw3EiPyyZygWhOtWrCp8j4qULQoqfnSxcwwNj/8P6ZOtfchSWVCxm0g2E5Er5sHnGXT8+LgEeCN+f2rY++F4HNQk8BeJdIsH+AtGjqkjQt8OhipE00V1Fftb2lboLRSw0ACiqTjZhvtKlkLcsTC9MdgKWLHsDsLpWc9oOWxYqGNGbhT+DPRG2i+drRxfAHwShEVXEB/HxgoPvNQwRqLUUXdfVo1ZwR8EwBxG0AA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:05 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:05 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 5/9] ctfc: pass through debug annotations to BTF Date: Tue, 7 Jun 2022 14:43:38 -0700 Message-Id: <20220607214342.19463-6-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b4f9094-46ff-405e-1403-08da48ced7ea X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rya+Dq0z3fJdLdC2ws4Yovm6p8X7001e3TLPpKxNUlJIqHnX5vUnEnAEB4dGLydqhXjrb48cJsT1brDoyxbQf7h/5DNAoK28LYwQU3PN8N5x2xnbEXHkLFKKz+nQXc5XLqWAj3QlhkWBEjFIinzpPhzbin6y3TsEv61NpVC1ESQcN1hOu0GsGxLEjntInPTPHz86sUnJyuBj/NGTVWd0rc8RsMtJl4DN4gHZwPPLrrnjHWyTEpkHjh3WTC31A1jSxzfe/WTraemTd9YokiGzNYI9fmyqXeBKPkY2KORClYE5kiwaV5z1hg87U2gWk8ICprzZRVhd4ZkS0Rl20KOgUcfPce6hdTPr/L+TxSH1ANNv4kmrsD5BOMLujJHzAU5O8uGRtudMoRgQwZJFjHRpAxcspzVhtzBx764frTfpaUmi6Tw88+1vwRX6cXQakEwkINZVDvX4mVObzMtR5tZ+RUsbcPLfzi0nHgJAEGfBA2xq1VoJ2/8IrGDnGOCCVxqTc3azNmlGAZsOTBJmkm6hSZdCvZhYY25LulIixMK1frY2lSSMYXHIyM8CJcbnA1kD1B4sjP/4/Xci+3Uu7SY+4HMv9tahm5vDTzYEaFJo3hIOXfY9lQTuPkTqEo++Ze0krC7tsD0iBwNgJholF/lnCsVaoJlwUpF5T5j3f+ztFnqwF3c6nxuGlmI/xdxKvkY1cRdyZjHMl8/Yz3n7Fh+vX3hslfqC4hp/ASq6y3Y/m7rAHwJ1CpPl0QrKFpQ23tzT9aOA0QZtIhnTVDNaiPP32w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(83380400001)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(186003)(52116002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1WK1lN2vV36Kxh0zQwn35yxtoF/tNxrIi6o2oDfrtl9fzixaCwsKmlS75Nfwqcvo27GPHysGIgtqxspcsk9X602Vd3gwSpx9+2YOsH9gwQAXuHJLcp/vQGWh/wiozq/LlhJgW+s3hkUjWZ036ug2ldUd9xYl8/jqKtXh7Jnwm77hSsVwJy1/Ubu/Kdmi9rPycUFn+Thv4EaWvjWm6deaipkMIelFsoB/cf44IkDvVoHWUMupSoCEmFIOs3IgNDU5SvdIaJ+0PpFTgq9vxYRcrQznsNfayne/8fieuJQbbKjhmHsRdi9wJzeUoOyZJGgGU42DBCmaTIZg/n0VcnEijNQAtJmWZt1wOwPY3eDLlU8uGQYfUGPJnfDnYeU1EieXdrXLSaxqz++5IiYn+KiEQXYs1lpIoSXZfUuJIYkCofMmRsdfBeiIEXxMnF031Ce7YTQHxoKoAXPEnSHXd1BAkuhRoJxQoNMtLGiqR4KuujtviuH+M6pFBCh4mq7PyrsinZM31iRii24tKw6B1O7kzBHtYifbVe2sTSPlVtKoK0zMHFMr33+QFqYM0KaQLctugFiavnJO48rc/kHMexcqQTQHAOdzRDWeQJuLIksU6CVsZiEiULB1Tyalf2wA+vd6L30P8EnXGzDYRD7mH4obPJB4dhz4gzH3bPcD23dwJbzFrtaGV18AFlbylOquRK2kCOX1DA9bqdr1fSVzaHHedlRAfZo5q/3r+6J0ALbrC6mfhMjpLPztVPf2v8XuOtzMKm3iYLoDQaFiL5qa/riwZ2RAKY+sLODYzoUgFY/VWc+w3nFDhrwTMzXc/+oaJnngegJNCJ1/wWaYjZ8cRdE5BFvOkg4GGcImRukal9wqztt7OKxG7Kvs7FZhLKOCdqmJpI6rr6BLVZd2fLQBaGEzFeMJQar+FAWwU+GrEbg71ze5WRKW9lgVyh+x1SHo9ENQPtjVvHDMeGvmzfkrJb2wiY4nlezWq9QdGEuQT1u5cwHDo5EYeXoJbmmb0Kb0CdyfFCVy/z4/hcyCFJV5MuTU/bDz4sS0OSqXaBuzFZcxQe3Zm5Fz88Ph7+oKgExF7tmazbq4VWHYya5OPZFj7AUEwFR4LO1ytQ0D5KQegpk6xLwoCBnCKdSK+ayLQpb+fBSEqTE5OL+MyPv7b2jo7Sl9n8f06IYIzDUCouUn8KflSeVGW/fy/S1XS4TKF8LEt7rHKLHxTJstEp/UDNIG46TBBCRtxIfv6UcU6UhkblmzO+UasxoLWrtOnLwzX/q5uf5ZFtvO3L/uYqaos7NAc/wUp8EqfLvX4oZxuynq4vq3GeCHeAT+taTZogK0+JlZn74jbHcLxQfaojdxLPbLQuhDwrIzSh8D7OSOC1lTgYCLlhXJBm1b6dMKh/hltsqXF2O6bp07Y8bWvW+3qRCmF4AzKI/hmPx1tgtCk84wcmfhUYWRAjrgJqi3SjHeS7/PwybY+gOERSL2IMLMl7KS2JIx/i/J5o1F27KGLI3UK0aDJGtSmpebgOdMfsEqFXp2cBDIUkN4+rQYR6YqyCjU6OUPRy8FXshPF36oqI9V0Qu9sM8wG8TS2gEZa7x/dnfwgrDJEftRCqCUd8E2lZUkT+LASgF4jv8jZR09DdQ7EkwVsfVrogP+rfmp8wV0YB4OcdR9/OiyRtD6XkfWxKmwXV07KmckE1oyDobyoKGcp7VmW9mAl8Qlx9FnnoaEKPVQsU3zIsgDsNGJZT5cf7T+RLmdfLqbpGA/ewuNFzXzzdPIz9UpYq0HK3RgTDP1EppWB8XD X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b4f9094-46ff-405e-1403-08da48ced7ea X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:05.1751 (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: YTV+ynNbLngyERiccyvIHPb3hAjZD1smmPLqVbI1xCyk7K08gIZn+PFkwcq9RZFbCZkKpZuSO7pQdi+OosgU5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-GUID: SQlz4-kWEh9rrtajcuexLjv3HpKCseqy X-Proofpoint-ORIG-GUID: SQlz4-kWEh9rrtajcuexLjv3HpKCseqy X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" BTF generation currently relies on the internal CTF representation to convert debug info from DWARF dies. This patch adds a new internal header, "ctf-int.h", which defines CTF kinds to be used internally to represent BTF tags which must pass through the CTF container. It also adds a new type for representing information specific to those tags, and a member for that type in ctf_dtdef. This patch also updates ctf_add_reftype to accept a const char * name, and add it for the newly added type. gcc/ * ctf-int.h: New file. * ctfc.cc (ctf_add_reftype): Add NAME parameter. Pass it to ctf_add_generic call. (ctf_add_pointer): Update ctf_add_reftype call accordingly. * ctfc.h (ctf_add_reftype): Analogous change. (ctf_btf_annotation): New. (ctf_dtdef): Add member for it. (enum ctf_dtu_d_union_enum): Likewise. * dwarf2ctf.cc (gen_ctf_modifier_type): Update call to ctf_add_reftype accordingly. --- gcc/ctf-int.h | 29 +++++++++++++++++++++++++++++ gcc/ctfc.cc | 11 +++++++---- gcc/ctfc.h | 17 ++++++++++++++--- gcc/dwarf2ctf.cc | 2 +- 4 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 gcc/ctf-int.h diff --git a/gcc/ctf-int.h b/gcc/ctf-int.h new file mode 100644 index 00000000000..fb5f4aacad6 --- /dev/null +++ b/gcc/ctf-int.h @@ -0,0 +1,29 @@ +/* ctf-int.h - GCC internal definitions used for CTF debug info. + Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC 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, or (at your option) any later +version. + +GCC 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 +. */ + +#ifndef GCC_CTF_INT_H +#define GCC_CTF_INT_H 1 + +/* These CTF kinds only exist as a bridge to generating BTF types for + BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG. They do not correspond to any + representable type kind in CTF. */ +#define CTF_K_DECL_TAG 62 +#define CTF_K_TYPE_TAG 63 + +#endif /* GCC_CTF_INT_H */ diff --git a/gcc/ctfc.cc b/gcc/ctfc.cc index f24e7bff948..a0404520b2a 100644 --- a/gcc/ctfc.cc +++ b/gcc/ctfc.cc @@ -107,6 +107,9 @@ ctf_dtu_d_union_selector (ctf_dtdef_ref ctftype) return CTF_DTU_D_ARGUMENTS; case CTF_K_SLICE: return CTF_DTU_D_SLICE; + case CTF_K_DECL_TAG: + case CTF_K_TYPE_TAG: + return CTF_DTU_D_BTFNOTE; default: /* The largest member as default. */ return CTF_DTU_D_ARRAY; @@ -428,15 +431,15 @@ ctf_add_encoded (ctf_container_ref ctfc, uint32_t flag, const char * name, } ctf_id_t -ctf_add_reftype (ctf_container_ref ctfc, uint32_t flag, ctf_id_t ref, - uint32_t kind, dw_die_ref die) +ctf_add_reftype (ctf_container_ref ctfc, uint32_t flag, const char * name, + ctf_id_t ref, uint32_t kind, dw_die_ref die) { ctf_dtdef_ref dtd; ctf_id_t type; gcc_assert (ref <= CTF_MAX_TYPE); - type = ctf_add_generic (ctfc, flag, NULL, &dtd, die); + type = ctf_add_generic (ctfc, flag, name, &dtd, die); dtd->dtd_data.ctti_info = CTF_TYPE_INFO (kind, flag, 0); /* Caller of this API must guarantee that a CTF type with id = ref already exists. This will also be validated for us at link-time. */ @@ -548,7 +551,7 @@ ctf_id_t ctf_add_pointer (ctf_container_ref ctfc, uint32_t flag, ctf_id_t ref, dw_die_ref die) { - return (ctf_add_reftype (ctfc, flag, ref, CTF_K_POINTER, die)); + return (ctf_add_reftype (ctfc, flag, NULL, ref, CTF_K_POINTER, die)); } ctf_id_t diff --git a/gcc/ctfc.h b/gcc/ctfc.h index 001e544ef08..fab18f024d7 100644 --- a/gcc/ctfc.h +++ b/gcc/ctfc.h @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see #include "dwarf2ctf.h" #include "ctf.h" #include "btf.h" +#include "ctf-int.h" /* Invalid CTF type ID definition. */ @@ -151,6 +152,13 @@ typedef struct GTY (()) ctf_func_arg #define ctf_farg_list_next(elem) ((ctf_func_arg_t *)((elem)->farg_next)) +/* BTF support: a BTF type tag or decl tag. */ + +typedef struct GTY (()) ctf_btf_annotation +{ + uint32_t component_idx; +} ctf_btf_annotation_t; + /* Type definition for CTF generation. */ struct GTY ((for_user)) ctf_dtdef @@ -173,6 +181,8 @@ struct GTY ((for_user)) ctf_dtdef ctf_func_arg_t * GTY ((tag ("CTF_DTU_D_ARGUMENTS"))) dtu_argv; /* slice. */ ctf_sliceinfo_t GTY ((tag ("CTF_DTU_D_SLICE"))) dtu_slice; + /* btf annotation. */ + ctf_btf_annotation_t GTY ((tag ("CTF_DTU_D_BTFNOTE"))) dtu_btfnote; } dtd_u; }; @@ -212,7 +222,8 @@ enum ctf_dtu_d_union_enum { CTF_DTU_D_ARRAY, CTF_DTU_D_ENCODING, CTF_DTU_D_ARGUMENTS, - CTF_DTU_D_SLICE + CTF_DTU_D_SLICE, + CTF_DTU_D_BTFNOTE }; enum ctf_dtu_d_union_enum @@ -402,8 +413,8 @@ extern bool ctf_dvd_ignore_lookup (const ctf_container_ref ctfc, extern const char * ctf_add_string (ctf_container_ref, const char *, uint32_t *, int); -extern ctf_id_t ctf_add_reftype (ctf_container_ref, uint32_t, ctf_id_t, - uint32_t, dw_die_ref); +extern ctf_id_t ctf_add_reftype (ctf_container_ref, uint32_t, const char *, + ctf_id_t, uint32_t, dw_die_ref); extern ctf_id_t ctf_add_enum (ctf_container_ref, uint32_t, const char *, HOST_WIDE_INT, dw_die_ref); extern ctf_id_t ctf_add_slice (ctf_container_ref, uint32_t, ctf_id_t, diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc index a6329ab6ee4..393aa92d71d 100644 --- a/gcc/dwarf2ctf.cc +++ b/gcc/dwarf2ctf.cc @@ -511,7 +511,7 @@ gen_ctf_modifier_type (ctf_container_ref ctfc, dw_die_ref modifier) gcc_assert (kind != CTF_K_MAX); /* Now register the modifier itself. */ if (!ctf_type_exists (ctfc, modifier, &modifier_type_id)) - modifier_type_id = ctf_add_reftype (ctfc, CTF_ADD_ROOT, + modifier_type_id = ctf_add_reftype (ctfc, CTF_ADD_ROOT, NULL, qual_type_id, kind, modifier); From patchwork Tue Jun 7 21:43:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54923 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F03CA3856DF1 for ; Tue, 7 Jun 2022 21:51:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F03CA3856DF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638696; bh=ASsxbkdm+hLSi8h+ZfdPVOObysK1Q6WCmHW4Q+1jy4Y=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=AQ0hBEbbb/bq3wgzMWozs/DX5p8fFqjmAthbcXcbnLJWjHsrqRoVjPA4lW0+XWrJc b3lStLT4uJuiUZxMKd+uMGRPb/QUJtiD6cMqpnxe3+MZ6X+zTkWjjqrOT7P2Y5wONs unone03Gp/sAqV8GMoQdeSWV1NTg+MB6cRUjEta0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 5ABB63954459 for ; Tue, 7 Jun 2022 21:44:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5ABB63954459 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IZR2m010579; Tue, 7 Jun 2022 21:44:09 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ghvs3ac1w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:08 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257Ldwaw016135; Tue, 7 Jun 2022 21:44:07 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gfwu31y54-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m3KDqQ0KZaWyimZH4BhuqvFBP31AwWtk8NJ+7g1lYBr1uq9hz9STn7eFblYxQiEsjHDt9zpZtI+J/vylr/mD3SNEZZiVChImAgE9C7as7vjB2YcMh6XuL+4iDL7zxto9svlvJOUc2qs0MI8B6nLkS7WeX9b0SDOlriGh+1SDDhMEL49Q1XzpV7mL+DEeDeRjZ98EjuJu4TPdR23rLI07qRXbWz/fgGiv7K9MfWgvxUdzIy+NLJNjH1eoUE6T9tfZvZz7eSHO6X9jLYLPBsMZA07mKy+QFet3HoSfXfMuOsIuYO/gSIFL034uT6dDxZlXusKpYDqRZWxiXN6vT5NxCw== 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=ASsxbkdm+hLSi8h+ZfdPVOObysK1Q6WCmHW4Q+1jy4Y=; b=dN8AzCNg+SHWrmcDvuCwAzKIlZ+JLfpLZqXNCllg63RRYquttZn2JZRfYBguEe5SsJ6R8Kdk8vKbM16G6ZaZkBooWiAvvuAXo0rNi2jA64r4Bo85RiWO26dywXkztkyT6HVW5EWu21fJy57IZOqi84qQc8vnT9Qv3gVHSuQHThLnOC47lvQElPLZzNWpPd5QGVIJG51TMH592hBwQigqvwqLTsWQe/jFTVZoeXVSHt61vlTxnvXhPY8NEwVulosDTeDpjBhfkbQx7sdztQe5L2r0mJcs4nhwQQzWAQwMRB6k/mhx4uwy8iMk1C1Dyg74ecSqn7QD+XYGktusCrl3Sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:06 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:06 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 6/9] dwarf2ctf: convert annotation DIEs to CTF types Date: Tue, 7 Jun 2022 14:43:39 -0700 Message-Id: <20220607214342.19463-7-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1c84bea8-d1b6-4b88-a7ac-08da48ced882 X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J3PHsMO+orBd0jue2UHzlcF3fSTpQFPcm3o1/9Akcg3C6uJNx8dUbN6lntnxuxpKvPbCvBk29EI388b74DnaIUqd+h1R63RQnEBm6lSlwCuPREXhC8UfcdThgbfMoNvKXDuolw4dtL/cG4P6O9i0fb/nrtMe2i6ms6Tvh6LKBS8wkwLt8vSImXK1kciHzLayhQS4adPjzqDZy5y8xDm37XTegk0alUVRqCAidU1D0LKGX+M0ni4/8acv6wTWFE9EGoTEZahY9FrGS//FARN8ifiIXcJ6j5V8e1OMwoEiYsxHolx5ManEa+RDCeLX6eZQZRHnyNX5+UD/nRbaT9+2kshIbMTZeetZ9sJhvpa33xpzddPNyybLMmJFKtPXrQ0LiI63KnRm9wMu0Gsx2yA0YIEd07Ao4lHpaAYxwuy0d6vc+953ggJZOynNghnG6yTcRegw6KsbuPJKnEidx2XfYMFUtMNh7Tfx4jGNtm47m/PQ678rL1LyYTFdY/So/3NYAvPTiiYQuCw2xZkNu3XzD4rW7BMrr88dbscrfhpNe9nRcZsrwE+D8B1lzcTkVTgWGKi0YSArZ/z6nPRIuxpq5Kgbik9y5hRLehDgQdMfMdcg7SYbbd/UgrvTuGKLsQTZ8LSJeMucf8aaJW/Wy7pImg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(83380400001)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VR03gL/mWkH2EgYmohZDKeHIiNxpRfU8vUQuwTteuoY9GOby6RKzzXFWVJLq5V2pbnHmZG2W+QoHzCWGVNUbelmT8yB3S7pPfiT48fTGsaVNd0BTID2stsngDP3kPJNhWS7LR6eNsYU41zmlVRbCCmYqddVQU6Vn34uoXUQAmBuIID07CKCSGU6IgSYPs3NyMGeeWKusgFJrXHsZPZg+MkzhFM9xXc5OQ2di7UydzJvZnJgpCgfMze0IwTWoUs5HfdfKxpvAJjOW5cZ+qo6FvJmJn4osY7md+R4EXRMtUP8f8qdDMHNNr6aOFkzOnRljTweTwn6zIEEXe/c1LbTDXr5M2hT9INpSl4xkpPu+o5hqfYzFXb9c1Zp1HfDd+lfjqmsffeIzT1Kboa+qsQeKyN/3hXS62sfu9zUGop62zefZU8juuLwGeKsP/m63EN77BMkd998pa+uOLdAASMsfKIfFMQ9MG/YZ5PQ02I6ABvnrgbI7mYnJ8VW4JuIqub/cwmSXdE7mtg2sVLbfv/iVKd8iq76eIVy5evWbcevV5Cm1B2isEzrW9mF7zpqwfFVudMvVUbuQ2dPXs0f15vnnmE1o+/9ppBGgvDgb2xSTlo41g9ccNdO9+4TXahD7zBZre5MTLQboqEMgDBMRmWxgXglDS+IvZGwrywDyvtd5s8kG++Qy3DKScJhcVz1zWfFssHPrxwy+ryvwjSumpoVDlIJ2/XI2Co6OXEytRzl+Fho/IoJndPmvrSLZToY0+cZv7Ujk2WzTXj4wEr9fzeeuKZqeFwrUzqchgvCC8CyerD7wO0RuSeNlNkWse5M5rsMQtigxZ7TryJCebNCXz3QoOaA1pomtAcQBidQYC8dZOppSvb2YOTdaMH0KQIWno+j9k6zhf8QNiqanVCD/C4Pe+x4s7GRgrDYh52LtwcwbBapRGsTC8naeUHf4DUTRwZB6qvFSX9BZ/H2WjE/ffyuJRCnF36WoWg7R0f0dJu7M5PmACLB3L2wroaFOKEXa8Gy8IM7+wK6CZtX0wD9SBKURO7iPSw2MgqqgYMJT8W2fJRwYOnwUXjbaZTgXb+VEV6KCA6YMipH37yTL5N7H2gCefGTaxkMPSdnR3H5syKcGdbdczVf/Z0dd/6Zq5PuEwNkTvh3fehP2wCRsY1q0cwTUWqJ2GLz1D+APfbLPc+Q55Kx9gQMz0PhGnRNf34FYJckczu10n+xCs5P7WusiJidB4YHtv/SFgRE/cur1N+HFSDW9RMIU7CboMn6gcoN793TjLVRznyMqmXEJFmeRVZxa3uEIWXBgsUkEbwy7L955KlfTZDYg4PI/2e6d0Yqy6yvAtcF3UcEDmK+KnM2Vj2T/KK+nvy9ym8owcauvhCyjLv/U6S8f3Uzix6MS1jOZ11KK1r2h4LvyTkQJ2fipMgORXxbHQHgE6EvesOH9qGGKJqK3bkYRaPA7Xxx99TJ57WouqaH9EmkFI88lmMNZcwe7Z6fFhdSXhgr+X3xZF3Hz8FTZkNZlFOvu4shhDFzguhJEJ60NK5sqSp/h8oOM1eAkFfkjIa4teXdgokKxEQLLBkh4tL1q4bAOxkFo6HFMfu4RPQHa6Co1jRk4GVkjLjJcIH4Xy3PShrtDOd3SK4USiTm9EaagLl0lDmz7HLAaB3dRhy2f0VdGRGllfEuS5/Ly/FxhMfVFS738Oz+7maBgO7gCWHEd+nzcF5yS2MA2XzCvPB4I/sJvMoEF2uB/Nr2O44EhYkoihgfCELoIYqrczhzFlilbOjUmmBWBYINQ2oln X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c84bea8-d1b6-4b88-a7ac-08da48ced882 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:06.0969 (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: UOSTw9RDAuVZ7AlkQadPPtY4sImLB8kn9tCRElys/eYJiQbuKN5U/VMD7UnfMMAbo5ic+LEDrylYClW36aGyNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=810 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-ORIG-GUID: JkZ3k7fSt5vUM5t32jfxjghQi18_lid7 X-Proofpoint-GUID: JkZ3k7fSt5vUM5t32jfxjghQi18_lid7 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch makes the DWARF-to-CTF conversion process aware of the new DW_TAG_GNU annotation DIEs. The DIEs are converted to an internal-only CTF representation as appropriate and added to the compilation unit CTF container. gcc/ * dwarf2ctf.cc (handle_debug_annotations): New function. (gen_ctf_sou_type): Call it here, if appropriate. Don't try to create member types for children that are not DW_TAG_member. (gen_ctf_function_type): Call handle_debug_annotations if appropriate. (gen_ctf_variable): Likewise. (gen_ctf_function): Likewise. (gen_ctf_type): Likewise. --- gcc/dwarf2ctf.cc | 112 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc index 393aa92d71d..65714e5d3b9 100644 --- a/gcc/dwarf2ctf.cc +++ b/gcc/dwarf2ctf.cc @@ -32,6 +32,12 @@ along with GCC; see the file COPYING3. If not see static ctf_id_t gen_ctf_type (ctf_container_ref, dw_die_ref); +static void +gen_ctf_variable (ctf_container_ref, dw_die_ref); + +static void +handle_debug_annotations (ctf_container_ref, dw_die_ref, ctf_id_t, int); + /* All the DIE structures we handle come from the DWARF information generated by GCC. However, there are three situations where we need to create our own created DIE structures because GCC doesn't @@ -547,6 +553,7 @@ gen_ctf_sou_type (ctf_container_ref ctfc, dw_die_ref sou, uint32_t kind) /* Now process the struct members. */ { dw_die_ref c; + int idx = 0; c = dw_get_die_child (sou); if (c) @@ -559,6 +566,12 @@ gen_ctf_sou_type (ctf_container_ref ctfc, dw_die_ref sou, uint32_t kind) c = dw_get_die_sib (c); + if (dw_get_die_tag (c) != DW_TAG_member) + continue; + + if (c == dw_get_die_child (sou)) + idx = 0; + field_name = get_AT_string (c, DW_AT_name); field_type = ctf_get_AT_type (c); field_location = ctf_get_AT_data_member_location (c); @@ -626,6 +639,12 @@ gen_ctf_sou_type (ctf_container_ref ctfc, dw_die_ref sou, uint32_t kind) field_name, field_type_id, field_location); + + /* Handle BTF tags on the member. */ + if (btf_debuginfo_p ()) + handle_debug_annotations (ctfc, c, sou_type_id, idx); + + idx++; } while (c != dw_get_die_child (sou)); } @@ -716,6 +735,9 @@ gen_ctf_function_type (ctf_container_ref ctfc, dw_die_ref function, arg_type = gen_ctf_type (ctfc, ctf_get_AT_type (c)); /* Add the argument to the existing CTF function type. */ ctf_add_function_arg (ctfc, function, arg_name, arg_type); + + if (btf_debuginfo_p ()) + handle_debug_annotations (ctfc, c, function_type_id, i - 1); } else /* This is a local variable. Ignore. */ @@ -828,6 +850,10 @@ gen_ctf_variable (ctf_container_ref ctfc, dw_die_ref die) /* Skip updating the number of global objects at this time. This is updated later after pre-processing as some CTF variable records although generated now, will not be emitted later. [PR105089]. */ + + /* Handle any BTF tags on the variable. */ + if (btf_debuginfo_p ()) + handle_debug_annotations (ctfc, die, CTF_NULL_TYPEID, -1); } /* Add a CTF function record for the given input DWARF DIE. */ @@ -845,8 +871,12 @@ gen_ctf_function (ctf_container_ref ctfc, dw_die_ref die) counter. Note that DWARF encodes function types in both DW_TAG_subroutine_type and DW_TAG_subprogram in exactly the same way. */ - (void) gen_ctf_function_type (ctfc, die, true /* from_global_func */); + function_type_id = gen_ctf_function_type (ctfc, die, true /* from_global_func */); ctfc->ctfc_num_global_funcs += 1; + + /* Handle any BTF tags on the function itself. */ + if (btf_debuginfo_p ()) + handle_debug_annotations (ctfc, die, function_type_id, -1); } /* Add CTF type record(s) for the given input DWARF DIE and return its type id. @@ -923,6 +953,10 @@ gen_ctf_type (ctf_container_ref ctfc, dw_die_ref die) break; } + /* Handle any BTF tags on the type. */ + if (btf_debuginfo_p () && !unrecog_die) + handle_debug_annotations (ctfc, die, type_id, -1); + /* For all types unrepresented in CTF, use an explicit CTF type of kind CTF_K_UNKNOWN. */ if ((type_id == CTF_NULL_TYPEID) && (!unrecog_die)) @@ -931,6 +965,82 @@ gen_ctf_type (ctf_container_ref ctfc, dw_die_ref die) return type_id; } +/* BTF support. Handle any annotations attached to a given DIE, and generate + intermediate CTF types for them. BTF tags are inserted into the type chain + at this point. The return value is the CTF type ID of the last type tag + created (for type chaining), or the same as the argument TYPE_ID if there are + no type tags. + Note that despite the name, the BTF spec seems to allow decl tags on types + as well as declarations. */ + +static void +handle_debug_annotations (ctf_container_ref ctfc, dw_die_ref die, + ctf_id_t type_id, int component_idx) +{ + dw_die_ref c; + const char * name = NULL; + const char * value = NULL; + ctf_dtdef_ref dtd = ctf_dtd_lookup (ctfc, die); + ctf_id_t target_id, tag_id; + + if (dtd) + target_id = dtd->dtd_data.ctti_type; + else + target_id = CTF_NULL_TYPEID; + + c = dw_get_die_child (die); + if (c) + do + { + if (dw_get_die_tag (c) != DW_TAG_GNU_annotation) + { + c = dw_get_die_sib (c); + continue; + } + + name = get_AT_string (c, DW_AT_name); + + /* BTF decl tags add an arbitrary annotation to the thing they + annotate. The annotated thing could be a variable or a type. */ + if (strcmp (name, "debug_annotate_decl") == 0) + { + value = get_AT_string (c, DW_AT_const_value); + if (!ctf_type_exists (ctfc, c, &tag_id)) + (void) ctf_add_reftype (ctfc, CTF_ADD_ROOT, value, + type_id, CTF_K_DECL_TAG, c); + ctf_dtdef_ref dtd = ctf_dtd_lookup (ctfc, c); + dtd->dtd_u.dtu_btfnote.component_idx = component_idx; + } + + /* BTF type tags are part of the type chain similar to cvr quals. + But the type tag DIEs are children of the DIEs they annotate. + + For each type tag on this type, create a CTF type for it and + insert it into the type chain: + - The first tag refers to the type referred to by the parent. + - Each subsequent tag refers to the prior tag. + - The parent type is updated to refer to the last tag. + + Given this type chain requirement, the representation of type + tags in BTF only makes sense for pointer types. Should this be + enforced here? */ + else if (strcmp (name, "debug_annotate_type") == 0) + { + gcc_assert (dtd); + value = get_AT_string (c, DW_AT_const_value); + + if (!ctf_type_exists (ctfc, c, &tag_id)) + tag_id = ctf_add_reftype (ctfc, CTF_ADD_ROOT, value, + target_id, CTF_K_TYPE_TAG, c); + + dtd->dtd_data.ctti_type = tag_id; + target_id = tag_id; + } + c = dw_get_die_sib (c); + } + while (c != dw_get_die_child (die)); +} + /* Prepare for output and write out the CTF debug information. */ static void From patchwork Tue Jun 7 21:43:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54921 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C9ED395253A for ; Tue, 7 Jun 2022 21:49:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C9ED395253A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638573; bh=rQzx1R3/5q4KU7xNK6OH00x+R3vOwjSFWmudDqQRFe8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=pnbdYDBvI0vU0Atrjkp44FcPN/wJgqktJrvgqttzPzfuTF9nAOsof28WvO+RJNmpb LXknNirYTG4H47+8YBXyzK0pTajV1JauSH2KMZyB1civx3j9hM5SEuIQ0kZnsqmMbp bvt6cmWYxJ7GFfjyinyFO/g7lzMATplvweWoPBxo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id AAD943954441 for ; Tue, 7 Jun 2022 21:44:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AAD943954441 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IDmgA005933; Tue, 7 Jun 2022 21:44:08 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ghexecbfu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:08 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257Ldwb0016135; Tue, 7 Jun 2022 21:44:08 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gfwu31y54-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C0AY5SYRBN7HRiBwZQym5MMG0HO2m4K0H8HTwLNyYOxGvAO3jH6635LmEhB5az0oLUzJmmWS0LZCgb0FC8E17wQRjjtDBy6fa7Q7QeeXCGyBz98PwphNe+8fK12VXJJRo0M5Q2d6Y+oCSR78hZ1Jf9Cd7UDJOc7DlcMZHtrVPzm7UmtstBBQeMVlMadkThfQY2JWtsl13z1NnIHRBaBTls7MHS9V6KhNlcF7fI2fAERon45lTZ1dy+uKzOcTpMA+8ynYzYM8HSOC53kl5Cs7SANcR5M89oTPlRjsRbXE+bptZxrPTcPysydSK4m3v3aJlDlaT9Z6/CGMFQIV76dVxg== 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=rQzx1R3/5q4KU7xNK6OH00x+R3vOwjSFWmudDqQRFe8=; b=IHZjohFiT27U9eKy6PstYMIow/aoc2Lk2zqw+MdEk8Yibs4a5l/VJUDeF24nEVV+U3iNqmlWnT03YWzfsyhdABPHJVy2Fa2iDucIUdpxSOu0UJRp80vQy8o15bZfUlcm5gGJ3puB2fi6dPdy1V0jV1xON37chNqY8A8EWiE/KXzrXAIS6rq60ir6GWfTnu3hkjuX5xCsslwaCBKwMQ1cWOtERy9Hfk+Xk3ULF9WzsJvJ9Sw2MDaaex4IPNxf7VeQJzm/m700uMY16igMmCP+LXNv8DQk4Uy1qt0uB460+BW0dKZcB0OGkac2h8cIXa6RjufSAQNJgadiCenP84vR/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:07 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:07 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 7/9] btf: output decl_tag and type_tag records Date: Tue, 7 Jun 2022 14:43:40 -0700 Message-Id: <20220607214342.19463-8-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a92830fd-f559-4dd3-b21d-08da48ced911 X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HL2ymTC9Gejgv2TQHIemrS59jT3zcEaFNJEDT1Q3OBzKMcQ0+OC/67umlks/pBiKApcjL7jimtYZzmFKDVyvshmXPapLDfY2i87ESetfIaXKxqPcMGnB74qHOHTkPUUFM0cdTMqMT/eOPcFS4Te/l55UXLjM6Nu6dlJQy+y4znDyoGmg6BKu8oF6gUdaQ1Tw0WS7xr6F/ziz9HrTkqQWkr1nLLO6lbLF2hIP94/D53XwPNXOh/381uI2J4zrM6JqMCMxQ9mrRf+m3QK/bfRQzWdrnSVSPfpPGoQbKB9VL8dS6cy4HQ5308U4Z+/yChP+NpkHtHnA8NgMBE8TqJxSD8BVXO1lZhMwqjeab2Dq2SQXyBQxUItB45cpqD9/Hw1q0Al9muRGy9hp8EH+LXYwdUV8xzGOtep1+EfcqqRETTwQL1DkB5EUha0aw0YsO0N1H5doxpCjK5EVJTuc0ht9imLsyKLPOd2ON+nWQjDaSI8d5aPv/Rp7erxQ+WKJXdPX1Lcrm5r57o6IyB4kVqk7KQx023BVSYKcqDJjCv3wgMTnCTdlAZCuIJeSRCPwmouEK7ecLzCI1k/ax/s8LTbpJ1dlOJ6xOEGaUHEXbOeTKdMXHk28riKPGFNttsP2GLljCC3n6HzznDAIGWiNxxaYmQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(83380400001)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xpx1IixdxlIXnGHt1XI5XVWA5hddo96RGIfH/xhSXFPjLHLqFP8qOgMprg4G64erYnzrs5T3dqezo9enOoPwt6ErFv38GHuy44PIieSbbxcg1PYfdddDoWapTJ/unA3QURcaDX/K7j+Ow11p6vcEVN2fO8YyfIzU5gVaf9aTT5No94lc1VTlHucG0C8U8p0k75IIEXlgk6JhtqYcn27e+zHLWpsSiaKsW2UHMmSl3U9lO+N+LiTp796Uib1Hvoyhoz13WNV8gDa/PkeF6qeY8jELeSyk5TaQMFaWljDxKuwo+vXK0vSf0XKoKq3yAcQaXeSQ48jlRFNuPP6XMvxmZR1oZPc/O6zEjvxZ5pPAspAIOT7s4m7HAKvWP2tHY5sNi1WK8IM4MhdtbFqaEPnKF5/ZJ6HphjRsuZrullweZvGHx0klH64wSgdre78Q9OYpmKOuVy6Ou319pzcB3bXpO2yY/QEvpLZSEBwPTPoibQpHn1FQL+VZTrzlpxA/PzngPbYf19pp3Qp02qt0PnwWcxM+ZDxHSxmP/c0/wwz3QARyUUeNfUnm4LlH0qSkl8QQZpVfVc2ZKAYnfwBxo65AVXeCLnJH1b3SIFrMg82/YhEprjr8HW6pBmUSW1okhHMBjdb9AhYemUVl6Wgn8KSCM7+ijq4X6aGmK8lrTHUo1GrtLkHHVswhIKYXsVUNM1iGpcYCm+79b0Hsl/0C/VklRJFTxV7QaluFxGVzRBpWkTWNXkM2InzYDt+LUezVOr7VXtCYgF0xKdWIqzuan/6RWWhlzOiagyOWvPa/HwTSdh9P1lRAARKCfAkaQkBYxWIaVbxASy9tJpi098T5MfW8m+m0tNt4l3+JGboH9yokf9PD3oNfLL4VJwFPg7mRZC2UlMMeJXdvzeRXeVxnrMEajeXZgsSOm7GFdwtCwOE4OLPLCE0H5UP9tAjNdj0hNRxZN2bFtEqzaYLC7ZUsHiQBwD5LxwVaNMmbhCTEykBaZMr0SuH5nFEv3+n3jST08puRS4Kbq8BF5cK21ciInSilUcXbWjiCom68lPoSkIpVc5si+26yO5/ouNAsMls9NEHOBO/52/SXKGzqP3qWflXMaO6zfVeVcDeSJM/2XTg6dmKe2qPKqt0lmhRK45t1S/S3Mqb2gWzeLq4xW+5NJzGXvJ+YeTil+hL4M1znsK2jKA5Hpu8ots787S6d+KX44WlJCOb6nPoKl58VGk/RridUJx9PVTYEfda8U68i7aLdY5hn0+yqDKRspLjnms9VEsWbu+xXEgZULZcdKSsmokyESn7Ey2JyX/DZmFpigS0Dl8LboWC1fE4WYX89y9+zbc8pS60+7EE18o7w1lfIZEc36vQBzDdXa/3SmXw0ERZ9GnVHNFK6XaHNBB0tEhsEbWL41HBYxXBy/medz8pv6OZ5aSlvCwNQSQ0H8klwcc2XRNG0tPAEUWfQrxJnv0BLm4BDQXN91k6wg5v3z6H65piHBEorK8+4k69dPgMmWTdwaN+GUMG1ePVzjrcuR5bM5D69CBw/yqNdywYDMeIYCYsMQ14sfiW4lvA4YIK5/7mWJQ3dydBZU968ymSDuxHJEUMJQ9hsNCP0csJe6AD6Xd/jiCujIy1L+LHfDw7cSobhP8lBjZvnsJjFZCbT9++rADSGBRHbcHy/JYbmUt/dzqGlnNfAb395MjzwleuxL3YUsJ4Vg59xrviKeuKkJiP1w3ydR2l75liG7YY4LWWE2sEvtU/a4lUSKLbtDHWkuy5CC+qQwG45TB0Ad7z8WSAHu8Fk X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a92830fd-f559-4dd3-b21d-08da48ced911 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:07.0031 (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: dRvddfN2IKxiDQrJtaQa1kdLE+XCcaEl8Ry9OE6sF3J8rilydEMM6OM4nDrIknovZQuT9/Q3uHvULQEDmhfS1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-GUID: v3UrLDGIuEqn7UbY2E_bIMxhDAem0Tui X-Proofpoint-ORIG-GUID: v3UrLDGIuEqn7UbY2E_bIMxhDAem0Tui X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch updates btfout.cc to be aware of debug annotations, convert them to BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG records, and output them appropriately. gcc/ * btfout.cc (get_btf_kind): Handle TYPE_TAG and DECL_TAG kinds. (btf_calc_num_vbytes): Likewise. (btf_asm_type): Likewise. (output_asm_btf_vlen_bytes): Likewise. --- gcc/btfout.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gcc/btfout.cc b/gcc/btfout.cc index 31af50521da..f291cd925be 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -136,6 +136,8 @@ get_btf_kind (uint32_t ctf_kind) case CTF_K_VOLATILE: return BTF_KIND_VOLATILE; case CTF_K_CONST: return BTF_KIND_CONST; case CTF_K_RESTRICT: return BTF_KIND_RESTRICT; + case CTF_K_TYPE_TAG: return BTF_KIND_TYPE_TAG; + case CTF_K_DECL_TAG: return BTF_KIND_DECL_TAG; default:; } return BTF_KIND_UNKN; @@ -201,6 +203,7 @@ btf_calc_num_vbytes (ctf_dtdef_ref dtd) case BTF_KIND_CONST: case BTF_KIND_RESTRICT: case BTF_KIND_FUNC: + case BTF_KIND_TYPE_TAG: /* These kinds have no vlen data. */ break; @@ -238,6 +241,10 @@ btf_calc_num_vbytes (ctf_dtdef_ref dtd) vlen_bytes += vlen * sizeof (struct btf_var_secinfo); break; + case BTF_KIND_DECL_TAG: + vlen_bytes += sizeof (struct btf_decl_tag); + break; + default: break; } @@ -636,6 +643,22 @@ 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_DECL_TAG: + { + /* A decl tag might refer to (be the child DIE of) a variable. Try to + lookup the parent DIE's CTF variable, and if it exists point to the + corresponding BTF variable. This is an odd construction - we have a + 'type' which refers to a variable, rather than the reverse. */ + dw_die_ref parent = dw_get_die_parent (dtd->dtd_key); + ctf_dvdef_ref dvd = ctf_dvd_lookup (ctfc, parent); + if (dvd) + { + unsigned int var_id = + *(btf_var_ids->get (dvd)) + num_types_added + 1; + dw2_asm_output_data (4, var_id, "btt_type"); + return; + } + } default: break; } @@ -949,6 +972,11 @@ output_asm_btf_vlen_bytes (ctf_container_ref ctfc, ctf_dtdef_ref dtd) at this point. */ gcc_unreachable (); + case BTF_KIND_DECL_TAG: + dw2_asm_output_data (4, dtd->dtd_u.dtu_btfnote.component_idx, + "decltag_compidx"); + break; + default: /* All other BTF type kinds have no variable length data. */ break; From patchwork Tue Jun 7 21:43:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54925 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA662395443F for ; Tue, 7 Jun 2022 21:53:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA662395443F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638818; bh=/ZtnKeFHbvT68g+2ftxE8fCcWFNUb+JP4w1zcYI+KMA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=WfkteOOm+9kUomJMLqf53uHGN2QSsVCh7TXjSSghc33jEA+teMGwFINUVUwYNSowZ GJdfhLbXq4+EieArTMUsDub+A3OeG7DK20tSndR2fQIT4PNZlFYsNdR0VHkkLh8yjs +/EBoM32gEXBW1WFhH0eZbmBx0Vw0w/ahlQapHok= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id BB78F395250C for ; Tue, 7 Jun 2022 21:44:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB78F395250C Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IQHSn010464; Tue, 7 Jun 2022 21:44:10 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gfyxsf1sb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:10 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257LeXJv038763; Tue, 7 Jun 2022 21:44:09 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gfwu2xj98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V/imccJbYJMj8L59b6BorfcVg6vQegAGwAyOU8mch7WJHrd0DAsRDLnA3/BD7o4xvlyr7ijPpKzuoNKxr//h045NmeLEZ43DFe7EDb8GJ7EYfnNmoqhEorRGxiqjbubbynxhSTOBjMjCPnZxTGgf1P/pFob1fOBSoKavTyb8QX1IRkG43+9maF1whIehu5n0bDZXUsHd8OBWZ4o6OlvjfoKFQx1Isg3gCeqVHwe/yUtBjgcFyZ7+g4RN0C3gXCFtqwcjvt1mTxjQ4M0YMBtzcMVWoxoqBGTeZdIpl5sN6CVBnxnFEr2y42uQfkBflMBlGNJcLwJ/dLivYGUCaEKyVw== 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=/ZtnKeFHbvT68g+2ftxE8fCcWFNUb+JP4w1zcYI+KMA=; b=d7KjpD0swuLBxParqhoQxOubXHMiJZl/LN5PkVt3x8Pdc2go4IdCPHJ9crfLqHQarOlvVf1sHbiRUfogiwol/l+8dzg3XDQvQ0qxBo7zOKckqJFtVj14U3Lx8wgCw4TG18OUnVHX1igodmAqXLFCUDaWx5tLPxiK3FaCFsPTMks7jFUaaJarnGA0wQ56mRG+F59RMPO95Z/KrlsPwktKQ1iRUFcCKCB9NMLRts9oxbYzOuA0afu+q6peoWth1uMsa1cC1EKQX0/l+zM45l+QsgTCcK9FDCHXjAGhtR1uv3/VKeYL1mIwI+2GAWrbO5wREz67x3tnkBASCIGWW9iGDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:07 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:07 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 8/9] doc: document new attributes Date: Tue, 7 Jun 2022 14:43:41 -0700 Message-Id: <20220607214342.19463-9-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d5804a9-9051-485f-f7e7-08da48ced99b X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cCyqaq29rCSmcHp81mwMriuqR94RvYd2cYtWrguzwofnZd7uJMrwmkv27NCA3jxFuVJUdkek9FmiFNv3j5avUNKp0HJ0dVVfDeQEo1fCzcist7LeDUwbC+9VQaZLY6dkdJqMiihhZYpkkBlbpho6vIv+FUOJfU2y9XMM4lnOatwKUdPotALRV3l5boAGI8m0JFIOM5+6HCLKzxMGOHHDwlH8fLfBtys//kXtRapyM4i8cTdJ4Ours6KHVhNSXTyv/ylLSPOBW1y9JjgwENbXIEdluXTgE5SxeI4AA+kmAVOxAdPqTjFmNKRGPGqJgdoHa47LWzH0TimHsmFRL/T5ZDqpNz7sMofdpMy/4gc5wIPrk3GldHu3Pq6CCspHCGzHdWQOqjopCNCgwejbowfBbel6M9WXspof+jeKcGse/At665FqtGnTb4DAe3/9nH9oHRIr7FJo5vCeOypV01W5AZGpoTDZQBf2ICdI4Ue4lIpgcPmcIDVM9D+bPzTweZO4GKAtjBFOoPVc3YOusiPH2jbGXmld7xqkiR0SRzRu8zzJL4YBWuppxkCHTuhbANzGHMXFu+Ti8afDaKcyEOTmVttlQy22ElsZnlmok0SuZLc4ELtXktl994rrW5LFXYiIsOY/rfcS0WAGbYhfi76lJw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mXPBQV8T87867e3dD9SVukcpai1gPL2IS5Lj6KifbPbEuF/qukbFyLkE419yghP0oKGUb62+dRqv6a8/Us+vFKKvt8urwfXy/DUdItRm159s/gN9x3oWcBg97QTjvvAx3jf7lxhm/jdX5wxyOUlL8S+0t4rs/0BX6naWV1nZdqKrTZ/XnxaRBL3hDcJtGHLhG1FlPVzmKp4tINep9evXNipG59v86lF7ACvYn7tkih3uBJhRXV3BPsNxsaAhCsLMVdQD190HB5kofPUrEKuSZQcx6O9GQRX/i5FzZsfAHlNYh4OxTh2Ie4yyxC5EcMCbCgL8F64Mn4UwABtoS+u7fjjUe9JB1Gf+88x7Ra2GBwcCPX/ZIbcRNQG4+GFNsYFr3bxXN6jWvgZTZcnrOFxyQVfVFi1I669muuFGe2HRoVo8SOg3LlomdEixOtcwYIgdSue8LSGrGL2tRcTutaPxfFynWKupD2SE2i3eNa3RCnUZkMC6TMycvX17xNtAcaUKT/cC0Cjr00qHB6ektXySMabTDKSzE7vh4KXgLrVNGwI1JfJImCMjcz4P7W/PFNG1KKQ3ToA+Mu8xkb3wITYHC/1PA+dGr6DWX4uw0OFOKqQ+2f4oDDhEXqKGmjnqq1UeJuBzkQP2JLXFSmhBxKQKcJRKlGL/5ibts/Oc8IybnjAq+P6xOo6svoONiyVweke+oBkkA3Kkd9MMSoIpQmw2bOrsRRb7K5mteOViik9t8M1251CsgoHZkwkcSTeyay5KORJa3iCi7QhY0ruP00zwwy0TUXeAVtuVRUkHhufJPoGG+j8ofAi0j8wmYHwpJNsmR6eej9cUhPUzkytm1M+p/cxR8Xp1O7Sd8EgI8/JTNmU9Py486OFASmTqfn0qt9H4oZlbQa/xQ7fKGb80BbLV5x65p2L9vC/pMLo1G9gnBkBDNR/B1rnzDgQC8Yx5iXLMdtMUAmGRZ4qTb4bZuQPM0tzPQjBnGiFU6hKR/Cie/DsAVI2Ek0XpBt9AadcnfkAnBbq+BA9SVT3CF2zeL/oZ69t5pRtt2oNCh0Tn+2A3QZaBVnodeUST0XTHmmGS8S0EybYdwE9N9wwrtuYmOwwYhkDgTd2ciSDO9bsTw+8Zs4IZMwW8N9AgrE65JrUW3X6bPf864jUUc1nEqkkS9yMor8TVkvZBzZwTPKen4Z5TE2rwMOC2rCI452YMCW2IZkAFZy459O25Dd/J4y0w6y+G0lMXRp3q8cvK1itdWFuMy+dvGOYHLTR+4g50BG3ct7zkxUe7Dc1hkShShhzhgdn5pSArnYDE0ECJCaNqT/oyQxR5v0lCRcyQKKquNvG3UjeBpKB33NljhipMwLbysBrFzHVH7Ygp3jTclFcILrBEZVBFELtxf9b6RdxVSa3amw80nClu6rKhd3wf/O+g8FL1dwah8Mpr5EJU+qhiFlFo0/pJY7nWyhBIF4INJ4ZC4D3gh+tcMhuFRKhIRaln0V9hBlJ7eBBHa5WE7w3Id1HdA/LbdpKDmXKt3p2wRN7kHZK54hJNQogMDaeFnsiMmBca4tZWD99PdkbVVgPH/5EV8/va+AN9ySUusqSNyODps74ze+bmcytLa5/h6jetM0aPlgtMwrwKhm4/WVqs4YCL4/TKRP/Fqzna63o3WTCxvrmeHlM34cfNtJROTFt1lrVws5KYj9LyiIyZUdAKHtVqkGfZwDt6M8eRPO3OLXxEbod1tooHkgA6kdGKOs2XRERkYgzfPjlwIFj1cfmerO6RsUzQ1y0wBVZbPDMAtNy3RMGl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d5804a9-9051-485f-f7e7-08da48ced99b X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:07.9092 (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: HR8xJFW3xcx2dd5uUhAMG2c2966NPallrplQS8BjKiX5Plb4mxLmQfTem9YYJUbkh/PXH6Ye0bKKiibyqdo0cQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-ORIG-GUID: j1mK2OoUrZ5MC5QfkEq1bOUMWPRarerM X-Proofpoint-GUID: j1mK2OoUrZ5MC5QfkEq1bOUMWPRarerM X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" gcc/ * doc/extend.texi (Common Function Attributes): Document debug_annotate_decl attribute. (Common Variable Attributes): Likewise. (Common Type Attributes): Likewise. Also document debug_annotate_type attribute. --- gcc/doc/extend.texi | 106 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index a2e2a303ff1..a4c114f0e81 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2931,6 +2931,30 @@ extern __attribute__ ((alloc_size (1), malloc, nothrow)) StrongAlias (allocate, alloc); @end smallexample +@item debug_annotate_decl (@var{annotation}) +@cindex @code{debug_annotate_decl} function attribute +The @code{debug_annotate_decl} attribute is used to add arbitrary +string annotations to the debugging information produced for a given +declaration. The attribute accepts a single string argument, and may be +specified multiple times for a single declaration. The behavior is +to record the string argument in debug information generated for the +declaration. Currently, DWARF and BTF debug information are supported. +There is no effect on code generation; the attribute has no effect at +all if neither DWARF nor BTF are output. + +@smallexample +int foo (int a, int b) __attribute__((debug_annotate_decl ("my_tag"))); +@end smallexample + +@noindent +results in a DW_TAG_GNU_annotation DIE associating the string ``my_tag'' +to the function ``foo'', and/or a BTF_KIND_DECL_TAG BTF record to the +same effect. + +The @code{debug_annotate_decl} attribute can also be used for +variables and types (@pxref{Common Variable Attributes}, +@pxref{Common Type Attributes}.) + @item deprecated @itemx deprecated (@var{msg}) @cindex @code{deprecated} function attribute @@ -7510,6 +7534,42 @@ but not attributes that affect a symbol's linkage or visibility such as attribute is also not copied. @xref{Common Function Attributes}. @xref{Common Type Attributes}. +@item debug_annotate_decl (@var{annotation}) +@cindex @code{debug_annotate_decl} variable attribute +The @code{debug_annotate_decl} attribute is used to add arbitrary +string annotations to the debugging information produced for a given +declaration. The attribute accepts a single string argument, and may be +specified multiple times for a single declaration. The behavior is +to record the string argument in debug information generated for the +declaration. Currently, DWARF and BTF debug information are supported. +There is no effect on code generation; the attribute has no effect at +all if neither DWARF nor BTF are output. + +@smallexample +int my_var __attribute__((debug_annotate_decl ("my_tag"))) +@end smallexample + +@noindent +results in a DW_TAG_GNU_annotation DIE associating the string ``my_tag'' +to the ``my_var'', and/or a BTF_KIND_DECL_TAG BTF record to the same +effect. + +Annotations can be specified for declarations other than variables, +such as struct fields. For example: + +@smallexample +struct foo @{ + int * x __attribute__ ((debug_annotate_decl ("my_tag"))); +@}; +@end smallexample +has similar results, producing debug info which associates the string +``my_tag'' to the struct field ``x''. + +@noindent +The @code{debug_annotate_decl} attribute can also be used for +functions and types (@pxref{Common Function Attributes}, +@pxref{Common Type Attributes}.) + @item deprecated @itemx deprecated (@var{msg}) @cindex @code{deprecated} variable attribute @@ -8593,6 +8653,52 @@ A @{ /* @r{@dots{}} */ @}; struct __attribute__ ((copy ( (struct A *)0)) B @{ /* @r{@dots{}} */ @}; @end smallexample +@item debug_annotate_decl (@var{annotation}) +@cindex @code{debug_annotate_decl} type attribute +The @code{debug_annotate_decl} attribute is used to add arbitrary +string annotations to the debugging information produced for a given +type declaration. The attribute accepts a single string argument, and +may be specified multiple times for a type declaration. The behavior +is to record the string argument in the debug information generated +for the declaration. Currently, DWARF and BTF debug information are +supported. There is no effect on code generation; the attribute has no +effect at all if neither DWARF nor BTF are output. + +@smallexample +struct t @{ +/* @r{@dots{}} */ +@} __attribute__((debug_annotate_decl ("my_tag"))); +@end smallexample + +@noindent +results in a DW_TAG_GNU_annotation DIE associating the string +``my_tag'' to the ``struct t'', and/or a BTF_KIND_DECL_TAG BTF record +to the same effect. + +The @code{debug_annotate_decl} attribute can also be used for +variables and functions (@pxref{Common Variable Attributes}, +@pxref{Common Function Attributes}.) + +@item debug_annotate_type (@var{annotation}) +@cindex @code{debug_annotate_type} type attribute +The @code{debug_annotate_type} attribute is used to add arbitrary +string annotations to the debugging information produced for a given +type. The attribute accepts a single string argument, and may be +specified multiple times for a type declaration. The behavior is to +record the string argument in the debug information generated for the +type. Currently, DWARF and BTF debug information are supported. There +is no effect on code generation; the attribute has no effect at all if +neither DWARF nor BTF are output. + +@smallexample +int * __attribute__ ((debug_annotate_type ("foo"))) x; +@end smallexample + +@noindent +results in a DW_TAG_GNU_annotation DIE associating the string ``foo'' +to the pointer type of ``x'' in the case of DWARF, and/or a +BTF_KIND_TYPE_TAG entry to the same effect in case of BTF debug info. + @item deprecated @itemx deprecated (@var{msg}) @cindex @code{deprecated} type attribute From patchwork Tue Jun 7 21:43:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 54924 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AA5D3954434 for ; Tue, 7 Jun 2022 21:52:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AA5D3954434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1654638760; bh=5HGQ8rPJF4I38B/AJ0MiETorQOI+qENQDsaU0tZTWMA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=A77QU76UeZOLzlJu6e8TGwXc6xLnDANc2v2rsaL+Vs9xuSvTpHS/NdEoAyq0gfl9Z +3+YxtDOBQc5yOCBTa31Drw3JJ6GJF3WJ9TOUBm40ymv+Z1jaXYOFd3cirYslt38Je KCHeZ+q50CfpoMXBwuftwvjWC5x8jW2i2bZ7qh8A= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 657D438133F7 for ; Tue, 7 Jun 2022 21:44:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 657D438133F7 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 257IJ1pN018341; Tue, 7 Jun 2022 21:44:11 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gfyekev1v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:11 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 257LeXJx038763; Tue, 7 Jun 2022 21:44:10 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gfwu2xj98-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Jun 2022 21:44:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TQW1ZhMtQmE4dCkON2nSujKUUBjF5LU2ri+Og0CuxOp1OWPHt4J2RHnV3Zj/tloHO1X3uNKp9mta/aOmQ2ArxkMvgTmjxdN/50qdbZetu0zTk+siYV34C8TqfyMM5bntvyNrZGWWrooNVLW484cFr3iEP31Rnn1Zw2I0n8ST8kpKrgL7XksrmsFEw+mXvh34/+x+0q4ElidQ5WazVKUOyvBcr4LRYhLW/6XXQ1/8hPg6940GLt30D4myFdgLra15hLgruHUC62pOAUGNMmHlh8tOu4z2NG0T0WzZ/K9EXlMORM84odr/h58b4dkQz+yiz7qCpjhyiKtgxR8jSn3WuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5HGQ8rPJF4I38B/AJ0MiETorQOI+qENQDsaU0tZTWMA=; b=aBzr/KjVndNmEOn9Hu0BuObmkcNtghzmPs84OjHKJvij1JfnUlB0fHQzE6BUB5OgtkBBZP+L9asZVFXC0HN8zjh7EXRP+e8cEoWdRdDlm5gAHoeolV2tpIxJvlMUEf6N36881XS999YDylhREpELS5pFSMZipW3SE0fap9nAWO4tECc51Hn10NiU0L731eeeHGdUuafTuh/nOCQvBSnp9LqSIC9OR/cl/CurWDEdayax6FO6XP/5nXHOaxczG0X/18W4NBeH/MwkzVrT0Qlxmt3pDQtTkZL2bqA/rqQUaZZQCdZNINVtjjiP47AOCthZy8FKDrpraYKaSKTxHCprpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by BN0PR10MB5351.namprd10.prod.outlook.com (2603:10b6:408:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Tue, 7 Jun 2022 21:44:08 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 21:44:08 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH 9/9] testsuite: add debug annotation tests Date: Tue, 7 Jun 2022 14:43:42 -0700 Message-Id: <20220607214342.19463-10-david.faust@oracle.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607214342.19463-1-david.faust@oracle.com> References: <20220607214342.19463-1-david.faust@oracle.com> X-ClientProxiedBy: DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0178045-991e-4903-7928-08da48ceda21 X-MS-TrafficTypeDiagnostic: BN0PR10MB5351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0wkcdHag+bGqxMaYWQNr1b9M6h6KfG0CKdyC0dNEFaQ7c2XN8NaD88uym9E2RbNCh07AKQDrj1MDSrh9K4OHFxD7wMHLOIBaNxGFEiiIuVbcjmErNLqXSvIEBh2sWKA16Kp4vrugSt0WjiI9IG4jWljuWMh2U5YLZ1LqQBzKqBRpiBIwHp5ON83sxBhtiU8ZyijogulOqJ46JOjKIycoYkQFzX6RGm2VhYgSJ8UP+h2jTwOSlu5Qw0NjopLrobN3eaWF7BdqY+YBMvvw1A5W/rrmFFWRvRIQeiN0F5dp6u2hJenba5TWkYswc2zvW2z+DKCSYFNjWzQcWPmCgg8ygQabxSh6FHkZAp/rX8tUOtMB1eihqYiXjvLKI84tZ5oNCPm8TiB80ubk6YDkVfx+3ZVSa3dlgHncHXBGij3UWq9nOwAxJ0be74HKXpF0dzv1F1BlZ93Muu8dqnsTuv0qD9qnQ5x+EtN9jk8mdk116JD5ad8Y8xRS+Trr1f9NwceeciYRECxjdjgfOzx5Kjum3ZGZTII54onIkPb9pV7VprXvrQ+hTgPpKgQ0zpX12zdf4etmSrGg9pP8OZy79ghTeI3wFY8FvSWgX6hzDTiV4vtCk8D2N2vZk8rWpNuWH4dySxpzSzp1g1WNhUjV2lSlmbVdR2VPmqeZortn3MN6w6SK4TETearrSX4MArXnFflnimdDCG2gBwN/Op0HgcuGp4PLWN6f8YVi5EKwNTh4awlBjlyd5Ek37nlV63ee9Y9mrB4RyCZ1SuEW3ZfkYYUpdA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(36756003)(6916009)(8936002)(1076003)(5660300002)(6512007)(2616005)(2906002)(66946007)(86362001)(38100700002)(83380400001)(30864003)(66556008)(66476007)(316002)(6486002)(44832011)(8676002)(4326008)(6666004)(6506007)(84970400001)(186003)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qx/2X5QY5/0cv4X6pv9pCW5NwMY80mUKtOn+3mHKHFbU/rx2ejzwbAo8c4siczXTOBxgRLork+Q57dQPz8HQtW/C4JL9AflwlEekyWaUhGnNtJnIKPKbysnc2xILovUNh3vqKSwggxyQQdrgyeJO5IcSOFImmc7l/Fje1eAaSTVaLqdfqc1mc2nyggpRSuR2TJG1rfG9Ymj+Od54FJEWlwojHqWDoUavE2a9IaARS9DIDce7AEsxbcN0913Frg8nfbHof2pt6g4tNj9PutYhf4+9WpRv22opVrHRe53QjXvqkfp4SeJhsTEOJz0LaRotxTii3CJM265pLTpvO2hmuAPqqCgkRBFZMFnHlRRm7SOqzWzv0/BxtcayREGq5/J3j+2lsfdiUtEqKiljd7LgygXWt3bREEbjsXLD46028CsJu+yD7mTjZW223gYEzEvbPkkiUpLX0BPsn3VaYB9ZwQmEnC6BSRiFAZtC90+sU+dcm6ywdOZlpMzHltk4mfwwz3xSDYtiomLFMmm1AgAwpLULeQZoAy8OFXPAzGH/xwJ+XYrsPjr7copcY3LfaO3kI+T828wGWlxE7wmQPz9Adw+NNuEZyulVcuZuaDRUBkUPeV/Y9bC5WccFPDYBccY3CIRNu6oCh+ob2Vxjp4Hr2H8OYdS7x3BQhB463O/oEG5QUIPmkCXuBVUaQL++ynt9G6TA1ZUCRwjDP+EgjsTX51Jg7FXuBJSaRoxLtUWdS7BJNT7j8OilM5MZQiWcvURD8oAkGenbZ6RPUEm7EIeJwHha4ywYnirhd5jEtSefj7PrFNZWC1LW23zPKwmPzQoM1okKzKyCK/QnMUls+8iFDcmc3l8H4WqnhsH9nI2fn3xjMtcs9sCiGWc3ym7T8DScxrvHK6I4AG5l6oSw1mwPBNhTHD50FM+u6iwTwvfuUkezmSW9iIXPA3cOPMvQGgRVeZB6iI3mcbNoHE+MBKgCazX/U7T1CVgs3uXjJCOxoM6o8RHx1KxNAerfWkENgcIBOca1EoK6+716goLLkLs2Cje+H/xligMNYtxbOeG+wienLgdbP5JrB6U+q12/c0HU3MOPiQSOCojk0gcGvWk7fAqRCToPGMMMqYDcFeTiXCAp1JZJ6MvBfcNEP5gdCa2UzusU3PdfAFhFIED5AAcd3gKS2jLbTMCJfGs9oBFqgtaJDQ1XjjS9iX+Raa7jCy8WDF7gg4NSCvS7ezWKX782nwIiwXoeeCtmeoYgfxNqmtz1Jbhy2WD3N84WLS8NleFx8zeFRiN/T5nfE8Pq4DBlHrIfWs1Dsj8WK7v+gX/lyWbnM3rb5KI9DM5MJJBHfv/N27k4daC0Sg0WYksy/yuTYZ5sp+XGA5CXFwmZHpbIChRYR0yz7aLkciBt7nS0ATqObV4ab7mkaGjt5b5c58HOYAW19rGdD85+nS8aeVEbzHPSbf9vXLKQGLgZzEQPQNd3SjiSm7KCZqV/uYFiI+ONHyXjHUbBbtHlJpQbp7sHpI8H9FhD3PhFpimcpTBOEoLyLX3ftvu98gv5VXX6oscqN8viv6gqi3D7vDlYXpvr/FXHGdZrlEnlvOkfQesQttBMY6cO95GdQfPTiEpTfYfRAWkYwWi2XvCwQPWPxUOXL+olRjfyJojFXmUHcf1rY+0I5SCxZY7wCJNFIv3jAJGBBbfGPJQcyMpIicW+lizcDyQFW3fPDqjJglLE5SREIkcuDJPz3OMVpoDQqFYZDWtOJ9xanRhqTvgqy5h9Q26QLulYeZsY3pWAvlDg2p0vTw89 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0178045-991e-4903-7928-08da48ceda21 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 21:44:08.7998 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PFnVw584CE7ZaWVsXXUaEgFTP8fxHbRfJSJyYaJAOcOzhStIHvszVU2oh7502r37NQd16795qnX5hqwQEmE0jA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-07_10:2022-06-07, 2022-06-07 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206070089 X-Proofpoint-GUID: wR66b2WxRwrCTGNI17uTCHOd8ojzQaFq X-Proofpoint-ORIG-GUID: wR66b2WxRwrCTGNI17uTCHOd8ojzQaFq X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Faust via Gcc-patches From: David Faust Reply-To: David Faust Cc: yhs@fb.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch adds tests for debug annotations, in BTF and in DWARF. gcc/testsuite/ * gcc.dg/debug/btf/btf-decltag-func.c: New test. * gcc.dg/debug/btf/btf-decltag-sou.c: Likewise. * gcc.dg/debug/btf/btf-decltag-typedef.c: Likewise. * gcc.dg/debug/btf/btf-typetag-1.c: Likewise. * gcc.dg/debug/dwarf2/annotation-1.c: Likewise. * gcc.dg/debug/dwarf2/annotation-2.c: Likewise. * gcc.dg/debug/dwarf2/annotation-3.c: Likewise. * gcc.dg/debug/dwarf2/annotation-4.c: Likewise. --- .../gcc.dg/debug/btf/btf-decltag-func.c | 18 ++++++++++ .../gcc.dg/debug/btf/btf-decltag-sou.c | 34 +++++++++++++++++++ .../gcc.dg/debug/btf/btf-decltag-typedef.c | 15 ++++++++ .../gcc.dg/debug/btf/btf-typetag-1.c | 20 +++++++++++ .../gcc.dg/debug/dwarf2/annotation-1.c | 20 +++++++++++ .../gcc.dg/debug/dwarf2/annotation-2.c | 17 ++++++++++ .../gcc.dg/debug/dwarf2/annotation-3.c | 20 +++++++++++ .../gcc.dg/debug/dwarf2/annotation-4.c | 34 +++++++++++++++++++ 8 files changed, 178 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c new file mode 100644 index 00000000000..b2d6820cf23 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-func.c @@ -0,0 +1,18 @@ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x11000000\[\t \]+\[^\n\]*btt_info" 4 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xffffffff\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*decltag_compidx" 1 } } */ + +#define __tag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __tag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __tag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +extern int bar (int __tag1, int __tag2) __tag3; + +int __tag1 __tag2 foo (int arg1, int *arg2 __tag2) + { + return bar (arg1 + 1, *arg2 + 2); + } diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c new file mode 100644 index 00000000000..bb125b53ce7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-sou.c @@ -0,0 +1,34 @@ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x11000000\[\t \]+\[^\n\]*btt_info" 16 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*decltag_compidx" 2 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x1\[\t \]+\[^\n\]*decltag_compidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x2\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x3\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x4\[\t \]+\[^\n\]*decltag_compidx" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xffffffff\[\t \]+\[^\n\]*decltag_compidx" 6 } } */ + +#define __tag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __tag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __tag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +struct t { + int a; + long b __tag3; + char c __tag2 __tag3; +} __tag1 __tag2; + +struct t my_t __tag1 __tag3; + + +union u { + char one __tag1 __tag2; + short two; + int three __tag1; + long four __tag1 __tag2 __tag3; + long long five __tag2; +} __tag3; + +union u my_u __tag2; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c new file mode 100644 index 00000000000..6a44aaf9623 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-decltag-typedef.c @@ -0,0 +1,15 @@ +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x11000000\[\t \]+\[^\n\]*btt_info" 3 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0xffffffff\[\t \]+\[^\n\]*decltag_compidx" 3 } } */ + +#define __tag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __tag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __tag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +struct s { int a; } __tag1; + +typedef struct s * sptr __tag2; + +sptr my_sptr __tag3; diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c new file mode 100644 index 00000000000..0d046265b7a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-typetag-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile ) */ +/* { dg-options "-O0 -gbtf -dA" } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x12000000\[\t \]+\[^\n\]*btt_info" 4 } } */ + +#define __tag1 __attribute__((debug_annotate_type("tag1"))) +#define __tag2 __attribute__((debug_annotate_type("tag2"))) +#define __tag3 __attribute__((debug_annotate_type("tag3"))) + +int __tag1 * x; +const int __tag2 * y; + +struct a; + +struct b +{ + struct a __tag2 __tag3 * inner_a; +}; + +struct b my_b; diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c new file mode 100644 index 00000000000..f6f305c2739 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __decltag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __decltag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __decltag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +struct S { + int a __decltag2 __decltag3; + int b __decltag1; +} __decltag1 __decltag2; + +struct S my_S __decltag3; + +/* Verify that we get the expected DW_TAG_GNU_annotation DIEs for each tag. + Note: one more TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 7 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_decl\"" 6 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-1\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-2\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-3\"" 2 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c new file mode 100644 index 00000000000..04628fb1b81 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __typetag1 __attribute__((debug_annotate_type("type-tag-1"))) +#define __typetag2 __attribute__((debug_annotate_type("type-tag-2"))) +#define __typetag3 __attribute__((debug_annotate_type("type-tag-3"))) +int __typetag1 * x; + +char * __typetag1 buf; + +int * __typetag1 * __typetag2 __typetag3 g; + +/* Verify we get the expected annotation dies. Note +1 TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 6 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_type\"" 5 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-1\"" 3 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-2\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-3\"" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c new file mode 100644 index 00000000000..0548cd52d6d --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-3.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __decltag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __decltag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __decltag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +extern int foo (char a, int b) __decltag1 __decltag3; + +int bar (int x) +{ + return foo ('a', x); +} + +/* Verify that we get the expected DW_TAG_GNU_annotation DIEs for each tag. + Note: one more TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 3 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_decl\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-1\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-2\"" 0 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-3\"" 1 } } */ diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c new file mode 100644 index 00000000000..9d2b3ad5c00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/annotation-4.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-gdwarf -dA" } */ +#define __decltag1 __attribute__((debug_annotate_decl("decl-tag-1"))) +#define __decltag2 __attribute__((debug_annotate_decl("decl-tag-2"))) +#define __decltag3 __attribute__((debug_annotate_decl("decl-tag-3"))) + +#define __typetag1 __attribute__((debug_annotate_type("type-tag-1"))) +#define __typetag2 __attribute__((debug_annotate_type("type-tag-2"))) +#define __typetag3 __attribute__((debug_annotate_type("type-tag-3"))) + +/* Note the decl tags on these parameters will not be recorded... */ + +extern int foo (int * __typetag1 x __decltag1, + char * __typetag3 c __decltag1 __decltag2); + + +/* ... but here they will be. */ + +int bar (int * x __decltag1 __decltag3, char **buf __decltag2 __decltag3) +{ + return foo (x, buf[0]); +} + +/* Verify that we get the expected DW_TAG_GNU_annotation DIEs for each tag. + Note: one more TAG in debug abbrev. */ +/* { dg-final { scan-assembler-times " DW_TAG_GNU_annotation" 7 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_decl\"" 4 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-1\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-2\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"decl-tag-3\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_name: \"debug_annotate_type\"" 2 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-1\"" 1 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-2\"" 0 } } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value: \"type-tag-3\"" 1 } } */