From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by sourceware.org (Postfix) with ESMTPS id 2CE00382E812 for ; Tue, 9 Mar 2021 10:04:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2CE00382E812 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1299tFER135067 for ; Tue, 9 Mar 2021 10:04:19 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 3742cn6pnp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 09 Mar 2021 10:04:19 +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 1299pS3K030583 for ; Tue, 9 Mar 2021 10:04:18 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by aserp3020.oracle.com with ESMTP id 374kmy8n2w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 09 Mar 2021 10:04:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e6s2FTt0LnbJJEeS9dfoWyGQVQnT2Ir3m0Ly2jcLCglCe9n3UaIm3qjJlfiwLKyuyhRmW3ZNXdu8hgHeq4dX6MpLDX4T+S/QACvecbHipRNgY2lBWlm7yissTbSORXdqWuwqJBdjLoe8DxHScg1OxoXxlRb+a8EvQlrw180DdfrtQVbSHVHivixMhX2VMFNyPGsMGqSmIMoFiEXsmD6iVp9v3OpKRxJluuFvPkQmKPlv0Gd9nlsVEcFTLLFoEUDRgsNSJPJ3N4554SbP4f1JW2qZVsdXwirZfCUt/AgPYhMEZvwrPkFT4RrEN+6g3w0AqFkkUVSIUZGhuqqyWwyoVA== 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=uAVBAGQOtk/s85mJnqHF2W96v3e7Uig5czVG0nvIv4Y=; b=Du1e2jIkJVdrmHeMZLipH7KkfDTysrJPXfp8mkq0dvhaVxHNFcjkyJXg4w0Qy2962VFmkIzj+W/gIChGmoS9q5HwI1R4hdcB/wAkM3KeFOPmrg/CkjidulJGUalJhmDv9/XTWheEoPtg79Iycod3PdNnZbRNWOrh5M60fAoY0rxbIOOpNLlOn5PMGv6y2WQPQivf7VNORdY1z0t4qlrZ2s75jYvfOTa3gxH8jH4h7TPoqH8YV0NHXdahjlcQFPQ9LMo42Qbei/2YmIVKffmgsCuuloCdXLakz7GTnrJ0F8r8jGVZvemdtHnK87o5ZxiKYBNAWDI/5rmToulOfyEGKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) by DM5PR10MB1675.namprd10.prod.outlook.com (2603:10b6:4:e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.28; Tue, 9 Mar 2021 10:04:15 +0000 Received: from DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::35f2:ac4c:f8c0:ee4]) by DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::35f2:ac4c:f8c0:ee4%7]) with mapi id 15.20.3912.027; Tue, 9 Mar 2021 10:04:15 +0000 From: "Jose E. Marchesi" To: gcc-patches@gcc.gnu.org Subject: [PATCH V4 0/5] Support for the CTF and BTF debug formats Date: Tue, 9 Mar 2021 11:03:57 +0100 Message-Id: <20210309100402.16632-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.72] X-ClientProxiedBy: LO2P265CA0242.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::14) To DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from termi.localdomain (141.143.193.72) by LO2P265CA0242.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 9 Mar 2021 10:04:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ee25026b-dc33-4fed-2536-08d8e2e2b24f X-MS-TrafficTypeDiagnostic: DM5PR10MB1675: 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: 23dERPwuF1Y725PGsK7vBRV4wxhnWhJ832kR8TGWBHJcrrVfNWm2ErmbQze+8FeLZqwXTJPQk9KwLl0xXh8wpTlAKxolAgtLfNtRnp4IYsyVwC9MFtTc2Hd9CutLEt9jPEkCz1zOqWm7gGV6+SKadcchjNSNfz/Qb4+B7sdtEvxcDp2XsoWHs1xGI/QPw8WdRef4Qei589wtloydqSUx8KdMYU1DXxpXOU3yTtomHP2cdT0BAOH3MtyetMVWp+Mh5Ky7Wg7eysMLLqI2yWCEJ2Ka1i3vHE7Dgfys1oZqLQXrENdAqruQbb0UdGQlou89SmzLUV5HLMzeMrQronWKJ99exDGe+iIgyXZUgE+CIEVJRKEjHJUiM+gIma29wAwDzoBwGENgeu9r1f85paMxqNLHsPi64Tdc88OO3jEpJ+IzL0pCh6sbg2eDaGO/1+Nj0UiYnmNpTXYZYPnKrnjeQ+3deijqwsrgu+WtQOBiy/GgcDTcJo277tqayIw/7c7Y7QJj9gf3uHbEA5mXPOjqxgoKiclAyjmBtY+iO+bRv4IsrXgbSo7BPMhSiyKzozv1hG2l4hugTX1/+fDf0N9ke/tJmdipQccrNfnsk17Cd4M= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB2041.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(136003)(396003)(366004)(346002)(39860400002)(26005)(5660300002)(316002)(6666004)(30864003)(86362001)(1076003)(8676002)(478600001)(45080400002)(83380400001)(16526019)(186003)(966005)(956004)(2616005)(2906002)(8936002)(6486002)(6916009)(6506007)(36756003)(66946007)(66556008)(66476007)(6512007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?C+aOG5XFUYqvO7L52kURvEDaclgwPShyMmuiee2uzKxzp1Kid2bdZmEgp9/W?= =?us-ascii?Q?7wsFWIp+JJzGSgSQ7cXYTBUNyAg9MputfFUfBesm7HhOj7CgOYro1p4oYeES?= =?us-ascii?Q?AHdDOnYRmv6faf55DFLmNNeFGLZUIhtCaIyN/GCIu7a1PHqe5PhDsIwLgka5?= =?us-ascii?Q?ay4MCw+7WevQ6JE0C6jy/ZGYrTHKk16MEkIzeyTBOktdOuFrf1zOIRwt+VBZ?= =?us-ascii?Q?0XSNwqm2z1+J+hD+H7d2G1XLUT6JDW1QxRXKRgEXSPGms5zbdyzL5b2/Azcr?= =?us-ascii?Q?w8NxlJWrm2V3Zrhd2BJmZUw48Lh2GujbaFSrxVkdVBonuXpneI4omV/UMu6J?= =?us-ascii?Q?aCqMZyqYUmM5aUBr54lMDDJ2HUIbZ083/jZMd4Z5GF45EHK3HBkdpARjtLwW?= =?us-ascii?Q?enZlHuod0UOzDTK6X//sAG4fob1q8CCUGl/y0R4APWB+Jjgv/cwNk/izuhZB?= =?us-ascii?Q?CkubfomyT2Gso65+FGivykzp9oQzEZ1VZtH9drLvTSn695GRpVSfV7wCOXMD?= =?us-ascii?Q?jFdrd5ssLEzpr7mZLrqyrvMQryXe4iH2jY2wBhv4OAvkPwAE2vhOJd7Oel/7?= =?us-ascii?Q?d7qfaL0c9tbR4ZQtphA8qaOCawMSD+eVo7p/4jgCyygJSl59aA8qe7zR9mFn?= =?us-ascii?Q?DSdROIdZxh8lBb1wRWrr8WpfcGt38rP/QogOtZGwWQSdwqAdTOdQKZGdeGEh?= =?us-ascii?Q?EkBW57lNn6KVnodLf7KT2OdsX7aArEkR7o1ON4PLlmm5axOMMJNr6MCsvioL?= =?us-ascii?Q?d3rPKCs3tqvP1P/5xw8X9Gvi33ltwOrgSNE0DCVNTlJV0z9dsGdOsecDxouV?= =?us-ascii?Q?af+fvBMojACcKtQzJwL5s7OtNTeMG1CBX/Mrp6OSfmHhx2FMsuyWaGcyjefw?= =?us-ascii?Q?OyBwHYjrzHfJog2NLRxA6JgT1PkPr4LAgJ7Z9qEFjzolyB8f8LxFfDFpMWQV?= =?us-ascii?Q?6byCJP9YYXO1L/hE9orivP2YUR9HMWep2MB9S0rBd14v2nP704DV91fjgyOO?= =?us-ascii?Q?gqWolFyA5TDWA8ck4K5vsPozAEhykT2emXvqmOtiyOViESCt+sdVD9CqREM4?= =?us-ascii?Q?VIDW6zw28DAe9nLjnmJTjAH7a3Z9quZOcBBuR3IrcEZZEiodNadg3Trx7gTr?= =?us-ascii?Q?2FVEIlIXQy7tifiC0wazMG2r1VIhepJzx4N5wfdbZkRJAFVdrFK5EstmM1wg?= =?us-ascii?Q?mdcEmXDi4Hzp5Y81/QHmCxi1QdOc9LA8uMxalnjWGZIrJmZEUJKabZ6e4B9i?= =?us-ascii?Q?S0JNM37ALPkSW7ug1uh4pu/Dqr/uM8xT+y521f6iG9XG4zYcrURDf+IS0lA+?= =?us-ascii?Q?nBQJcw3X1Rmh8I92XmvtMBFM?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee25026b-dc33-4fed-2536-08d8e2e2b24f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB2041.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2021 10:04:15.7891 (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: VdjSJ0goHHjgoawVu+z3W4T72YFT+N2VI7JRKByeqNnw0s9DMBEUUFeD7rm/PkUwV/VfjUk+XnZmoyOhwJ4/ROf2U9iPuC2KjeOqa9k9/nc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1675 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9917 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103090048 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9917 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 clxscore=1015 phishscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 bulkscore=0 mlxscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103090048 X-Spam-Status: No, score=-5.1 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_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 10:04:23 -0000 [Changes from V3: - Rebased to latest master. - Several bug fixes in the BTF support. - More testing: 860 Gentoo packages built with -gctf activated by default.] 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. dwarf2ctf.c Code that tranform the internal GCC DWARF DIEs into CTF container structures. This file is included in dwarf2out.c. 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); ctf_debug_finalize (filename); } In turn, 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 opted by writing dwarf2ctf.c in a way it can just be #included in dwarf2ctf.c. A question remains: would it be better to abstract these types and functions in an API 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[123] These options mimic the -g[123...] options for DWARF. This involved adding new entries for debug_info_type: CTF_DEBUG - Write CTF debug info. BTF_DEBUG - Write BTF debug info. CTF_AND_DWARF2_DEBUG - Write both CTF and DWARF info. Doing this, we just followed the trend initiated by vmsdbgout.c, which added VMS_DEBUG and VMS_AND_DWARF2_DEBUG. This approach is not very good, because debug_info_type was designed to cover different debug hook implementations; debug formats, in contrast, are a different thing. This translates to problems and fragile behavior: - Everywhere write_symbols is checked we have to expand the logic to take the CTF values into account. You can see that is the case in this patch series. This is very fragile and doesn't scale well: we are most probably missing some checks. - The CTF debug format needs certain DWARF debug level (2) in order to work, since otherwise not enough type DIEs get generated. This will probably happen with some other formats as well. - Therefore, -gctf implicitly sets the DWARF debug level to 2. But if the user uses -gctf -g1, the CTF information will be incomplete because -g1 resets the DWARF debug level to 1. -gtoggle also presents difficulties. - Backends select what debug hooks to use by defining constants like DWARF2_DEBUGGING_INFO. Since the new debug formats are based on the DWARF debug hooks, that is the constant to define by the backends wanting to support DWARF + debug infos. However, some backends may want to use one of the debug formats by default, i.e. for -g. This is the case of the BPF backend, that needs to generate BTF instead of DWARF. Currently, there is no way to specify this. We could add a new optional backend hook/constant to select the desired default debug format, like: #define DWARF2_DEBUGGING_INFO /* Selects the dwarf debug hooks */ /* Selects the default debug format to emit with -g. */ #define CTF_DEBUGGING_FORMAT #define BTF_DEBUGGING_FORMAT #define DWARF_DEBUGGING_FORMAT /* The default */ Regardless of what debug format is defined as the default, the other formats are also available with -gdwarf, -gctf, -gbtf, etc. David Faust (1): Enable BTF generation in the BPF backend Indu Bhagat (1): CTF/BTF documentation Jose E. Marchesi (3): Add new function lang_GNU_GIMPLE CTF/BTF debug formats CTF/BTF testsuites gcc/Makefile.in | 6 + gcc/btfout.c | 843 ++++++++++++++++++ gcc/common.opt | 20 + gcc/config/bpf/bpf.c | 4 - gcc/config/bpf/bpf.h | 12 +- gcc/ctfc.c | 831 +++++++++++++++++ gcc/ctfc.h | 351 ++++++++ gcc/ctfout.c | 774 ++++++++++++++++ gcc/doc/invoke.texi | 20 + gcc/dwarf2cfi.c | 4 +- gcc/dwarf2ctf.c | 832 +++++++++++++++++ gcc/dwarf2out.c | 35 +- gcc/final.c | 6 +- gcc/flag-types.h | 28 +- gcc/gengtype.c | 2 +- gcc/langhooks.c | 9 + gcc/langhooks.h | 1 + gcc/opts.c | 108 ++- gcc/targhooks.c | 3 +- gcc/testsuite/gcc.dg/debug/btf/btf-1.c | 6 + gcc/testsuite/gcc.dg/debug/btf/btf-2.c | 10 + .../gcc.dg/debug/btf/btf-anonymous-struct-1.c | 23 + .../gcc.dg/debug/btf/btf-anonymous-union-1.c | 23 + gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c | 31 + .../gcc.dg/debug/btf/btf-bitfields-1.c | 34 + .../gcc.dg/debug/btf/btf-bitfields-2.c | 26 + .../gcc.dg/debug/btf/btf-bitfields-3.c | 43 + .../gcc.dg/debug/btf/btf-cvr-quals-1.c | 52 ++ gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c | 30 + .../gcc.dg/debug/btf/btf-forward-1.c | 24 + .../gcc.dg/debug/btf/btf-function-1.c | 18 + .../gcc.dg/debug/btf/btf-function-2.c | 18 + gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c | 44 + .../gcc.dg/debug/btf/btf-pointers-1.c | 25 + .../gcc.dg/debug/btf/btf-pointers-2.c | 14 + gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c | 22 + .../gcc.dg/debug/btf/btf-typedef-1.c | 82 ++ gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c | 16 + .../gcc.dg/debug/btf/btf-variables-1.c | 33 + gcc/testsuite/gcc.dg/debug/btf/btf.exp | 41 + gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c | 6 + gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c | 10 + .../gcc.dg/debug/ctf/ctf-anonymous-struct-1.c | 23 + .../gcc.dg/debug/ctf/ctf-anonymous-union-1.c | 26 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c | 31 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c | 38 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c | 17 + gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c | 13 + .../gcc.dg/debug/ctf/ctf-attr-mode-1.c | 22 + .../gcc.dg/debug/ctf/ctf-attr-used-1.c | 22 + .../gcc.dg/debug/ctf/ctf-bitfields-1.c | 30 + .../gcc.dg/debug/ctf/ctf-bitfields-2.c | 39 + .../gcc.dg/debug/ctf/ctf-bitfields-3.c | 16 + .../gcc.dg/debug/ctf/ctf-bitfields-4.c | 19 + .../gcc.dg/debug/ctf/ctf-complex-1.c | 22 + .../gcc.dg/debug/ctf/ctf-cvr-quals-1.c | 65 ++ .../gcc.dg/debug/ctf/ctf-cvr-quals-2.c | 30 + .../gcc.dg/debug/ctf/ctf-cvr-quals-3.c | 25 + .../gcc.dg/debug/ctf/ctf-cvr-quals-4.c | 23 + gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c | 21 + gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c | 27 + .../gcc.dg/debug/ctf/ctf-file-scope-1.c | 25 + gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c | 16 + .../gcc.dg/debug/ctf/ctf-forward-1.c | 40 + .../gcc.dg/debug/ctf/ctf-forward-2.c | 16 + .../gcc.dg/debug/ctf/ctf-func-index-1.c | 25 + .../debug/ctf/ctf-function-pointers-1.c | 24 + .../debug/ctf/ctf-function-pointers-2.c | 22 + .../debug/ctf/ctf-function-pointers-3.c | 21 + .../debug/ctf/ctf-function-pointers-4.c | 18 + .../gcc.dg/debug/ctf/ctf-functions-1.c | 34 + gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c | 17 + .../gcc.dg/debug/ctf/ctf-objt-index-1.c | 30 + .../gcc.dg/debug/ctf/ctf-pointers-1.c | 26 + .../gcc.dg/debug/ctf/ctf-pointers-2.c | 25 + .../gcc.dg/debug/ctf/ctf-preamble-1.c | 11 + .../gcc.dg/debug/ctf/ctf-skip-types-1.c | 33 + .../gcc.dg/debug/ctf/ctf-skip-types-2.c | 17 + .../gcc.dg/debug/ctf/ctf-skip-types-3.c | 20 + .../gcc.dg/debug/ctf/ctf-skip-types-4.c | 19 + .../gcc.dg/debug/ctf/ctf-skip-types-5.c | 19 + .../gcc.dg/debug/ctf/ctf-skip-types-6.c | 18 + .../gcc.dg/debug/ctf/ctf-skip-types-7.c | 18 + .../gcc.dg/debug/ctf/ctf-str-table-1.c | 26 + gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c | 25 + gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c | 32 + .../gcc.dg/debug/ctf/ctf-struct-array-1.c | 65 ++ .../gcc.dg/debug/ctf/ctf-struct-pointer-1.c | 21 + .../gcc.dg/debug/ctf/ctf-struct-pointer-2.c | 22 + .../gcc.dg/debug/ctf/ctf-typedef-1.c | 68 ++ .../gcc.dg/debug/ctf/ctf-typedef-2.c | 20 + .../gcc.dg/debug/ctf/ctf-typedef-3.c | 24 + .../gcc.dg/debug/ctf/ctf-typedef-struct-1.c | 14 + .../gcc.dg/debug/ctf/ctf-typedef-struct-2.c | 17 + .../gcc.dg/debug/ctf/ctf-typedef-struct-3.c | 32 + gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c | 14 + .../gcc.dg/debug/ctf/ctf-variables-1.c | 25 + .../gcc.dg/debug/ctf/ctf-variables-2.c | 16 + gcc/testsuite/gcc.dg/debug/ctf/ctf.exp | 41 + gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c | 7 + gcc/toplev.c | 25 +- include/btf.h | 196 ++++ include/ctf.h | 513 +++++++++++ libiberty/simple-object.c | 3 + 104 files changed, 6704 insertions(+), 25 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/testsuite/gcc.dg/debug/btf/btf-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-forward-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-typedef-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-variables-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf.exp create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-mode-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-attr-used-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-complex-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-file-scope-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-func-index-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-objt-index-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-4.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-5.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-6.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-skip-types-7.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-pointer-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-3.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-2.c create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf.exp create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c create mode 100644 include/btf.h create mode 100644 include/ctf.h -- 2.25.0.2.g232378479e