aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2020-11-20 13:34:04 +0000
committerNick Alcock <nick.alcock@oracle.com>2020-11-20 13:34:04 +0000
commit139633c307eb6f5746ea04f94a0b6382e51bccb9 (patch)
tree6c070eeecd42d5c5bc93041be7fcc1279495a266 /include
parentcbbcd7a716d7f1f65c57aa6ba6e034ecb9a78378 (diff)
downloadgdb-139633c307eb6f5746ea04f94a0b6382e51bccb9.zip
gdb-139633c307eb6f5746ea04f94a0b6382e51bccb9.tar.gz
gdb-139633c307eb6f5746ea04f94a0b6382e51bccb9.tar.bz2
libctf, include, binutils, gdb, ld: rename ctf_file_t to ctf_dict_t
The naming of the ctf_file_t type in libctf is a historical curiosity. Back in the Solaris days, CTF dictionaries were originally generated as a separate file and then (sometimes) merged into objects: hence the datatype was named ctf_file_t, and known as a "CTF file". Nowadays, raw CTF is essentially never written to a file on its own, and the datatype changed name to a "CTF dictionary" years ago. So the term "CTF file" refers to something that is never a file! This is at best confusing. The type has also historically been known as a 'CTF container", which is even more confusing now that we have CTF archives which are *also* a sort of container (they contain CTF dictionaries), but which are never referred to as containers in the source code. So fix this by completing the renaming, renaming ctf_file_t to ctf_dict_t throughout, and renaming those few functions that refer to CTF files by name (keeping compatibility aliases) to refer to dicts instead. Old users who still refer to ctf_file_t will see (harmless) pointer-compatibility warnings at compile time, but the ABI is unchanged (since C doesn't mangle names, and ctf_file_t was always an opaque type) and things will still compile fine as long as -Werror is not specified. All references to CTF containers and CTF files in the source code are fixed to refer to CTF dicts instead. Further (smaller) renamings of annoyingly-named functions to come, as part of the process of souping up queries across whole archives at once (needed for the function info and data object sections). binutils/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * objdump.c (dump_ctf_errs): Rename ctf_file_t to ctf_dict_t. (dump_ctf_archive_member): Likewise. (dump_ctf): Likewise. Use ctf_dict_close, not ctf_file_close. * readelf.c (dump_ctf_errs): Rename ctf_file_t to ctf_dict_t. (dump_ctf_archive_member): Likewise. (dump_section_as_ctf): Likewise. Use ctf_dict_close, not ctf_file_close. gdb/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctfread.c: Change uses of ctf_file_t to ctf_dict_t. (ctf_fp_info::~ctf_fp_info): Call ctf_dict_close, not ctf_file_close. include/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctf-api.h (ctf_file_t): Rename to... (ctf_dict_t): ... this. Keep ctf_file_t around for compatibility. (struct ctf_file): Likewise rename to... (struct ctf_dict): ... this. (ctf_file_close): Rename to... (ctf_dict_close): ... this, keeping compatibility function. (ctf_parent_file): Rename to... (ctf_parent_dict): ... this, keeping compatibility function. All callers adjusted. * ctf.h: Rename references to ctf_file_t to ctf_dict_t. (struct ctf_archive) <ctfa_nfiles>: Rename to... <ctfa_ndicts>: ... this. ld/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ldlang.c (ctf_output): This is a ctf_dict_t now. (lang_ctf_errs_warnings): Rename ctf_file_t to ctf_dict_t. (ldlang_open_ctf): Adjust comment. (lang_merge_ctf): Use ctf_dict_close, not ctf_file_close. * ldelfgen.h (ldelf_examine_strtab_for_ctf): Rename ctf_file_t to ctf_dict_t. Change opaque declaration accordingly. * ldelfgen.c (ldelf_examine_strtab_for_ctf): Adjust. * ldemul.h (examine_strtab_for_ctf): Likewise. (ldemul_examine_strtab_for_ctf): Likewise. * ldeuml.c (ldemul_examine_strtab_for_ctf): Likewise. libctf/ChangeLog 2020-11-20 Nick Alcock <nick.alcock@oracle.com> * ctf-impl.h: Rename ctf_file_t to ctf_dict_t: all declarations adjusted. (ctf_fileops): Rename to... (ctf_dictops): ... this. (ctf_dedup_t) <cd_id_to_file_t>: Rename to... <cd_id_to_dict_t>: ... this. (ctf_file_t): Fix outdated comment. <ctf_fileops>: Rename to... <ctf_dictops>: ... this. (struct ctf_archive_internal) <ctfi_file>: Rename to... <ctfi_dict>: ... this. * ctf-archive.c: Rename ctf_file_t to ctf_dict_t. Rename ctf_archive.ctfa_nfiles to ctfa_ndicts. Rename ctf_file_close to ctf_dict_close. All users adjusted. * ctf-create.c: Likewise. Refer to CTF dicts, not CTF containers. (ctf_bundle_t) <ctb_file>: Rename to... <ctb_dict): ... this. * ctf-decl.c: Rename ctf_file_t to ctf_dict_t. * ctf-dedup.c: Likewise. Rename ctf_file_close to ctf_dict_close. Refer to CTF dicts, not CTF containers. * ctf-dump.c: Likewise. * ctf-error.c: Likewise. * ctf-hash.c: Likewise. * ctf-inlines.h: Likewise. * ctf-labels.c: Likewise. * ctf-link.c: Likewise. * ctf-lookup.c: Likewise. * ctf-open-bfd.c: Likewise. * ctf-string.c: Likewise. * ctf-subr.c: Likewise. * ctf-types.c: Likewise. * ctf-util.c: Likewise. * ctf-open.c: Likewise. (ctf_file_close): Rename to... (ctf_dict_close): ...this. (ctf_file_close): New trivial wrapper around ctf_dict_close, for compatibility. (ctf_parent_file): Rename to... (ctf_parent_dict): ... this. (ctf_parent_file): New trivial wrapper around ctf_parent_dict, for compatibility. * libctf.ver: Add ctf_dict_close and ctf_parent_dict.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog15
-rw-r--r--include/ctf-api.h245
-rw-r--r--include/ctf.h10
3 files changed, 146 insertions, 124 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index c8163ae..e1fcc92 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,18 @@
+2020-11-20 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-api.h (ctf_file_t): Rename to...
+ (ctf_dict_t): ... this. Keep ctf_file_t around for compatibility.
+ (struct ctf_file): Likewise rename to...
+ (struct ctf_dict): ... this.
+ (ctf_file_close): Rename to...
+ (ctf_dict_close): ... this, keeping compatibility function.
+ (ctf_parent_file): Rename to...
+ (ctf_parent_dict): ... this, keeping compatibility function.
+ All callers adjusted.
+ * ctf.h: Rename references to ctf_file_t to ctf_dict_t.
+ (struct ctf_archive) <ctfa_nfiles>: Rename to...
+ <ctfa_ndicts>: ... this.
+
2020-11-18 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* elf/common.h (SHF_GNU_RETAIN): Define.
diff --git a/include/ctf-api.h b/include/ctf-api.h
index 9ead3ee..60e06b3 100644
--- a/include/ctf-api.h
+++ b/include/ctf-api.h
@@ -34,13 +34,13 @@ 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.
+ opaque ctf_dict_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_dict ctf_dict_t;
typedef struct ctf_archive_internal ctf_archive_t;
typedef unsigned long ctf_id_t;
@@ -267,7 +267,7 @@ typedef int ctf_type_f (ctf_id_t type, void *arg);
typedef int ctf_type_all_f (ctf_id_t type, int flag, void *arg);
typedef int ctf_label_f (const char *name, const ctf_lblinfo_t *info,
void *arg);
-typedef int ctf_archive_member_f (ctf_file_t *fp, const char *name, void *arg);
+typedef int ctf_archive_member_f (ctf_dict_t *fp, const char *name, void *arg);
typedef int ctf_archive_raw_member_f (const char *name, const void *content,
size_t len, void *arg);
typedef char *ctf_dump_decorate_f (ctf_sect_names_t sect,
@@ -287,7 +287,7 @@ extern ctf_next_t *ctf_next_copy (ctf_next_t *);
/* Opening. These mostly return an abstraction over both CTF files and CTF
archives: so they can be used to open both. CTF files will appear to be an
archive with one member named '.ctf'. The low-level functions
- ctf_simple_open() and ctf_bufopen() return ctf_file_t's directly, and cannot
+ ctf_simple_open() and ctf_bufopen() return ctf_dict_t's directly, and cannot
be used on CTF archives. */
extern ctf_archive_t *ctf_bfdopen (struct bfd *, int *);
@@ -298,17 +298,17 @@ extern ctf_archive_t *ctf_fdopen (int fd, const char *filename,
extern ctf_archive_t *ctf_open (const char *filename,
const char *target, int *errp);
extern void ctf_close (ctf_archive_t *);
-extern ctf_sect_t ctf_getdatasect (const ctf_file_t *);
-extern ctf_archive_t *ctf_get_arc (const ctf_file_t *);
+extern ctf_sect_t ctf_getdatasect (const ctf_dict_t *);
+extern ctf_archive_t *ctf_get_arc (const ctf_dict_t *);
extern ctf_archive_t *ctf_arc_open (const char *, int *);
extern ctf_archive_t *ctf_arc_bufopen (const ctf_sect_t *,
const ctf_sect_t *,
const ctf_sect_t *,
int *);
extern void ctf_arc_close (ctf_archive_t *);
-extern ctf_file_t *ctf_arc_open_by_name (const ctf_archive_t *,
+extern ctf_dict_t *ctf_arc_open_by_name (const ctf_archive_t *,
const char *, int *);
-extern ctf_file_t *ctf_arc_open_by_name_sections (const ctf_archive_t *,
+extern ctf_dict_t *ctf_arc_open_by_name_sections (const ctf_archive_t *,
const ctf_sect_t *,
const ctf_sect_t *,
const char *, int *);
@@ -317,95 +317,95 @@ extern size_t ctf_archive_count (const ctf_archive_t *);
/* The next functions return or close real CTF files, or write out CTF archives,
not opaque containers around either. */
-extern ctf_file_t *ctf_simple_open (const char *, size_t, const char *, size_t,
+extern ctf_dict_t *ctf_simple_open (const char *, size_t, const char *, size_t,
size_t, const char *, size_t, int *);
-extern ctf_file_t *ctf_bufopen (const ctf_sect_t *, const ctf_sect_t *,
+extern ctf_dict_t *ctf_bufopen (const ctf_sect_t *, const ctf_sect_t *,
const ctf_sect_t *, int *);
-extern void ctf_ref (ctf_file_t *);
-extern void ctf_file_close (ctf_file_t *);
+extern void ctf_ref (ctf_dict_t *);
+extern void ctf_dict_close (ctf_dict_t *);
-extern int ctf_arc_write (const char *, ctf_file_t **, size_t,
+extern int ctf_arc_write (const char *, ctf_dict_t **, size_t,
const char **, size_t);
-extern int ctf_arc_write_fd (int, ctf_file_t **, size_t, const char **,
+extern int ctf_arc_write_fd (int, ctf_dict_t **, size_t, const char **,
size_t);
-extern const char *ctf_cuname (ctf_file_t *);
-extern int ctf_cuname_set (ctf_file_t *, const char *);
-extern ctf_file_t *ctf_parent_file (ctf_file_t *);
-extern const char *ctf_parent_name (ctf_file_t *);
-extern int ctf_parent_name_set (ctf_file_t *, const char *);
-extern int ctf_type_isparent (ctf_file_t *, ctf_id_t);
-extern int ctf_type_ischild (ctf_file_t *, ctf_id_t);
+extern const char *ctf_cuname (ctf_dict_t *);
+extern int ctf_cuname_set (ctf_dict_t *, const char *);
+extern ctf_dict_t *ctf_parent_dict (ctf_dict_t *);
+extern const char *ctf_parent_name (ctf_dict_t *);
+extern int ctf_parent_name_set (ctf_dict_t *, const char *);
+extern int ctf_type_isparent (ctf_dict_t *, ctf_id_t);
+extern int ctf_type_ischild (ctf_dict_t *, ctf_id_t);
-extern int ctf_import (ctf_file_t *, ctf_file_t *);
-extern int ctf_setmodel (ctf_file_t *, int);
-extern int ctf_getmodel (ctf_file_t *);
+extern int ctf_import (ctf_dict_t *, ctf_dict_t *);
+extern int ctf_setmodel (ctf_dict_t *, int);
+extern int ctf_getmodel (ctf_dict_t *);
-extern void ctf_setspecific (ctf_file_t *, void *);
-extern void *ctf_getspecific (ctf_file_t *);
+extern void ctf_setspecific (ctf_dict_t *, void *);
+extern void *ctf_getspecific (ctf_dict_t *);
-extern int ctf_errno (ctf_file_t *);
+extern int ctf_errno (ctf_dict_t *);
extern const char *ctf_errmsg (int);
extern int ctf_version (int);
-extern int ctf_func_info (ctf_file_t *, unsigned long, ctf_funcinfo_t *);
-extern int ctf_func_args (ctf_file_t *, unsigned long, uint32_t, ctf_id_t *);
-extern int ctf_func_type_info (ctf_file_t *, ctf_id_t, ctf_funcinfo_t *);
-extern int ctf_func_type_args (ctf_file_t *, ctf_id_t, uint32_t, ctf_id_t *);
-
-extern ctf_id_t ctf_lookup_by_name (ctf_file_t *, const char *);
-extern ctf_id_t ctf_lookup_by_symbol (ctf_file_t *, unsigned long);
-extern ctf_id_t ctf_lookup_variable (ctf_file_t *, const char *);
-
-extern ctf_id_t ctf_type_resolve (ctf_file_t *, ctf_id_t);
-extern char *ctf_type_aname (ctf_file_t *, ctf_id_t);
-extern char *ctf_type_aname_raw (ctf_file_t *, ctf_id_t);
-extern ssize_t ctf_type_lname (ctf_file_t *, ctf_id_t, char *, size_t);
-extern char *ctf_type_name (ctf_file_t *, ctf_id_t, char *, size_t);
-extern const char *ctf_type_name_raw (ctf_file_t *, ctf_id_t);
-extern ssize_t ctf_type_size (ctf_file_t *, ctf_id_t);
-extern ssize_t ctf_type_align (ctf_file_t *, ctf_id_t);
-extern int ctf_type_kind (ctf_file_t *, ctf_id_t);
-extern int ctf_type_kind_forwarded (ctf_file_t *, ctf_id_t);
-extern ctf_id_t ctf_type_reference (ctf_file_t *, ctf_id_t);
-extern ctf_id_t ctf_type_pointer (ctf_file_t *, ctf_id_t);
-extern int ctf_type_encoding (ctf_file_t *, ctf_id_t, ctf_encoding_t *);
-extern int ctf_type_visit (ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
-extern int ctf_type_cmp (ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
-extern int ctf_type_compat (ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
-
-extern int ctf_member_info (ctf_file_t *, ctf_id_t, const char *,
+extern int ctf_func_info (ctf_dict_t *, unsigned long, ctf_funcinfo_t *);
+extern int ctf_func_args (ctf_dict_t *, unsigned long, uint32_t, ctf_id_t *);
+extern int ctf_func_type_info (ctf_dict_t *, ctf_id_t, ctf_funcinfo_t *);
+extern int ctf_func_type_args (ctf_dict_t *, ctf_id_t, uint32_t, ctf_id_t *);
+
+extern ctf_id_t ctf_lookup_by_name (ctf_dict_t *, const char *);
+extern ctf_id_t ctf_lookup_by_symbol (ctf_dict_t *, unsigned long);
+extern ctf_id_t ctf_lookup_variable (ctf_dict_t *, const char *);
+
+extern ctf_id_t ctf_type_resolve (ctf_dict_t *, ctf_id_t);
+extern char *ctf_type_aname (ctf_dict_t *, ctf_id_t);
+extern char *ctf_type_aname_raw (ctf_dict_t *, ctf_id_t);
+extern ssize_t ctf_type_lname (ctf_dict_t *, ctf_id_t, char *, size_t);
+extern char *ctf_type_name (ctf_dict_t *, ctf_id_t, char *, size_t);
+extern const char *ctf_type_name_raw (ctf_dict_t *, ctf_id_t);
+extern ssize_t ctf_type_size (ctf_dict_t *, ctf_id_t);
+extern ssize_t ctf_type_align (ctf_dict_t *, ctf_id_t);
+extern int ctf_type_kind (ctf_dict_t *, ctf_id_t);
+extern int ctf_type_kind_forwarded (ctf_dict_t *, ctf_id_t);
+extern ctf_id_t ctf_type_reference (ctf_dict_t *, ctf_id_t);
+extern ctf_id_t ctf_type_pointer (ctf_dict_t *, ctf_id_t);
+extern int ctf_type_encoding (ctf_dict_t *, ctf_id_t, ctf_encoding_t *);
+extern int ctf_type_visit (ctf_dict_t *, ctf_id_t, ctf_visit_f *, void *);
+extern int ctf_type_cmp (ctf_dict_t *, ctf_id_t, ctf_dict_t *, ctf_id_t);
+extern int ctf_type_compat (ctf_dict_t *, ctf_id_t, ctf_dict_t *, ctf_id_t);
+
+extern int ctf_member_info (ctf_dict_t *, ctf_id_t, const char *,
ctf_membinfo_t *);
-extern int ctf_array_info (ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
+extern int ctf_array_info (ctf_dict_t *, ctf_id_t, ctf_arinfo_t *);
-extern const char *ctf_enum_name (ctf_file_t *, ctf_id_t, int);
-extern int ctf_enum_value (ctf_file_t *, ctf_id_t, const char *, int *);
+extern const char *ctf_enum_name (ctf_dict_t *, ctf_id_t, int);
+extern int ctf_enum_value (ctf_dict_t *, ctf_id_t, const char *, int *);
-extern void ctf_label_set (ctf_file_t *, const char *);
-extern const char *ctf_label_get (ctf_file_t *);
+extern void ctf_label_set (ctf_dict_t *, const char *);
+extern const char *ctf_label_get (ctf_dict_t *);
-extern const char *ctf_label_topmost (ctf_file_t *);
-extern int ctf_label_info (ctf_file_t *, const char *, ctf_lblinfo_t *);
+extern const char *ctf_label_topmost (ctf_dict_t *);
+extern int ctf_label_info (ctf_dict_t *, const char *, ctf_lblinfo_t *);
-extern int ctf_member_count (ctf_file_t *, ctf_id_t);
-extern int ctf_member_iter (ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
-extern ssize_t ctf_member_next (ctf_file_t *, ctf_id_t, ctf_next_t **,
+extern int ctf_member_count (ctf_dict_t *, ctf_id_t);
+extern int ctf_member_iter (ctf_dict_t *, ctf_id_t, ctf_member_f *, void *);
+extern ssize_t ctf_member_next (ctf_dict_t *, ctf_id_t, ctf_next_t **,
const char **name, ctf_id_t *membtype);
-extern int ctf_enum_iter (ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
-extern const char *ctf_enum_next (ctf_file_t *, ctf_id_t, ctf_next_t **,
+extern int ctf_enum_iter (ctf_dict_t *, ctf_id_t, ctf_enum_f *, void *);
+extern const char *ctf_enum_next (ctf_dict_t *, ctf_id_t, ctf_next_t **,
int *);
-extern int ctf_type_iter (ctf_file_t *, ctf_type_f *, void *);
-extern int ctf_type_iter_all (ctf_file_t *, ctf_type_all_f *, void *);
-extern ctf_id_t ctf_type_next (ctf_file_t *, ctf_next_t **,
+extern int ctf_type_iter (ctf_dict_t *, ctf_type_f *, void *);
+extern int ctf_type_iter_all (ctf_dict_t *, ctf_type_all_f *, void *);
+extern ctf_id_t ctf_type_next (ctf_dict_t *, ctf_next_t **,
int *flag, int want_hidden);
-extern int ctf_label_iter (ctf_file_t *, ctf_label_f *, void *);
-extern int ctf_label_next (ctf_file_t *, ctf_next_t **, const char **); /* TBD */
-extern int ctf_variable_iter (ctf_file_t *, ctf_variable_f *, void *);
-extern ctf_id_t ctf_variable_next (ctf_file_t *, ctf_next_t **,
+extern int ctf_label_iter (ctf_dict_t *, ctf_label_f *, void *);
+extern int ctf_label_next (ctf_dict_t *, ctf_next_t **, const char **); /* TBD */
+extern int ctf_variable_iter (ctf_dict_t *, ctf_variable_f *, void *);
+extern ctf_id_t ctf_variable_next (ctf_dict_t *, ctf_next_t **,
const char **);
extern int ctf_archive_iter (const ctf_archive_t *, ctf_archive_member_f *,
void *);
-extern ctf_file_t *ctf_archive_next (const ctf_archive_t *, ctf_next_t **,
+extern ctf_dict_t *ctf_archive_next (const ctf_archive_t *, ctf_next_t **,
const char **, int skip_parent, int *errp);
/* This function alone does not currently operate on CTF files masquerading
@@ -414,97 +414,104 @@ extern ctf_file_t *ctf_archive_next (const ctf_archive_t *, ctf_next_t **,
to deal with non-archives at all. */
extern int ctf_archive_raw_iter (const ctf_archive_t *,
ctf_archive_raw_member_f *, void *);
-extern char *ctf_dump (ctf_file_t *, ctf_dump_state_t **state,
+extern char *ctf_dump (ctf_dict_t *, ctf_dump_state_t **state,
ctf_sect_names_t sect, ctf_dump_decorate_f *,
void *arg);
/* Error-warning reporting: an 'iterator' that returns errors and warnings from
the error/warning list, in order of emission. Errors and warnings are popped
after return: the caller must free the returned error-text pointer. */
-extern char *ctf_errwarning_next (ctf_file_t *, ctf_next_t **,
+extern char *ctf_errwarning_next (ctf_dict_t *, ctf_next_t **,
int *is_warning, int *errp);
-extern ctf_id_t ctf_add_array (ctf_file_t *, uint32_t,
+extern ctf_id_t ctf_add_array (ctf_dict_t *, uint32_t,
const ctf_arinfo_t *);
-extern ctf_id_t ctf_add_const (ctf_file_t *, uint32_t, ctf_id_t);
-extern ctf_id_t ctf_add_enum_encoded (ctf_file_t *, uint32_t, const char *,
+extern ctf_id_t ctf_add_const (ctf_dict_t *, uint32_t, ctf_id_t);
+extern ctf_id_t ctf_add_enum_encoded (ctf_dict_t *, uint32_t, const char *,
const ctf_encoding_t *);
-extern ctf_id_t ctf_add_enum (ctf_file_t *, uint32_t, const char *);
-extern ctf_id_t ctf_add_float (ctf_file_t *, uint32_t,
+extern ctf_id_t ctf_add_enum (ctf_dict_t *, uint32_t, const char *);
+extern ctf_id_t ctf_add_float (ctf_dict_t *, uint32_t,
const char *, const ctf_encoding_t *);
-extern ctf_id_t ctf_add_forward (ctf_file_t *, uint32_t, const char *,
+extern ctf_id_t ctf_add_forward (ctf_dict_t *, uint32_t, const char *,
uint32_t);
-extern ctf_id_t ctf_add_function (ctf_file_t *, uint32_t,
+extern ctf_id_t ctf_add_function (ctf_dict_t *, uint32_t,
const ctf_funcinfo_t *, const ctf_id_t *);
-extern ctf_id_t ctf_add_integer (ctf_file_t *, uint32_t, const char *,
+extern ctf_id_t ctf_add_integer (ctf_dict_t *, uint32_t, const char *,
const ctf_encoding_t *);
-extern ctf_id_t ctf_add_slice (ctf_file_t *, uint32_t, ctf_id_t, const ctf_encoding_t *);
-extern ctf_id_t ctf_add_pointer (ctf_file_t *, uint32_t, ctf_id_t);
-extern ctf_id_t ctf_add_type (ctf_file_t *, ctf_file_t *, ctf_id_t);
-extern ctf_id_t ctf_add_typedef (ctf_file_t *, uint32_t, const char *,
+extern ctf_id_t ctf_add_slice (ctf_dict_t *, uint32_t, ctf_id_t, const ctf_encoding_t *);
+extern ctf_id_t ctf_add_pointer (ctf_dict_t *, uint32_t, ctf_id_t);
+extern ctf_id_t ctf_add_type (ctf_dict_t *, ctf_dict_t *, ctf_id_t);
+extern ctf_id_t ctf_add_typedef (ctf_dict_t *, uint32_t, const char *,
ctf_id_t);
-extern ctf_id_t ctf_add_restrict (ctf_file_t *, uint32_t, ctf_id_t);
-extern ctf_id_t ctf_add_struct (ctf_file_t *, uint32_t, const char *);
-extern ctf_id_t ctf_add_union (ctf_file_t *, uint32_t, const char *);
-extern ctf_id_t ctf_add_struct_sized (ctf_file_t *, uint32_t, const char *,
+extern ctf_id_t ctf_add_restrict (ctf_dict_t *, uint32_t, ctf_id_t);
+extern ctf_id_t ctf_add_struct (ctf_dict_t *, uint32_t, const char *);
+extern ctf_id_t ctf_add_union (ctf_dict_t *, uint32_t, const char *);
+extern ctf_id_t ctf_add_struct_sized (ctf_dict_t *, uint32_t, const char *,
size_t);
-extern ctf_id_t ctf_add_union_sized (ctf_file_t *, uint32_t, const char *,
+extern ctf_id_t ctf_add_union_sized (ctf_dict_t *, uint32_t, const char *,
size_t);
-extern ctf_id_t ctf_add_volatile (ctf_file_t *, uint32_t, ctf_id_t);
+extern ctf_id_t ctf_add_volatile (ctf_dict_t *, uint32_t, ctf_id_t);
-extern int ctf_add_enumerator (ctf_file_t *, ctf_id_t, const char *, int);
-extern int ctf_add_member (ctf_file_t *, ctf_id_t, const char *, ctf_id_t);
-extern int ctf_add_member_offset (ctf_file_t *, ctf_id_t, const char *,
+extern int ctf_add_enumerator (ctf_dict_t *, ctf_id_t, const char *, int);
+extern int ctf_add_member (ctf_dict_t *, ctf_id_t, const char *, ctf_id_t);
+extern int ctf_add_member_offset (ctf_dict_t *, ctf_id_t, const char *,
ctf_id_t, unsigned long);
-extern int ctf_add_member_encoded (ctf_file_t *, ctf_id_t, const char *,
+extern int ctf_add_member_encoded (ctf_dict_t *, ctf_id_t, const char *,
ctf_id_t, unsigned long,
const ctf_encoding_t);
-extern int ctf_add_variable (ctf_file_t *, const char *, ctf_id_t);
+extern int ctf_add_variable (ctf_dict_t *, const char *, ctf_id_t);
-extern int ctf_set_array (ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
+extern int ctf_set_array (ctf_dict_t *, ctf_id_t, const ctf_arinfo_t *);
-extern ctf_file_t *ctf_create (int *);
-extern int ctf_update (ctf_file_t *);
-extern ctf_snapshot_id_t ctf_snapshot (ctf_file_t *);
-extern int ctf_rollback (ctf_file_t *, ctf_snapshot_id_t);
-extern int ctf_discard (ctf_file_t *);
-extern int ctf_write (ctf_file_t *, int);
-extern int ctf_gzwrite (ctf_file_t *fp, gzFile fd);
-extern int ctf_compress_write (ctf_file_t * fp, int fd);
-extern unsigned char *ctf_write_mem (ctf_file_t *, size_t *, size_t threshold);
+extern ctf_dict_t *ctf_create (int *);
+extern int ctf_update (ctf_dict_t *);
+extern ctf_snapshot_id_t ctf_snapshot (ctf_dict_t *);
+extern int ctf_rollback (ctf_dict_t *, ctf_snapshot_id_t);
+extern int ctf_discard (ctf_dict_t *);
+extern int ctf_write (ctf_dict_t *, int);
+extern int ctf_gzwrite (ctf_dict_t *fp, gzFile fd);
+extern int ctf_compress_write (ctf_dict_t * fp, int fd);
+extern unsigned char *ctf_write_mem (ctf_dict_t *, size_t *, size_t threshold);
-extern int ctf_link_add_ctf (ctf_file_t *, ctf_archive_t *, const char *);
+extern int ctf_link_add_ctf (ctf_dict_t *, ctf_archive_t *, const char *);
/* The variable filter should return nonzero if a variable should not
appear in the output. */
-typedef int ctf_link_variable_filter_f (ctf_file_t *, const char *, ctf_id_t,
+typedef int ctf_link_variable_filter_f (ctf_dict_t *, const char *, ctf_id_t,
void *);
-extern int ctf_link_set_variable_filter (ctf_file_t *,
+extern int ctf_link_set_variable_filter (ctf_dict_t *,
ctf_link_variable_filter_f *, void *);
-extern int ctf_link (ctf_file_t *, int flags);
+extern int ctf_link (ctf_dict_t *, int flags);
typedef const char *ctf_link_strtab_string_f (uint32_t *offset, void *arg);
-extern int ctf_link_add_strtab (ctf_file_t *, ctf_link_strtab_string_f *,
+extern int ctf_link_add_strtab (ctf_dict_t *, ctf_link_strtab_string_f *,
void *);
typedef ctf_link_sym_t *ctf_link_iter_symbol_f (ctf_link_sym_t *dest,
void *arg);
-extern int ctf_link_shuffle_syms (ctf_file_t *, ctf_link_iter_symbol_f *,
+extern int ctf_link_shuffle_syms (ctf_dict_t *, ctf_link_iter_symbol_f *,
void *);
-extern unsigned char *ctf_link_write (ctf_file_t *, size_t *size,
+extern unsigned char *ctf_link_write (ctf_dict_t *, size_t *size,
size_t threshold);
/* Specialist linker functions. These functions are not used by ld, but can be
used by other programs making use of the linker machinery for other purposes
to customize its output. */
-extern int ctf_link_add_cu_mapping (ctf_file_t *, const char *from,
+extern int ctf_link_add_cu_mapping (ctf_dict_t *, const char *from,
const char *to);
-typedef char *ctf_link_memb_name_changer_f (ctf_file_t *,
+typedef char *ctf_link_memb_name_changer_f (ctf_dict_t *,
const char *, void *);
extern void ctf_link_set_memb_name_changer
- (ctf_file_t *, ctf_link_memb_name_changer_f *, void *);
+ (ctf_dict_t *, ctf_link_memb_name_changer_f *, void *);
extern void ctf_setdebug (int debug);
extern int ctf_getdebug (void);
+/* Deprecated aliases for existing functions and types. */
+
+struct ctf_file;
+typedef struct ctf_dict ctf_file_t;
+extern void ctf_file_close (ctf_file_t *);
+extern ctf_dict_t *ctf_parent_file (ctf_dict_t *);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/ctf.h b/include/ctf.h
index f251759..6b8aa53 100644
--- a/include/ctf.h
+++ b/include/ctf.h
@@ -552,7 +552,7 @@ typedef struct ctf_enum
int32_t cte_value; /* Value associated with this name. */
} ctf_enum_t;
-/* The ctf_archive is a collection of ctf_file_t's stored together. The format
+/* The ctf_archive is a collection of ctf_dict_t's stored together. The format
is suitable for mmap()ing: this control structure merely describes the
mmap()ed archive (and overlaps the first few bytes of it), hence the
greater care taken with integral types. All CTF files in an archive
@@ -578,20 +578,20 @@ struct ctf_archive
/* CTF data model. */
uint64_t ctfa_model;
- /* Number of CTF files in the archive. */
- uint64_t ctfa_nfiles;
+ /* Number of CTF dicts in the archive. */
+ uint64_t ctfa_ndicts;
/* Offset of the name table. */
uint64_t ctfa_names;
/* Offset of the CTF table. Each element starts with a size (a uint64_t
- in network byte order) then a ctf_file_t of that size. */
+ in network byte order) then a ctf_dict_t of that size. */
uint64_t ctfa_ctfs;
};
/* An array of ctfa_nnamed of this structure lies at
ctf_archive[ctf_archive->ctfa_modents] and gives the ctfa_ctfs or
- ctfa_names-relative offsets of each name or ctf_file_t. */
+ ctfa_names-relative offsets of each name or ctf_dict_t. */
typedef struct ctf_archive_modent
{