From: Nick Alcock <nick.alcock@oracle.com>
To: binutils@sourceware.org
Subject: [PATCH 02/19] include: new header ctf-api.h
Date: Tue, 30 Apr 2019 22:57:00 -0000 [thread overview]
Message-ID: <20190430225706.159422-3-nick.alcock@oracle.com> (raw)
In-Reply-To: <20190430225706.159422-1-nick.alcock@oracle.com>
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
+ <http://www.gnu.org/licenses/>. */
+
+/* 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 <sys/param.h>
+#include <sys/types.h>
+#include <ctf.h>
+
+#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
next prev parent reply other threads:[~2019-04-30 22:57 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 22:57 [PATCH 00/19] libctf, and CTF support for objdump and readelf Nick Alcock
2019-04-30 22:57 ` Nick Alcock [this message]
2019-05-02 15:07 ` [PATCH 02/19] include: new header ctf-api.h Nick Clifton
2019-05-03 11:23 ` Nick Alcock
2019-04-30 22:57 ` [PATCH 15/19] libctf: mmappable archives Nick Alcock
2019-04-30 22:57 ` [PATCH 05/19] libctf: error handling Nick Alcock
2019-05-02 16:10 ` Nick Clifton
2019-05-03 19:31 ` Nick Alcock
2019-04-30 22:57 ` [PATCH 13/19] libctf: type copying Nick Alcock
2019-04-30 22:57 ` [PATCH 01/19] include: new header ctf.h: file format description Nick Alcock
2019-05-01 16:57 ` Nick Clifton
2019-05-01 21:29 ` Jim Wilson
2019-05-03 11:15 ` Nick Alcock
2019-04-30 22:57 ` [PATCH 09/19] libctf: opening Nick Alcock
2019-04-30 22:57 ` [PATCH 10/19] libctf: ELF file opening Nick Alcock
2019-04-30 22:57 ` [PATCH 06/19] libctf: hashing Nick Alcock
2019-05-02 16:16 ` Nick Clifton
2019-05-03 19:33 ` Nick Alcock
2019-04-30 22:57 ` [PATCH 19/19] binutils: CTF support for objdump and readelf Nick Alcock
2019-04-30 22:57 ` CTF format overview Nick Alcock
2019-04-30 22:57 ` [PATCH 08/19] libctf: creation functions Nick Alcock
2019-04-30 22:57 ` [PATCH 11/19] libctf: core type lookup Nick Alcock
2019-04-30 22:57 ` [PATCH 04/19] libctf: low-level list manipulation and helper utilities Nick Alcock
2019-05-02 16:04 ` Nick Clifton
2019-05-03 19:25 ` Nick Alcock
2019-04-30 22:57 ` [PATCH 14/19] libctf: library version enforcement Nick Alcock
2019-04-30 22:57 ` [PATCH 03/19] libctf: lowest-level memory allocation and debug-dumping wrappers Nick Alcock
2019-05-02 15:29 ` Nick Clifton
2019-05-03 19:12 ` Nick Alcock
2019-04-30 22:57 ` [PATCH 12/19] libctf: lookups by name and symbol Nick Alcock
2019-04-30 22:58 ` [PATCH 18/19] libctf: build system Nick Alcock
2019-05-01 0:13 ` [PATCH 17/19] libctf: debug dumping Nick Alcock
2019-05-01 0:19 ` [PATCH 16/19] libctf: labels Nick Alcock
2019-05-01 1:57 ` [PATCH 07/19] libctf: implementation definitions related to file creation Nick Alcock
2019-05-01 16:02 ` [PATCH 00/19] libctf, and CTF support for objdump and readelf Nick Clifton
2019-05-01 16:16 ` Jose E. Marchesi
2019-05-03 10:47 ` Nick Alcock
2019-05-02 15:22 ` Joseph Myers
2019-05-03 12:33 ` Nick Clifton
2019-05-06 16:40 ` Nick Alcock
2019-05-08 14:34 ` Michael Matz
2019-05-08 16:01 ` Nick Clifton
2019-05-08 16:20 ` Nick Alcock
2019-05-03 14:23 ` Nick Alcock
[not found] ` <alpine.DEB.2.21.1905072117440.19308@digraph.polyomino.org.uk>
2019-05-08 11:39 ` Nick Alcock
2019-05-24 8:57 ` Pedro Alves
2019-05-24 16:05 ` Nick Alcock
2019-05-24 16:19 ` Pedro Alves
2019-05-24 20:09 ` Nick Alcock
2019-05-03 16:19 ` Florian Weimer
2019-05-03 19:45 ` Nick Alcock
2019-05-06 12:07 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190430225706.159422-3-nick.alcock@oracle.com \
--to=nick.alcock@oracle.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).