From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8050 invoked by alias); 30 Apr 2019 22:57:25 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 8000 invoked by uid 89); 30 Apr 2019 22:57:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy=recovery, aggressive, association, H*MI:nick X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Apr 2019 22:57:14 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3UMsmQQ080078 for ; Tue, 30 Apr 2019 22:57:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=pCixUVsfig+fFXdUJA1LgZrTw2/dYmYEk+nA5JWmtuY=; b=ruszuJSPt+8oCHNpM5kL72l9sRO3xf5xfw+atBRSVEqkIPcbRQvMBheDHlFeM7O0koIB 4M/+EBaPLzlIAzUkAbkeo3+LiQRNIghxbRtzdMbix6Bct4QEy7cjRTQ1rdRuYKih6Ait qdeK5WVD9tNzwicIF+Gs7xc0MLw9Cn0qsPY4hO+9zuyuwe6SngfT987BFrpiok08KwNB E7I/gtkXStXfwISh1nHvs6+TqDM8Srvmzc0JzgZGJ+Moz84BL8Tf/GsrHcgbhYM4kNt/ pDiawmacdoNIGwemZ52YBJIZwXo7GyLplTmMjRA9daQrt2prkhLR9keRwPZLghQKYnWw /g== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2s6xhy86y2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Apr 2019 22:57:12 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3UMtZkZ161506 for ; Tue, 30 Apr 2019 22:57:12 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2s6xhh0q57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Apr 2019 22:57:12 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3UMvBeI006621 for ; Tue, 30 Apr 2019 22:57:11 GMT Received: from loom.srvr.nix (/81.187.191.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 30 Apr 2019 15:57:11 -0700 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 00/19] libctf, and CTF support for objdump and readelf Date: Tue, 30 Apr 2019 22:57:00 -0000 Message-Id: <20190430225706.159422-1-nick.alcock@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00275.txt.bz2 This submission is the first part of multiple patch series which together add support for the Compact ANSI-C Type Format to the GNU toolchain. Compact C Type Format (CTF) is a reduced form of debugging information whose main purpose is to describe the type of C entities such as structures, unions, typedefs and function arguments. CTF format is optimized for compactness: it was originally designed for use-cases like dynamic tracing and online in-application debugging, where debugging information is meant to be present even in stripped binaries. CTF gains compactness over DWARF in four ways: - a more compact encoding, at the cost of irregularity. Rather than a regular scheme of tags and attributes within those tags, the structures are customized for each kind of C type described, which allows significant space savings. IDs are omitted and implied wherever possible to save even more space (the ID of each type in the type table is implied by its position, trading space for the need to scan the table at load time). - reuse of strings from the ELF file: CTF files have one string table built into the CTF format itself and one "external" table which is usually the table in the ELF file. Further improvements are possible here without format changes: we are looking into this. - a very compact association between the ELF symbol table and CTF. No symbol table indexes are recorded: all are implied: the data-object section is as compact as possible, containing nothing but a stream of type IDs describing the type of data symbols in symbol table order. - aggressive link-time deduplication will be added in the next patch series and will be the default behavior, resulting in further space savings. Types in CTF can be looked up by traversal from other types via a numeric type ID, by traversal of all types in the file, by ELF symbol table ID or by name (though not all types need be named). As in C, there are separate namesapces for top-level types, enums, structs and unions. There is no analogue of block scope: types within functions must either be promoted to the top level, stored in another CTF container (perhaps using CTF's single-level parent/child relationship), or not represented at all. Since the principal use case of CTF is to look up types given symbol table entries, and symbol tables are also a single flat namespace, this is not expected to be a serious limitation. All types CTF describes have a fixed size at CTF generation time, and there is nothing like the DWARF exprloc interpreter to compute the size of variably-sized entities. This is due to the adopted 'top-level model' and, consequently, VLAs are not supported. For an overview of the CTF format, see the documentation in the email I'll post as a followup to this patch series (we have yet to figure out where to put it). Most of this patch series implements a library that reads and writes this format, and a header file describing it. The linker, debugger, and objdump/objcopy are expected to use the library, while GCC will not. This first submission consists of the core library in libctf/, and CTF support in objdump and readelf: this leverages the debugging dump support in libctf, so the objdump and readelf support is a few dozen lines each on top of that. This patch series is an RFC. We are still implementing some additional features in order to capture the full potential of the format. Enhancements planned include: A new section implementing a compact version of DW_AT_call_site et al, allowing efficient backtracing even when the debuginfo is missing, including recovery of the value of parameters in at least 99.9% of the cases handled by DWARF 5 in existing code. Enhancements to the core data structures (particularly ctf_stype_t and ctf_member_t) reducing space spent on unused type bits when type IDs are < 2^16. Nick Alcock (19): include: new header ctf.h: file format description include: new header ctf-api.h libctf: lowest-level memory allocation and debug-dumping wrappers libctf: low-level list manipulation and helper utilities libctf: error handling libctf: hashing libctf: implementation definitions related to file creation libctf: creation functions libctf: opening libctf: ELF file opening libctf: core type lookup libctf: lookups by name and symbol libctf: type copying libctf: library version enforcement libctf: mmappable archives libctf: labels libctf: debug dumping libctf: build system binutils: CTF support for objdump and readelf Makefile.def | 5 + Makefile.in | 984 ++++- binutils/Makefile.am | 10 +- binutils/Makefile.in | 18 +- binutils/aclocal.m4 | 10 +- binutils/doc/Makefile.in | 9 +- binutils/doc/binutils.texi | 12 + binutils/doc/ctf.options.texi | 19 + binutils/objdump.c | 156 +- binutils/readelf.c | 206 + configure | 2 +- configure.ac | 2 +- include/ctf-api.h | 354 ++ include/ctf.h | 427 ++ libctf/Makefile.am | 31 + libctf/Makefile.in | 767 ++++ {binutils => libctf}/aclocal.m4 | 99 +- libctf/config.h.in | 98 + libctf/configure | 7120 +++++++++++++++++++++++++++++++ libctf/configure.ac | 59 + libctf/ctf-archive.c | 491 +++ libctf/ctf-create.c | 1937 +++++++++ libctf/ctf-decl.c | 195 + libctf/ctf-dump.c | 595 +++ libctf/ctf-error.c | 93 + libctf/ctf-hash.c | 277 ++ libctf/ctf-impl.h | 404 ++ libctf/ctf-labels.c | 138 + libctf/ctf-lib.c | 506 +++ libctf/ctf-lookup.c | 427 ++ libctf/ctf-open.c | 1359 ++++++ libctf/ctf-subr.c | 74 + libctf/ctf-types.c | 1019 +++++ libctf/ctf-util.c | 176 + 34 files changed, 18008 insertions(+), 71 deletions(-) create mode 100644 binutils/doc/ctf.options.texi create mode 100644 include/ctf-api.h create mode 100644 include/ctf.h create mode 100644 libctf/Makefile.am create mode 100644 libctf/Makefile.in copy {binutils => libctf}/aclocal.m4 (95%) create mode 100644 libctf/config.h.in create mode 100755 libctf/configure create mode 100644 libctf/configure.ac create mode 100644 libctf/ctf-archive.c create mode 100644 libctf/ctf-create.c create mode 100644 libctf/ctf-decl.c create mode 100644 libctf/ctf-dump.c create mode 100644 libctf/ctf-error.c create mode 100644 libctf/ctf-hash.c create mode 100644 libctf/ctf-impl.h create mode 100644 libctf/ctf-labels.c create mode 100644 libctf/ctf-lib.c create mode 100644 libctf/ctf-lookup.c create mode 100644 libctf/ctf-open.c create mode 100644 libctf/ctf-subr.c create mode 100644 libctf/ctf-types.c create mode 100644 libctf/ctf-util.c -- 2.21.0.237.gd0cfaa883d