From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6876 invoked by alias); 30 Apr 2019 22:57:17 -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 6861 invoked by uid 89); 30 Apr 2019 22:57:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-13.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,SPF_HELO_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy=Clients, roll X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Apr 2019 22:57:15 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3UMt2IZ101903 for ; Tue, 30 Apr 2019 22:57:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=ZNomSIw5bfanCOz2TgS1NI3jPGQQnAKhGETz2WISru0=; b=t3ds4TF5rIChs9IZg0brtwjV2EHG/qPmkOuic4J1zQATHUOLh+x0oCwJkvWZvGQa/wUI ESA+aL3EDfyzsdQCE4kRgp7dG1GmqL+4dVUxLyeeYEmCwEddUc8l324fTeRroHwkXf3r 5Mc5N8HFg1TcNxeBI1r17ugOH9WPC7xGTbQgMOTRDJQ6kMCv6oDcM5LcICGG5yDpuw9v HVbWv2OJJPvRiXv9fIhTGbovavEotFssHghHFAdOohzSthHh+YomNgvOcJ8j6dnKCB3e lWmzZvfCZ5nGOORooYXhzJfiFlWTqMr2FLjCXt+IfWLwTHFc7cxsZypKsBCQwX3GoMlh HA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2s6xhyg6xj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Apr 2019 22:57:13 +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 x3UMtaAK161587 for ; Tue, 30 Apr 2019 22:57:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2s6xhh0q5d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Apr 2019 22:57:13 +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 x3UMvD2I006627 for ; Tue, 30 Apr 2019 22:57:13 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:12 -0700 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 02/19] include: new header ctf-api.h Date: Tue, 30 Apr 2019 22:57:00 -0000 Message-Id: <20190430225706.159422-3-nick.alcock@oracle.com> In-Reply-To: <20190430225706.159422-1-nick.alcock@oracle.com> References: <20190430225706.159422-1-nick.alcock@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00269.txt.bz2 This non-installed header is the means by which libctf consumers communicate with libctf. This header will be extended in subsequent commits. include/ * ctf-api.h: New file. --- include/ctf-api.h | 130 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 include/ctf-api.h diff --git a/include/ctf-api.h b/include/ctf-api.h new file mode 100644 index 0000000000..e2f5dc7571 --- /dev/null +++ b/include/ctf-api.h @@ -0,0 +1,130 @@ +/* Public API to libctf. + Copyright (C) 2005-2019 Free Software Foundation, Inc. + + This file is part of libctf. + + libctf 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 2, or (at your option) any later + version. + + This program 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 this program; see the file COPYING. If not see + . */ + +/* This header file defines the interfaces available from the CTF debugger + library, libctf. This API can be used by a debugger to operate on data in + the Compact ANSI-C Type Format (CTF). */ + +#ifndef _CTF_API_H +#define _CTF_API_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" + { +#endif + +/* Clients can open one or more CTF containers and obtain a pointer to an + opaque ctf_file_t. Types are identified by an opaque ctf_id_t token. + They can also open or create read-only archives of CTF containers in a + ctf_archive_t. + + These opaque definitions allow libctf to evolve without breaking clients. */ + +typedef struct ctf_file ctf_file_t; +typedef struct ctf_archive ctf_archive_t; +typedef long ctf_id_t; + +/* Functions that return integer status or a ctf_id_t use the following value + to indicate failure. ctf_errno() can be used to obtain an error code. */ +#define CTF_ERR (-1L) + +#define ECTF_BASE 1000 /* Base value for libctf errnos. */ + + +enum + { + ECTF_FMT = ECTF_BASE, /* File is not in CTF or ELF format. */ + ECTF_ELFVERS, /* ELF version is more recent than libctf. */ + ECTF_CTFVERS, /* CTF version is more recent than libctf. */ + ECTF_ENDIAN, /* Data is different endian-ness than lib. */ + ECTF_SYMTAB, /* Symbol table uses invalid entry size. */ + ECTF_SYMBAD, /* Symbol table data buffer invalid. */ + ECTF_STRBAD, /* String table data buffer invalid. */ + ECTF_CORRUPT, /* File data corruption detected. */ + ECTF_NOCTFDATA, /* ELF file does not contain CTF data. */ + ECTF_NOCTFBUF, /* Buffer does not contain CTF data. */ + ECTF_NOSYMTAB, /* Symbol table data is not available. */ + ECTF_NOPARENT, /* Parent CTF container is not available. */ + ECTF_DMODEL, /* Data model mismatch. */ + ECTF_MMAP, /* Failed to mmap a data section. */ + ECTF_ZALLOC, /* Failed to allocate (de)compression buffer. */ + ECTF_DECOMPRESS, /* Failed to decompress CTF data. */ + ECTF_STRTAB, /* String table for this string is missing. */ + ECTF_BADNAME, /* String offset is corrupt w.r.t. strtab. */ + ECTF_BADID, /* Invalid type ID number. */ + ECTF_NOTSOU, /* Type is not a struct or union. */ + ECTF_NOTENUM, /* Type is not an enum. */ + ECTF_NOTSUE, /* Type is not a struct, union, or enum. */ + ECTF_NOTINTFP, /* Type is not an integer, float, or enum. */ + ECTF_NOTARRAY, /* Type is not an array. */ + ECTF_NOTREF, /* Type does not reference another type. */ + ECTF_NAMELEN, /* Buffer is too small to hold type name. */ + ECTF_NOTYPE, /* No type found corresponding to name. */ + ECTF_SYNTAX, /* Syntax error in type name. */ + ECTF_NOTFUNC, /* Symtab entry does not refer to a function. */ + ECTF_NOFUNCDAT, /* No func info available for function. */ + ECTF_NOTDATA, /* Symtab entry does not refer to a data obj. */ + ECTF_NOTYPEDAT, /* No type info available for object. */ + ECTF_NOLABEL, /* No label found corresponding to name. */ + ECTF_NOLABELDATA, /* File does not contain any labels. */ + ECTF_NOTSUP, /* Feature not supported. */ + ECTF_NOENUMNAM, /* Enum element name not found. */ + ECTF_NOMEMBNAM, /* Member name not found. */ + ECTF_RDONLY, /* CTF container is read-only. */ + ECTF_DTFULL, /* CTF type is full (no more members allowed). */ + ECTF_FULL, /* CTF container is full. */ + ECTF_DUPLICATE, /* Duplicate member or variable name. */ + ECTF_CONFLICT, /* Conflicting type definition present. */ + ECTF_OVERROLLBACK, /* Attempt to roll back past a ctf_update. */ + ECTF_COMPRESS, /* Failed to compress CTF data. */ + ECTF_ARCREATE, /* Error creating CTF archive. */ + ECTF_ARNNAME, /* Name not found in CTF archive. */ + ECTF_SLICEOVERFLOW, /* Overflow of type bitness or offset in slice. */ + ECTF_DUMPSECTUNKNOWN, /* Unknown section number in dump. */ + ECTF_DUMPSECTCHANGED /* Section changed in middle of dump. */ + }; + +/* The CTF data model is inferred to be the caller's data model or the data + model of the given object, unless ctf_setmodel() is explicitly called. */ +#define CTF_MODEL_ILP32 1 /* Object data model is ILP32. */ +#define CTF_MODEL_LP64 2 /* Object data model is LP64. */ +#ifdef _LP64 +# define CTF_MODEL_NATIVE CTF_MODEL_LP64 +#else +# define CTF_MODEL_NATIVE CTF_MODEL_ILP32 +#endif + +/* Dynamic CTF containers can be created using ctf_create(). The ctf_add_* + routines can be used to add new definitions to the dynamic container. + New types are labeled as root or non-root to determine whether they are + visible at the top-level program scope when subsequently doing a lookup. */ + +#define CTF_ADD_NONROOT 0 /* Type only visible in nested scope. */ +#define CTF_ADD_ROOT 1 /* Type visible at top-level scope. */ + + +#ifdef __cplusplus +} +#endif + +#endif /* _CTF_API_H */ -- 2.21.0.237.gd0cfaa883d