From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id CDF6C386FC1B for ; Mon, 28 Jun 2021 17:35:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CDF6C386FC1B Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15SHKXlt022272 for ; Mon, 28 Jun 2021 17:35:38 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 39f174hv5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 28 Jun 2021 17:35:37 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15SHJmXZ155964 for ; Mon, 28 Jun 2021 17:35:37 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by aserp3020.oracle.com with ESMTP id 39dv241ant-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 28 Jun 2021 17:35:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UwwSTWw16z6sAEjbwKRHZ6IRqa5EY/8qg1jPVO/wZohkxvLDE07LQL6LDFG0Klk6rstUAuxAHWFbCgw35tea2JGqSrHTbKt1gqCC0mXCg5Detp7E6O3JetZLQXtyrPliZYoQqaB4DPnVDz1hwKzUgngLDSTpNAYBw6FbRlnClkd9lVNRH7793y/Yq3ldYoEABbMDZicui2jo2g7dhxr1FqGYdAp6jpPiflhmIi4nb1G1mZVtGwEV7F7mhZ9lbTNLiEykpiVpc4Quc8lnCTHddSKtol02xxhhJ5/SIzg6PxgqMBZnvLZMmrS48DQpErkY2hoDJUKCGw9F8RpkUtXxYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wYdu0/izQLBPB/8aGWEBDObxHGZyw6jwHlPilVtxOVY=; b=Oq3aL+JPmqo9Kvn0OAuhpicatxgdEtrddUadaxirCRuHNYJkR7hK7GtXUWFUA9gOrl92Vm1LzuTM/KoXP87hUYu/KEbtCtXlj065dq7+h0cRp3MFnZ8O9vceyVqltM4xmgIJv0SAfNhtwcwoo0o3/dQn1XyrJjJe+ubOSSsuCnmEU9C2iNIXHcFysl7pOD0IF2R5hJGJ4WB1/t4/PHGgfnEPVBRnhtHRNPYFP5CixLseb7oX9gsJGHjZzlc7bjssrq00P3vJ3Kob6aWJNW9dyFmK+i/IG8sg/vpSdwoxBjepiABdxWYuqZtAhC5uZpeD9qjhCeAP39HUuzbZwOIUAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) by DS7PR10MB5200.namprd10.prod.outlook.com (2603:10b6:5:3a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Mon, 28 Jun 2021 17:35:35 +0000 Received: from DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::3c15:20ad:f67a:eb04]) by DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::3c15:20ad:f67a:eb04%12]) with mapi id 15.20.4264.026; Mon, 28 Jun 2021 17:35:34 +0000 From: "Jose E. Marchesi" To: gcc-patches@gcc.gnu.org Subject: [COMMITTED V10 0/7] Support for the CTF and BTF debug formats Date: Mon, 28 Jun 2021 19:35:16 +0200 Message-Id: <20210628173523.29350-1-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.25.0.2.g232378479e Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [141.143.193.71] X-ClientProxiedBy: LO4P123CA0283.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::18) To DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from termi.localdomain (141.143.193.71) by LO4P123CA0283.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Mon, 28 Jun 2021 17:35:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba404823-198e-4d9b-041f-08d93a5b227c X-MS-TrafficTypeDiagnostic: DS7PR10MB5200: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UO4TqwyqYyoPtkOhJmO9fe1LByCgQmpxdcwKOm1WLCCu3mJNBPPof+Ur+zLEc93EFgs1oulCxGSXLSHozmltohBH5Emz7EE2oUcbzqREaFvzlLw1P188HuFcAVA0J19uhlaO4H7+XI3ae65FGPfPVytdWiqz78TkakvdVT0IbpoxbZdCzqOMuKJO8ZCllwi/ZR/kegbxPDjZurwFJztK7ntUnzuPS8d6j0xeCFhfV+MuaAunaItoGYSE9HbuoYNgMTCczra2DE1i1KgNQp0iSdErPE7PlsF4YF17lQmG/fu7rRFCMqvJYOvyTKmX29bXShwLXMPcKmuEUIDPYKrxuwWZbqfzmiG7EwoCe/P4U9dxga+SCBsPTKXtvxlz5hycBhc8kDO6yGhh8FSG4TVn5pUO/0bbANI3ApuWmwSd8aluRuYejaYkJq/1u7SZHWuAmu0GOVfG5b9dCbKt7L9jCQPaDY5LbwfCpi2GZe0iDvyJfT86T1tE7ZfzxJFmnlD2/HAicdsvKDLbO5rt+Xqnk6v30+/6iRtZ4bKIF1kGyCbPUyp5OarT9CFpoUJG0ZPJ7+0cZIT27b33dJaQbrwTIeGJIeC/B6LCJE56tmkHqwKzssIl3mzwOSyv9/g6i6KugFmpiTkGRtD6kJt09UxL0n56V5yFtdC64D/W4RXukV2RIexXHQkO3ffqc7AnVa3RGgYjccMJmDpSDND7EexRoD0tJOJUoIwCHABic/e2o9C7h718ivL00r2hhMM2GPTxBA5Z4pbfc4eh++gNIUbdjk2J5HkCoZPWstpDwJx5lUYRKsdUHeqvbYiqKWYJu8it X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB2041.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(396003)(376002)(136003)(346002)(366004)(6916009)(83380400001)(2906002)(6512007)(966005)(478600001)(6486002)(16526019)(30864003)(66476007)(1076003)(6666004)(316002)(6506007)(38350700002)(38100700002)(8936002)(5660300002)(2616005)(956004)(36756003)(186003)(8676002)(26005)(66556008)(66946007)(86362001)(45080400002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?11u52hXFwnDIm2TLonxBf3sttsdgQ+RKpRT+5LfkFCuLXncRgX8SWF3HqLbY?= =?us-ascii?Q?fvpsHVHsAd5BOF+5v2rwsCLnYVh0DmejBKtxkto9c6f0JntjJst09C/rAX98?= =?us-ascii?Q?4BumDVwX2ZRthRD32fMqkMqoTpJa3f4eIb34Ca7kA9Hq3rw7lmK+lIaTLHeg?= =?us-ascii?Q?ZSUdxJ0XLoXfTPTvt9K1olBfgGSSTpCCTvdVYZnPBHcGa+LoOrrmsIF0z65j?= =?us-ascii?Q?3k2PdAolMrMNy1p3Q6uDY1yB2O9rTUB+LoQKnkbiJfphxq+GKc8fh6j6ehPK?= =?us-ascii?Q?xr6UsiOid1O+XT2bNvTPxAsvz+iJXmyV701sA+sszfhTFgv1p+nnl5SJmAqN?= =?us-ascii?Q?I0zmrCZm6WwXKUQ5WyxVIMLM5cMQ5q+4NosSBVJCKZfLQC7tTG3AosN00wS4?= =?us-ascii?Q?vz4UI14K3PosxyydQQAmBFwk7RRKlH89zzRh3ov2FLOOHIvzEMk7kbBGM/ar?= =?us-ascii?Q?+kNsNAj3m3AqEhzeuWFI30Z/n+sfNdH/lf+9Ygs05coYb5RF4OUovtdGDwO9?= =?us-ascii?Q?zwG2dnzE3YvWCkqyuNfQyVt3/Bmi6mrEVR1CgCWqMOg1D8dpzZR444b/ltwU?= =?us-ascii?Q?yT1C69Y8mE+CvXWHZEz6H3fj8Y2TloI5GjTFCp0QfWwnUDcnnY3ce/jWyfTg?= =?us-ascii?Q?gbY9vcCpoMRA2a5DrAtU3gDLfuoeUiIB/St7+m3ZUp6UffSRAuDRTzBeQS4S?= =?us-ascii?Q?CWYEm41XGkoUwMyrt3JGGv6zzcNArzCSpP+PZLA6KPxi5Yf4CN5FoIDzBM/K?= =?us-ascii?Q?UH9xNFucw7D8LCA5wwKnnKzZ6d2ILdSVZEoTjZhD536lKATqTT9ZYvNixeqc?= =?us-ascii?Q?bYD9V+QqVr4Ai8GC0kTomfyHbvrN4eOeQCiIyE2B/kh1AUpTvr4a1+WNF3t6?= =?us-ascii?Q?TArSOpLG74C5+26CwMeLqSszO9LwMi5stmoURMbTl3X/zEvj+uGxPlOFhOD7?= =?us-ascii?Q?sCEPQgYsftSmQKgM7MYXASnDCk1TXV0nC+H10psb3v08/P1mqDGWyQ8N5e/U?= =?us-ascii?Q?y5LygVmlEB1iT9zgEJ50G8fnvD+zM754eE6w4PmRTQCIOswMMBiI0OLCkyHs?= =?us-ascii?Q?0ugrddPWRdEZavBWzI3Bp44sPan3vqUwMi8D7v4vd3GzmjPC3M1AUEzTXjUb?= =?us-ascii?Q?/tLQ5fUam9J9+vRQVRlg7y9Uq+9mqj29Zq16Cs8bs4WRs9sl3xXQ6zWoZfJF?= =?us-ascii?Q?rnBsWdu09rzc1OEJhOhu+tsYGhbCdYx4WQURaNCZ/10AEnBa0+7TYH6JrZIR?= =?us-ascii?Q?N91IKnojHR3KkkL4Y29KLidoQ3KXb+eCRSvCDZcrFyMcCBRRM8q17q0wmuMG?= =?us-ascii?Q?POKFKC+6JcWmLikE0uJwyoUj?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba404823-198e-4d9b-041f-08d93a5b227c X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB2041.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2021 17:35:34.8142 (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: qyO/BeaWcKte19JEDHp02BrQlSgtHb8+eX6SGYJZd4yUok/vJ7zc/xYeUFxXvCXWXk3YBJYGC+Zms/SCx4jJg4m9IozhfjXNtCr94HwxpfQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5200 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10029 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106280115 X-Proofpoint-GUID: cAOQzbBYWdtEvqcTZUzI-_sn7gnYS5es X-Proofpoint-ORIG-GUID: cAOQzbBYWdtEvqcTZUzI-_sn7gnYS5es X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 17:35:42 -0000 [Changes from V9: All the patches have been OKed, provided a few things were fixed before pushing. These points, raised by Richard Biener and Jason Merrill, have been all addressed as part of the following changes: - No dwarf2int.h header is introduced anymore in the patch series. Instead, we are exporting the needed interface in the existing dwarf2out.h. We intend to do some refactoring of dwarf2out.[ch] in the near future. - Make it explicit in the manual that different debug formats can coexist. - Add code comment in dwarf2out_source_line. - Add missing function level comment for btf_debuginfo_p. - Use uint32_t for a couple of variables that used unsigned int before. - Use XNEWVEC instead of xmalloc. - Adhere to 80 chars line length. - A few other cosmetic fixes for upstreaming. Thanks a lot to the reviewers!] Hi people! Last year we submitted a first patch series introducing support for the CTF debugging format in GCC [1]. We got a lot of feedback that prompted us to change the approach used to generate the debug info, and this patch series is the result of that. This series also add support for the BTF debug format, which is needed by the BPF backend (more on this below.) This implementation works, but there are several points that need discussion and agreement with the upstream community, as they impact the way debugging options work. We are also proposing a way to add additional debugging formats in the future. See below for more details. Finally, a patch makes the BPF GCC backend to use the DWARF debug hooks in order to make -gbtf available to it. [1] https://gcc.gnu.org/legacy-ml/gcc-patches/2019-05/msg01297.html About CTF ========= CTF is a debugging format designed in order to express C types in a very compact way. The key is compactness and simplicity. For more information see: - CTF specification http://www.esperi.org.uk/~oranix/ctf/ctf-spec.pdf - Compact C-Type support in the GNU toolchain (talk + slides) https://linuxplumbersconf.org/event/4/contributions/396/ - On type de-duplication in CTF (talk + slides) https://linuxplumbersconf.org/event/7/contributions/725/ About BTF ========= BTF is a debugging format, similar to CTF, that is used in the Linux kernel as the debugging format for BPF programs. From the kernel documentation: "BTF (BPF Type Format) is the metadata format which encodes the debug info related to BPF program/map. The name BTF was used initially to describe data types. The BTF was later extended to include function info for defined subroutines, and line info for source/line information." Supporting BTF in GCC is important because compiled BPF programs (which GCC supports as a target) require the type information in order to be loaded and run in diverse kernel versions. This mechanism is known as CO-RE (compile-once, run-everywhere) and is described in the "Update of the BPF support in the GNU Toolchain" talk mentioned below. The BTF is documented in the Linux kernel documentation tree: - linux/Documentation/bpf/btf.rst CTF in the GNU Toolchain ======================== During the last year we have been working in adding support for CTF to several components of the GNU toolchain: - binutils support is already upstream. It supports linking objects with CTF information with full type de-duplication. - GDB support is to be sent upstream very shortly. It makes the debugger capable to use the CTF information whenever available. This is useful in cases where DWARF has been stripped out but CTF is kept. - GCC support is being discussed and submitted in this series. Overview of the Implementation ============================== dwarf2out.c The enabled debug formats are hooked in dwarf2out_early_finish. dwarf2int.h Internal interface that exports a few functions and data types defined in dwarf2out.c. dwarf2ctf.c Code that tranform the internal GCC DWARF DIEs into CTF container structures. This file uses the dwarf2int.h interface. ctfc.c ctfc.h These two files implement the "CTF container", which is shared among CTF and BTF, due to the many similarities between both formats. ctfout.c Code that emits assembler with the .ctf section data, from the CTF container. btfout.c Code that emits assembler with the .BTF section data, from the CTF container. >From debug hooks to debug formats ================================= Our first attempt in adding CTF to GCC used the obvious approach of adding a new set of debug hooks as defined in gcc/debug.h. During our first interaction with the upstream community we were told to _not_ use debug hooks, because these are to be obsoleted at some point. We were suggested to instead hook our handlers (which processed type TREE nodes producing CTF types from them) somewhere else. So we did. However at the time we were also facing the need to support BTF, which is another type-related debug format needed by the BPF GCC backend. Hooking here and there doesn't sound like such a good idea when it comes to support several debug formats. Therefore we thought about how to make GCC support diverse debugging formats in a better way. This led to a proposal we tried to discuss at the GNU Tools Track in LPC2020: - Update of the BPF support in the GNU Toolchain https://linuxplumbersconf.org/event/7/contributions/724/ Basically, the current situation in terms of diversity of debugging formats in GCC can be summarized in the following like: tree --+ +--> dwarf2out rtl --+ +--> dbxout +--> debug_hooks --+--> vmsdbgout backends --+ +--> xcoffout lto --+ +--> godump i.e. each debug format materializes in a set of debug hooks, as in gcc/debug.h. The installed hooks are then invoked from many different areas of the compiler including front-end, middle-end, back-end and also lto. Most of the hooks get TREE objects, from which they are supposed to extract/infer whatever information they need to express. This approach has several problems, some of which were raised by you people when we initially submitted the CTF support: - The handlers depend on the TREE nodes, so if new TREE nodes are added to cover new languages, or functionality in existing languages, all the debug hooks may need to be updated to reflect it. - This also happens when the contents of existing TREE node types change or get expanded. - The semantics encoded in TREE nodes usually are not in the best form to be used by debug formats. This implies that the several sets of debug hooks need to do very similar transformations, which again will have to be adjusted/corrected if the TREE nodes change. - And more... In contrast, this is how LLVM supports several debug formats: +--> DWARF IR --> class DebugHandlerBase --+--> CodeView +--> BTF i.e. LLVM gets debugging information as part of the IR, and then has debug info backends in the form of instances of DebugHandlerBase, which process that subset of the IR to produce whatever debug output. To overcome the problems above, we thought about introducing a new set of debug hooks, resulting in something like this: +--> godump +--> xcoffout debug_hooks -+--> vmsdbgout +--> dbxout +--> DWARF +--> dwarf2out --> n_debug_hooks --+--> BTF (walk) +--> CTF ... more ... See how these "new debug hooks" are intended to be called by the DWARF old debug hooks. In this way: - The internal DWARF representation becomes the canonical (and only) IR for debugging information in the compiler. This is similar to what LLVM uses to implement support for DWARF, BTF and the Microsoft debug format. - Debug formats (like CTF, BTF, stabs, etc) are implemented to provide a very simple API that traverses the DWARF DIE trees available in dwarf2out. - The semantics expressed in the DWARF DIEs, which have been already extracted from the TREE nodes, are free of many internal details and more suitable to be easily translated into whatever abstractions the debug formats require. To avoid misunderstandings, we got to refer to these "new debug hooks" simply as "debug formats". In this patch series we are using this later approach in order to support both CTF and BTF, and we can say we are happy about using the internal DWARF DIEs as a source instead of TREE nodes: it led to a more natural implementation, much easier to understand. This sort of confirms in practice that the approach is sound. The debug format API ==================== As you can see in the patch series, we hooked CTF in dwarf2out_early_finish like this: /* Emit CTF debug info. */ if (ctf_debug_info_level > CTFINFO_LEVEL_NONE && lang_GNU_C ()) { ctf_debug_init (); debug_format_do_cu (comp_unit_die ()); for (limbo_die_node *node = limbo_die_list; node; node = node->next) debug_format_do_cu (node->die); } And then the finalization/emission in dwarf2out_finish: /* Emit CTF/BTF debug info. */ if ((ctf_debug_info_level > CTFINFO_LEVEL_NONE || btf_debug_info_level > BTFINFO_LEVEL_NONE) && lang_GNU_C ()) ctf_debug_finalize (filename, btf_debug_info_level > BTFINFO_LEVEL_NONE); The reason for ctf_debug_finalize to be in dwarf2out_finish is that backends may (and will, in the case of the BPF backend) add additional debugging information. The call to debug_format_do_cu traverses the tree of DIEs passed to it calling ctf_do_die on them. This conforms the debug format API: FOO_debug_init () Initialize the debug format FOO. FOO_debug_finalize (FILENAME) Possibly write out, cleanup and finalization for debug format FOO. FOO_do_die (DIE) Process the given DIE. Note how the emission of DWARF is interrupted after that point, if no DWARF was requested by the user. dwarf2out - dwarf2ctf ===================== The functions ctf_debug_init, ctf_do_die and ctf_debug_finalize, that implement the API described above, are all in gcc/dwarf2ctf.c. Obviously, these routines need access to the dwarf DIE data structures, and several functions which are defined in dwarf2out.[ch], many (most?) of which are private to that file: dw_die_ref, get_AT, etc. Therefore, in this implementation we exported these functions and data types in dwarf2out.h. Command line options for debug formats ====================================== This implementation adds the following command-line options to select the emission of CTF and BTF: -gctf[123] -gbtf These options mimic the -g[123...] options for DWARF. Indu Bhagat (7): dwarf: externalize some DWARF internals for needs of CTF/BTF dejagnu: modularize gcc-dg-debug-runtest a bit CTF/BTF debug formats CTF/BTF testsuites CTF/BTF documentation Enable BTF generation in the BPF backend libiberty: copy over .BTF section when using LTO gcc/Makefile.in | 8 + gcc/btfout.c | 1129 +++++++++++++++++ gcc/common.opt | 15 + gcc/config/bpf/bpf.c | 4 - gcc/config/bpf/bpf.h | 12 +- gcc/ctfc.c | 969 ++++++++++++++ gcc/ctfc.h | 436 +++++++ gcc/ctfout.c | 830 ++++++++++++ gcc/doc/invoke.texi | 32 +- gcc/dwarf2cfi.c | 2 +- gcc/dwarf2ctf.c | 990 +++++++++++++++ gcc/dwarf2ctf.h | 53 + gcc/dwarf2out.c | 118 +- gcc/dwarf2out.h | 44 + gcc/final.c | 2 +- gcc/flag-types.h | 21 +- gcc/flags.h | 9 + gcc/gengtype.c | 3 +- gcc/opts.c | 137 +- gcc/testsuite/gcc.dg/debug/btf/btf-1.c | 6 + gcc/testsuite/gcc.dg/debug/btf/btf-2.c | 10 + .../gcc.dg/debug/btf/btf-anonymous-struct-1.c | 23 + .../gcc.dg/debug/btf/btf-anonymous-union-1.c | 23 + gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c | 31 + .../gcc.dg/debug/btf/btf-bitfields-1.c | 34 + .../gcc.dg/debug/btf/btf-bitfields-2.c | 26 + .../gcc.dg/debug/btf/btf-bitfields-3.c | 43 + .../gcc.dg/debug/btf/btf-bitfields-4.c | 23 + .../gcc.dg/debug/btf/btf-cvr-quals-1.c | 52 + .../gcc.dg/debug/btf/btf-datasec-1.c | 45 + gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c | 30 + .../gcc.dg/debug/btf/btf-forward-1.c | 24 + .../gcc.dg/debug/btf/btf-function-1.c | 18 + .../gcc.dg/debug/btf/btf-function-2.c | 18 + .../gcc.dg/debug/btf/btf-function-3.c | 22 + gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c | 44 + .../gcc.dg/debug/btf/btf-pointers-1.c | 25 + .../gcc.dg/debug/btf/btf-pointers-2.c | 13 + gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c | 22 + gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c | 19 + .../gcc.dg/debug/btf/btf-typedef-1.c | 82 ++ gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c | 16 + .../gcc.dg/debug/btf/btf-variables-1.c | 33 + .../gcc.dg/debug/btf/btf-variables-2.c | 27 + .../gcc.dg/debug/btf/btf-variables-3.c | 36 + gcc/testsuite/gcc.dg/debug/btf/btf.exp | 41 + gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c | 6 + gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c | 10 + .../gcc.dg/debug/ctf/ctf-anonymous-struct-1.c | 23 + .../gcc.dg/debug/ctf/ctf-anonymous-union-1.c | 26 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c | 31 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c | 38 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c | 17 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c | 13 + .../gcc.dg/debug/ctf/ctf-attr-mode-1.c | 22 + .../gcc.dg/debug/ctf/ctf-attr-used-1.c | 22 + .../gcc.dg/debug/ctf/ctf-bitfields-1.c | 30 + .../gcc.dg/debug/ctf/ctf-bitfields-2.c | 39 + .../gcc.dg/debug/ctf/ctf-bitfields-3.c | 16 + .../gcc.dg/debug/ctf/ctf-bitfields-4.c | 19 + .../gcc.dg/debug/ctf/ctf-complex-1.c | 21 + .../gcc.dg/debug/ctf/ctf-cvr-quals-1.c | 65 + .../gcc.dg/debug/ctf/ctf-cvr-quals-2.c | 30 + .../gcc.dg/debug/ctf/ctf-cvr-quals-3.c | 25 + .../gcc.dg/debug/ctf/ctf-cvr-quals-4.c | 23 + gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-1.c | 7 + gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-2.c | 7 + gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c | 21 + gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c | 27 + .../gcc.dg/debug/ctf/ctf-file-scope-1.c | 25 + gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c | 16 + .../gcc.dg/debug/ctf/ctf-forward-1.c | 40 + .../gcc.dg/debug/ctf/ctf-forward-2.c | 16 + .../gcc.dg/debug/ctf/ctf-func-index-1.c | 25 + .../debug/ctf/ctf-function-pointers-1.c | 24 + .../debug/ctf/ctf-function-pointers-2.c | 22 + .../debug/ctf/ctf-function-pointers-3.c | 21 + .../debug/ctf/ctf-function-pointers-4.c | 18 + .../gcc.dg/debug/ctf/ctf-functions-1.c | 34 + gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c | 17 + .../gcc.dg/debug/ctf/ctf-objt-index-1.c | 30 + .../gcc.dg/debug/ctf/ctf-pointers-1.c | 26 + .../gcc.dg/debug/ctf/ctf-pointers-2.c | 25 + .../gcc.dg/debug/ctf/ctf-preamble-1.c | 11 + .../gcc.dg/debug/ctf/ctf-skip-types-1.c | 38 + .../gcc.dg/debug/ctf/ctf-skip-types-2.c | 17 + .../gcc.dg/debug/ctf/ctf-skip-types-3.c | 20 + .../gcc.dg/debug/ctf/ctf-skip-types-4.c | 19 + .../gcc.dg/debug/ctf/ctf-skip-types-5.c | 19 + .../gcc.dg/debug/ctf/ctf-skip-types-6.c | 18 + .../gcc.dg/debug/ctf/ctf-skip-types-7.c | 18 + .../gcc.dg/debug/ctf/ctf-skip-types-8.c | 27 + .../gcc.dg/debug/ctf/ctf-str-table-1.c | 26 + gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c | 25 + gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c | 32 + .../gcc.dg/debug/ctf/ctf-struct-array-1.c | 65 + .../gcc.dg/debug/ctf/ctf-struct-array-2.c | 15 + .../gcc.dg/debug/ctf/ctf-struct-pointer-1.c | 21 + .../gcc.dg/debug/ctf/ctf-struct-pointer-2.c | 22 + .../gcc.dg/debug/ctf/ctf-typedef-1.c | 68 + .../gcc.dg/debug/ctf/ctf-typedef-2.c | 20 + .../gcc.dg/debug/ctf/ctf-typedef-3.c | 24 + .../gcc.dg/debug/ctf/ctf-typedef-struct-1.c | 14 + .../gcc.dg/debug/ctf/ctf-typedef-struct-2.c | 17 + .../gcc.dg/debug/ctf/ctf-typedef-struct-3.c | 32 + gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c | 14 + .../gcc.dg/debug/ctf/ctf-variables-1.c | 25 + .../gcc.dg/debug/ctf/ctf-variables-2.c | 16 + gcc/testsuite/gcc.dg/debug/ctf/ctf.exp | 41 + gcc/testsuite/lib/gcc-dg.exp | 83 +- gcc/toplev.c | 19 +- include/btf.h | 196 +++ include/ctf.h | 520 ++++++++ libiberty/simple-object.c | 6 + 114 files changed, 7851 insertions(+), 114 deletions(-) create mode 100644 gcc/btfout.c create mode 100644 gcc/ctfc.c create mode 100644 gcc/ctfc.h create mode 100644 gcc/ctfout.c create mode 100644 gcc/dwarf2ctf.c create mode 100644 gcc/dwarf2ctf.h create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-variables-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-variables-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf.exp create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-debug-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-8.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf.exp create mode 100644 include/btf.h create mode 100644 include/ctf.h -- 2.25.0.2.g232378479e