aarch64: Don't assert on long sysreg names
[deliverable/binutils-gdb.git] / include / ctf-api.h
CommitLineData
2e94b056 1/* Public API to libctf.
b3adc24a 2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
2e94b056
NA
3
4 This file is part of libctf.
5
6 libctf is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; see the file COPYING. If not see
18 <http://www.gnu.org/licenses/>. */
19
20/* This header file defines the interfaces available from the CTF debugger
21 library, libctf. This API can be used by a debugger to operate on data in
22 the Compact ANSI-C Type Format (CTF). */
23
24#ifndef _CTF_API_H
25#define _CTF_API_H
26
2e94b056
NA
27#include <sys/types.h>
28#include <ctf.h>
47d546f4 29#include <zlib.h>
2e94b056
NA
30
31#ifdef __cplusplus
32extern "C"
b64751cf 33{
2e94b056
NA
34#endif
35
36/* Clients can open one or more CTF containers and obtain a pointer to an
37 opaque ctf_file_t. Types are identified by an opaque ctf_id_t token.
38 They can also open or create read-only archives of CTF containers in a
39 ctf_archive_t.
40
41 These opaque definitions allow libctf to evolve without breaking clients. */
42
43typedef struct ctf_file ctf_file_t;
44typedef struct ctf_archive_internal ctf_archive_t;
a0486bac 45typedef unsigned long ctf_id_t;
2e94b056 46
143dce84
NA
47/* This opaque definition allows libctf to accept BFD data structures without
48 importing all the BFD noise into users' namespaces. */
49
50struct bfd;
51
47d546f4
NA
52/* If the debugger needs to provide the CTF library with a set of raw buffers
53 for use as the CTF data, symbol table, and string table, it can do so by
54 filling in ctf_sect_t structures and passing them to ctf_bufopen().
55
56 The contents of this structure must always be in native endianness (no
57 byteswapping is performed). */
58
59typedef struct ctf_sect
60{
61 const char *cts_name; /* Section name (if any). */
47d546f4
NA
62 const void *cts_data; /* Pointer to section data. */
63 size_t cts_size; /* Size of data in bytes. */
64 size_t cts_entsize; /* Size of each section entry (symtab only). */
47d546f4
NA
65} ctf_sect_t;
66
72c83edd
NA
67/* A minimal symbol extracted from a linker's internal symbol table
68 representation. */
69
70typedef struct ctf_link_sym
71{
72 /* The st_name will not be accessed outside the call to
73 ctf_link_shuffle_syms(). */
74
75 const char *st_name;
76 uint32_t st_shndx;
77 uint32_t st_type;
78 uint32_t st_value;
79} ctf_link_sym_t;
80
5f54462c 81/* Flags applying to this specific link. */
72c83edd 82
b64751cf 83/* Share all types that are not in conflict. The default. */
72c83edd
NA
84#define CTF_LINK_SHARE_UNCONFLICTED 0x0
85
0f0c11f7 86/* Share only types that are used by multiple inputs. */
72c83edd
NA
87#define CTF_LINK_SHARE_DUPLICATED 0x1
88
662df3c3
NA
89/* Do a nondeduplicating link. */
90#define CTF_LINK_NONDEDUP 0x2
91
5f54462c
NA
92/* Create empty outputs for all registered CU mappings even if no types are
93 emitted into them. */
94#define CTF_LINK_EMPTY_CU_MAPPINGS 0x4
95
e3e8411b
NA
96/* Omit the content of the variables section. */
97#define CTF_LINK_OMIT_VARIABLES_SECTION 0x8
98
47d546f4
NA
99/* Symbolic names for CTF sections. */
100
101typedef enum ctf_sect_names
102 {
103 CTF_SECT_HEADER,
104 CTF_SECT_LABEL,
105 CTF_SECT_OBJT,
106 CTF_SECT_FUNC,
107 CTF_SECT_VAR,
108 CTF_SECT_TYPE,
109 CTF_SECT_STR
110 } ctf_sect_names_t;
111
112/* Encoding information for integers, floating-point values, and certain other
113 intrinsics can be obtained by calling ctf_type_encoding(), below. The flags
114 field will contain values appropriate for the type defined in <ctf.h>. */
115
116typedef struct ctf_encoding
117{
118 uint32_t cte_format; /* Data format (CTF_INT_* or CTF_FP_* flags). */
119 uint32_t cte_offset; /* Offset of value in bits. */
120 uint32_t cte_bits; /* Size of storage in bits. */
121} ctf_encoding_t;
122
123typedef struct ctf_membinfo
124{
125 ctf_id_t ctm_type; /* Type of struct or union member. */
126 unsigned long ctm_offset; /* Offset of member in bits. */
127} ctf_membinfo_t;
128
129typedef struct ctf_arinfo
130{
131 ctf_id_t ctr_contents; /* Type of array contents. */
132 ctf_id_t ctr_index; /* Type of array index. */
133 uint32_t ctr_nelems; /* Number of elements. */
134} ctf_arinfo_t;
135
136typedef struct ctf_funcinfo
137{
138 ctf_id_t ctc_return; /* Function return type. */
139 uint32_t ctc_argc; /* Number of typed arguments to function. */
140 uint32_t ctc_flags; /* Function attributes (see below). */
141} ctf_funcinfo_t;
142
143typedef struct ctf_lblinfo
144{
145 ctf_id_t ctb_type; /* Last type associated with the label. */
146} ctf_lblinfo_t;
147
148typedef struct ctf_snapshot_id
149{
150 unsigned long dtd_id; /* Highest DTD ID at time of snapshot. */
151 unsigned long snapshot_id; /* Snapshot id at time of snapshot. */
152} ctf_snapshot_id_t;
153
154#define CTF_FUNC_VARARG 0x1 /* Function arguments end with varargs. */
155
a0486bac
JM
156/* Functions that return a ctf_id_t use the following value to indicate failure.
157 ctf_errno() can be used to obtain an error code. Functions that return
158 a straight integral -1 also use ctf_errno(). */
159#define CTF_ERR ((ctf_id_t) -1L)
2e94b056
NA
160
161#define ECTF_BASE 1000 /* Base value for libctf errnos. */
162
163
164enum
165 {
7eea9d3b
NA
166 ECTF_FMT = ECTF_BASE, /* File is not in CTF or ELF format. */
167 ECTF_BFDERR, /* BFD error. */
168 ECTF_CTFVERS, /* CTF dict version is too new for libctf. */
169 ECTF_BFD_AMBIGUOUS, /* Ambiguous BFD target. */
170 ECTF_SYMTAB, /* Symbol table uses invalid entry size. */
171 ECTF_SYMBAD, /* Symbol table data buffer is not valid. */
172 ECTF_STRBAD, /* String table data buffer is not valid. */
173 ECTF_CORRUPT, /* File data structure corruption detected. */
174 ECTF_NOCTFDATA, /* File does not contain CTF data. */
175 ECTF_NOCTFBUF, /* Buffer does not contain CTF data. */
176 ECTF_NOSYMTAB, /* Symbol table information is not available. */
177 ECTF_NOPARENT, /* The parent CTF dictionary is unavailable. */
178 ECTF_DMODEL, /* Data model mismatch. */
179 ECTF_LINKADDEDLATE, /* File added to link too late. */
180 ECTF_ZALLOC, /* Failed to allocate (de)compression buffer. */
181 ECTF_DECOMPRESS, /* Failed to decompress CTF data. */
182 ECTF_STRTAB, /* External string table is not available. */
183 ECTF_BADNAME, /* String name offset is corrupt. */
184 ECTF_BADID, /* Invalid type identifier. */
185 ECTF_NOTSOU, /* Type is not a struct or union. */
186 ECTF_NOTENUM, /* Type is not an enum. */
187 ECTF_NOTSUE, /* Type is not a struct, union, or enum. */
188 ECTF_NOTINTFP, /* Type is not an integer, float, or enum. */
189 ECTF_NOTARRAY, /* Type is not an array. */
190 ECTF_NOTREF, /* Type does not reference another type. */
191 ECTF_NAMELEN, /* Buffer is too small to hold type name. */
192 ECTF_NOTYPE, /* No type found corresponding to name. */
193 ECTF_SYNTAX, /* Syntax error in type name. */
194 ECTF_NOTFUNC, /* Symbol table entry or type is not a function. */
195 ECTF_NOFUNCDAT, /* No function information available for function. */
196 ECTF_NOTDATA, /* Symbol table entry does not refer to a data object. */
197 ECTF_NOTYPEDAT, /* No type information available for symbol. */
198 ECTF_NOLABEL, /* No label found corresponding to name. */
199 ECTF_NOLABELDATA, /* File does not contain any labels. */
200 ECTF_NOTSUP, /* Feature not supported. */
201 ECTF_NOENUMNAM, /* Enum element name not found. */
202 ECTF_NOMEMBNAM, /* Member name not found. */
203 ECTF_RDONLY, /* CTF container is read-only. */
204 ECTF_DTFULL, /* CTF type is full (no more members allowed). */
205 ECTF_FULL, /* CTF container is full. */
206 ECTF_DUPLICATE, /* Duplicate member or variable name. */
207 ECTF_CONFLICT, /* Conflicting type is already defined. */
208 ECTF_OVERROLLBACK, /* Attempt to roll back past a ctf_update. */
209 ECTF_COMPRESS, /* Failed to compress CTF data. */
210 ECTF_ARCREATE, /* Error creating CTF archive. */
211 ECTF_ARNNAME, /* Name not found in CTF archive. */
212 ECTF_SLICEOVERFLOW, /* Overflow of type bitness or offset in slice. */
213 ECTF_DUMPSECTUNKNOWN, /* Unknown section number in dump. */
214 ECTF_DUMPSECTCHANGED, /* Section changed in middle of dump. */
215 ECTF_NOTYET, /* Feature not yet implemented. */
8b37e7b6 216 ECTF_INTERNAL, /* Internal error: assertion failure. */
688d28f6
NA
217 ECTF_NONREPRESENTABLE, /* Type not representable in CTF. */
218 ECTF_NEXT_END, /* End of iteration. */
219 ECTF_NEXT_WRONGFUN, /* Wrong iteration function called. */
ec388c16 220 ECTF_NEXT_WRONGFP, /* Iteration entity changed in mid-iterate. */
8d2229ad
NA
221 ECTF_FLAGS, /* CTF header contains flags unknown to libctf. */
222 ECTF_NEEDSBFD /* This feature needs a libctf with BFD support. */
2e94b056
NA
223 };
224
8d2229ad 225#define ECTF_NERR (ECTF_NEEDSBFD - ECTF_BASE + 1) /* Count of CTF errors. */
7eea9d3b 226
2e94b056
NA
227/* The CTF data model is inferred to be the caller's data model or the data
228 model of the given object, unless ctf_setmodel() is explicitly called. */
229#define CTF_MODEL_ILP32 1 /* Object data model is ILP32. */
230#define CTF_MODEL_LP64 2 /* Object data model is LP64. */
231#ifdef _LP64
232# define CTF_MODEL_NATIVE CTF_MODEL_LP64
233#else
234# define CTF_MODEL_NATIVE CTF_MODEL_ILP32
235#endif
236
237/* Dynamic CTF containers can be created using ctf_create(). The ctf_add_*
238 routines can be used to add new definitions to the dynamic container.
239 New types are labeled as root or non-root to determine whether they are
240 visible at the top-level program scope when subsequently doing a lookup. */
241
242#define CTF_ADD_NONROOT 0 /* Type only visible in nested scope. */
243#define CTF_ADD_ROOT 1 /* Type visible at top-level scope. */
244
688d28f6
NA
245/* These typedefs are used to define the signature for callback functions that
246 can be used with the iteration and visit functions below. There is also a
247 family of iteration functions that do not require callbacks. */
9402cc59 248
316afdb1
NA
249typedef int ctf_visit_f (const char *name, ctf_id_t type, unsigned long offset,
250 int depth, void *arg);
251typedef int ctf_member_f (const char *name, ctf_id_t membtype,
252 unsigned long offset, void *arg);
253typedef int ctf_enum_f (const char *name, int val, void *arg);
254typedef int ctf_variable_f (const char *name, ctf_id_t type, void *arg);
255typedef int ctf_type_f (ctf_id_t type, void *arg);
0ac62312 256typedef int ctf_type_all_f (ctf_id_t type, int flag, void *arg);
6dbf2b73
NA
257typedef int ctf_label_f (const char *name, const ctf_lblinfo_t *info,
258 void *arg);
9402cc59
NA
259typedef int ctf_archive_member_f (ctf_file_t *fp, const char *name, void *arg);
260typedef int ctf_archive_raw_member_f (const char *name, const void *content,
261 size_t len, void *arg);
a30b3e18
NA
262typedef char *ctf_dump_decorate_f (ctf_sect_names_t sect,
263 char *line, void *arg);
264
265typedef struct ctf_dump_state ctf_dump_state_t;
9402cc59 266
688d28f6
NA
267/* Iteration state for the _next() functions, and allocators/copiers/freers for
268 it. (None of these are needed for the simple case of iterating to the end:
269 the _next() function allocate and free the iterators for you.) */
270
271typedef struct ctf_next ctf_next_t;
272extern ctf_next_t *ctf_next_create (void);
273extern void ctf_next_destroy (ctf_next_t *);
274extern ctf_next_t *ctf_next_copy (ctf_next_t *);
275
143dce84
NA
276/* Opening. These mostly return an abstraction over both CTF files and CTF
277 archives: so they can be used to open both. CTF files will appear to be an
278 archive with one member named '.ctf'. The low-level functions
279 ctf_simple_open() and ctf_bufopen() return ctf_file_t's directly, and cannot
280 be used on CTF archives. */
281
282extern ctf_archive_t *ctf_bfdopen (struct bfd *, int *);
283extern ctf_archive_t *ctf_bfdopen_ctfsect (struct bfd *, const ctf_sect_t *,
284 int *);
285extern ctf_archive_t *ctf_fdopen (int fd, const char *filename,
286 const char *target, int *errp);
287extern ctf_archive_t *ctf_open (const char *filename,
288 const char *target, int *errp);
289extern void ctf_close (ctf_archive_t *);
72f33921 290extern ctf_sect_t ctf_getdatasect (const ctf_file_t *);
9402cc59 291extern ctf_archive_t *ctf_get_arc (const ctf_file_t *);
143dce84 292extern ctf_archive_t *ctf_arc_open (const char *, int *);
2f6ecaed
NA
293extern ctf_archive_t *ctf_arc_bufopen (const ctf_sect_t *,
294 const ctf_sect_t *,
295 const ctf_sect_t *,
296 int *);
9402cc59
NA
297extern void ctf_arc_close (ctf_archive_t *);
298extern ctf_file_t *ctf_arc_open_by_name (const ctf_archive_t *,
299 const char *, int *);
300extern ctf_file_t *ctf_arc_open_by_name_sections (const ctf_archive_t *,
301 const ctf_sect_t *,
302 const ctf_sect_t *,
303 const char *, int *);
9c23dfa5 304extern size_t ctf_archive_count (const ctf_archive_t *);
9402cc59
NA
305
306/* The next functions return or close real CTF files, or write out CTF archives,
307 not opaque containers around either. */
308
47d546f4
NA
309extern ctf_file_t *ctf_simple_open (const char *, size_t, const char *, size_t,
310 size_t, const char *, size_t, int *);
311extern ctf_file_t *ctf_bufopen (const ctf_sect_t *, const ctf_sect_t *,
312 const ctf_sect_t *, int *);
2399827b 313extern void ctf_ref (ctf_file_t *);
72f33921
NA
314extern void ctf_file_close (ctf_file_t *);
315
9402cc59
NA
316extern int ctf_arc_write (const char *, ctf_file_t **, size_t,
317 const char **, size_t);
5537f9b9
NA
318extern int ctf_arc_write_fd (int, ctf_file_t **, size_t, const char **,
319 size_t);
9402cc59 320
fd55eae8 321extern const char *ctf_cuname (ctf_file_t *);
de07e349 322extern int ctf_cuname_set (ctf_file_t *, const char *);
72f33921
NA
323extern ctf_file_t *ctf_parent_file (ctf_file_t *);
324extern const char *ctf_parent_name (ctf_file_t *);
de07e349 325extern int ctf_parent_name_set (ctf_file_t *, const char *);
316afdb1
NA
326extern int ctf_type_isparent (ctf_file_t *, ctf_id_t);
327extern int ctf_type_ischild (ctf_file_t *, ctf_id_t);
72f33921
NA
328
329extern int ctf_import (ctf_file_t *, ctf_file_t *);
330extern int ctf_setmodel (ctf_file_t *, int);
331extern int ctf_getmodel (ctf_file_t *);
332
333extern void ctf_setspecific (ctf_file_t *, void *);
334extern void *ctf_getspecific (ctf_file_t *);
47d546f4 335
479604f4
NA
336extern int ctf_errno (ctf_file_t *);
337extern const char *ctf_errmsg (int);
6c33b742 338extern int ctf_version (int);
316afdb1 339
b437bfe0
NA
340extern int ctf_func_info (ctf_file_t *, unsigned long, ctf_funcinfo_t *);
341extern int ctf_func_args (ctf_file_t *, unsigned long, uint32_t, ctf_id_t *);
12a0b67d
NA
342extern int ctf_func_type_info (ctf_file_t *, ctf_id_t, ctf_funcinfo_t *);
343extern int ctf_func_type_args (ctf_file_t *, ctf_id_t, uint32_t, ctf_id_t *);
b437bfe0
NA
344
345extern ctf_id_t ctf_lookup_by_name (ctf_file_t *, const char *);
346extern ctf_id_t ctf_lookup_by_symbol (ctf_file_t *, unsigned long);
347extern ctf_id_t ctf_lookup_variable (ctf_file_t *, const char *);
348
316afdb1
NA
349extern ctf_id_t ctf_type_resolve (ctf_file_t *, ctf_id_t);
350extern char *ctf_type_aname (ctf_file_t *, ctf_id_t);
12a0b67d 351extern char *ctf_type_aname_raw (ctf_file_t *, ctf_id_t);
316afdb1
NA
352extern ssize_t ctf_type_lname (ctf_file_t *, ctf_id_t, char *, size_t);
353extern char *ctf_type_name (ctf_file_t *, ctf_id_t, char *, size_t);
01d93174 354extern const char *ctf_type_name_raw (ctf_file_t *, ctf_id_t);
316afdb1
NA
355extern ssize_t ctf_type_size (ctf_file_t *, ctf_id_t);
356extern ssize_t ctf_type_align (ctf_file_t *, ctf_id_t);
357extern int ctf_type_kind (ctf_file_t *, ctf_id_t);
9b15cbb7 358extern int ctf_type_kind_forwarded (ctf_file_t *, ctf_id_t);
316afdb1
NA
359extern ctf_id_t ctf_type_reference (ctf_file_t *, ctf_id_t);
360extern ctf_id_t ctf_type_pointer (ctf_file_t *, ctf_id_t);
361extern int ctf_type_encoding (ctf_file_t *, ctf_id_t, ctf_encoding_t *);
362extern int ctf_type_visit (ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
363extern int ctf_type_cmp (ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
364extern int ctf_type_compat (ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
365
366extern int ctf_member_info (ctf_file_t *, ctf_id_t, const char *,
367 ctf_membinfo_t *);
368extern int ctf_array_info (ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
369
370extern const char *ctf_enum_name (ctf_file_t *, ctf_id_t, int);
371extern int ctf_enum_value (ctf_file_t *, ctf_id_t, const char *, int *);
372
6dbf2b73
NA
373extern void ctf_label_set (ctf_file_t *, const char *);
374extern const char *ctf_label_get (ctf_file_t *);
375
376extern const char *ctf_label_topmost (ctf_file_t *);
377extern int ctf_label_info (ctf_file_t *, const char *, ctf_lblinfo_t *);
378
e0325e2c 379extern int ctf_member_count (ctf_file_t *, ctf_id_t);
316afdb1 380extern int ctf_member_iter (ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
688d28f6
NA
381extern ssize_t ctf_member_next (ctf_file_t *, ctf_id_t, ctf_next_t **,
382 const char **name, ctf_id_t *membtype);
316afdb1 383extern int ctf_enum_iter (ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
688d28f6
NA
384extern const char *ctf_enum_next (ctf_file_t *, ctf_id_t, ctf_next_t **,
385 int *);
316afdb1 386extern int ctf_type_iter (ctf_file_t *, ctf_type_f *, void *);
0ac62312 387extern int ctf_type_iter_all (ctf_file_t *, ctf_type_all_f *, void *);
688d28f6
NA
388extern ctf_id_t ctf_type_next (ctf_file_t *, ctf_next_t **,
389 int *flag, int want_hidden);
6dbf2b73 390extern int ctf_label_iter (ctf_file_t *, ctf_label_f *, void *);
688d28f6 391extern int ctf_label_next (ctf_file_t *, ctf_next_t **, const char **); /* TBD */
316afdb1 392extern int ctf_variable_iter (ctf_file_t *, ctf_variable_f *, void *);
688d28f6
NA
393extern ctf_id_t ctf_variable_next (ctf_file_t *, ctf_next_t **,
394 const char **);
9402cc59
NA
395extern int ctf_archive_iter (const ctf_archive_t *, ctf_archive_member_f *,
396 void *);
688d28f6
NA
397extern ctf_file_t *ctf_archive_next (const ctf_archive_t *, ctf_next_t **,
398 const char **, int skip_parent, int *errp);
399
9402cc59
NA
400/* This function alone does not currently operate on CTF files masquerading
401 as archives, and returns -EINVAL: the raw data is no longer available. It is
402 expected to be used only by archiving tools, in any case, which have no need
403 to deal with non-archives at all. */
404extern int ctf_archive_raw_iter (const ctf_archive_t *,
405 ctf_archive_raw_member_f *, void *);
a30b3e18
NA
406extern char *ctf_dump (ctf_file_t *, ctf_dump_state_t **state,
407 ctf_sect_names_t sect, ctf_dump_decorate_f *,
408 void *arg);
316afdb1 409
8b37e7b6
NA
410/* Error-warning reporting: an 'iterator' that returns errors and warnings from
411 the error/warning list, in order of emission. Errors and warnings are popped
412 after return: the caller must free the returned error-text pointer. */
413extern char *ctf_errwarning_next (ctf_file_t *, ctf_next_t **,
414 int *is_warning);
415
47d546f4
NA
416extern ctf_id_t ctf_add_array (ctf_file_t *, uint32_t,
417 const ctf_arinfo_t *);
418extern ctf_id_t ctf_add_const (ctf_file_t *, uint32_t, ctf_id_t);
419extern ctf_id_t ctf_add_enum_encoded (ctf_file_t *, uint32_t, const char *,
420 const ctf_encoding_t *);
421extern ctf_id_t ctf_add_enum (ctf_file_t *, uint32_t, const char *);
422extern ctf_id_t ctf_add_float (ctf_file_t *, uint32_t,
423 const char *, const ctf_encoding_t *);
424extern ctf_id_t ctf_add_forward (ctf_file_t *, uint32_t, const char *,
425 uint32_t);
426extern ctf_id_t ctf_add_function (ctf_file_t *, uint32_t,
427 const ctf_funcinfo_t *, const ctf_id_t *);
428extern ctf_id_t ctf_add_integer (ctf_file_t *, uint32_t, const char *,
429 const ctf_encoding_t *);
430extern ctf_id_t ctf_add_slice (ctf_file_t *, uint32_t, ctf_id_t, const ctf_encoding_t *);
431extern ctf_id_t ctf_add_pointer (ctf_file_t *, uint32_t, ctf_id_t);
432extern ctf_id_t ctf_add_type (ctf_file_t *, ctf_file_t *, ctf_id_t);
433extern ctf_id_t ctf_add_typedef (ctf_file_t *, uint32_t, const char *,
434 ctf_id_t);
435extern ctf_id_t ctf_add_restrict (ctf_file_t *, uint32_t, ctf_id_t);
436extern ctf_id_t ctf_add_struct (ctf_file_t *, uint32_t, const char *);
437extern ctf_id_t ctf_add_union (ctf_file_t *, uint32_t, const char *);
438extern ctf_id_t ctf_add_struct_sized (ctf_file_t *, uint32_t, const char *,
439 size_t);
440extern ctf_id_t ctf_add_union_sized (ctf_file_t *, uint32_t, const char *,
441 size_t);
442extern ctf_id_t ctf_add_volatile (ctf_file_t *, uint32_t, ctf_id_t);
443
444extern int ctf_add_enumerator (ctf_file_t *, ctf_id_t, const char *, int);
445extern int ctf_add_member (ctf_file_t *, ctf_id_t, const char *, ctf_id_t);
446extern int ctf_add_member_offset (ctf_file_t *, ctf_id_t, const char *,
447 ctf_id_t, unsigned long);
448extern int ctf_add_member_encoded (ctf_file_t *, ctf_id_t, const char *,
449 ctf_id_t, unsigned long,
450 const ctf_encoding_t);
451
452extern int ctf_add_variable (ctf_file_t *, const char *, ctf_id_t);
453
454extern int ctf_set_array (ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
455
456extern ctf_file_t *ctf_create (int *);
457extern int ctf_update (ctf_file_t *);
458extern ctf_snapshot_id_t ctf_snapshot (ctf_file_t *);
459extern int ctf_rollback (ctf_file_t *, ctf_snapshot_id_t);
460extern int ctf_discard (ctf_file_t *);
461extern int ctf_write (ctf_file_t *, int);
5537f9b9 462extern int ctf_gzwrite (ctf_file_t *fp, gzFile fd);
47d546f4 463extern int ctf_compress_write (ctf_file_t * fp, int fd);
5537f9b9 464extern unsigned char *ctf_write_mem (ctf_file_t *, size_t *, size_t threshold);
2e94b056 465
72c83edd 466extern int ctf_link_add_ctf (ctf_file_t *, ctf_archive_t *, const char *);
6dd2819f
NA
467/* The variable filter should return nonzero if a variable should not
468 appear in the output. */
469typedef int ctf_link_variable_filter_f (ctf_file_t *, const char *, ctf_id_t,
470 void *);
471extern int ctf_link_set_variable_filter (ctf_file_t *,
472 ctf_link_variable_filter_f *, void *);
8d2229ad 473extern int ctf_link (ctf_file_t *, int flags);
72c83edd
NA
474typedef const char *ctf_link_strtab_string_f (uint32_t *offset, void *arg);
475extern int ctf_link_add_strtab (ctf_file_t *, ctf_link_strtab_string_f *,
476 void *);
477typedef ctf_link_sym_t *ctf_link_iter_symbol_f (ctf_link_sym_t *dest,
478 void *arg);
479extern int ctf_link_shuffle_syms (ctf_file_t *, ctf_link_iter_symbol_f *,
480 void *);
481extern unsigned char *ctf_link_write (ctf_file_t *, size_t *size,
482 size_t threshold);
483
49ea9b45 484/* Specialist linker functions. These functions are not used by ld, but can be
b64751cf 485 used by other programs making use of the linker machinery for other purposes
49ea9b45
NA
486 to customize its output. */
487extern int ctf_link_add_cu_mapping (ctf_file_t *, const char *from,
488 const char *to);
489typedef char *ctf_link_memb_name_changer_f (ctf_file_t *,
490 const char *, void *);
491extern void ctf_link_set_memb_name_changer
492 (ctf_file_t *, ctf_link_memb_name_changer_f *, void *);
493
60da9d95
NA
494extern void ctf_setdebug (int debug);
495extern int ctf_getdebug (void);
496
2e94b056
NA
497#ifdef __cplusplus
498}
499#endif
500
501#endif /* _CTF_API_H */
This page took 0.102769 seconds and 4 git commands to generate.