binutils-gdb/include
Nick Alcock 2fa4b6e6df
libctf, include: new functions for looking up enumerators
Three new functions for looking up the enum type containing a given
enumeration constant, and optionally that constant's value.

The simplest, ctf_lookup_enumerator, looks up a root-visible enumerator by
name in one dict: if the dict contains multiple such constants (which is
possible for dicts created by older versions of the libctf deduplicator),
ECTF_DUPLICATE is returned.

The next simplest, ctf_lookup_enumerator_next, is an iterator which returns
all enumerators with a given name in a given dict, whether root-visible or
not.

The most elaborate, ctf_arc_lookup_enumerator_next, finds all
enumerators with a given name across all dicts in an entire CTF archive,
whether root-visible or not, starting looking in the shared parent dict;
opened dicts are cached (as with all other ctf_arc_*lookup functions) so
that repeated use does not incur repeated opening costs.

All three of these return enumerator values as int64_t: unfortunately, API
compatibility concerns prevent us from doing the same with the other older
enum-related functions, which all return enumerator constant values as ints.
We may be forced to add symbol-versioning compatibility aliases that fix the
other functions in due course, bumping the soname for platforms that do not
support such things.

ctf_arc_lookup_enumerator_next is implemented as a nested ctf_archive_next
iterator, and inside that, a nested ctf_lookup_enumerator_next iterator
within each dict.  To aid in this, add support to ctf_next_t iterators for
iterators that are implemented in terms of two simultaneous nested iterators
at once.  (It has always been possible for callers to use as many nested or
semi-overlapping ctf_next_t iterators as they need, which is one of the
advantages of this style over the _iter style that calls a function for each
thing iterated over: the iterator change here permits *ctf_next_t iterators
themselves* to be implemented by iterating using multiple other iterators as
part of their internal operation, transparently to the caller.)

Also add a testcase that tests all these functions (which is fairly easy
because ctf_arc_lookup_enumerator_next is implemented in terms of
ctf_lookup_enumerator_next) in addition to enumeration addition in
ctf_open()ed dicts, ctf_add_enumerator duplicate enumerator addition, and
conflicting enumerator constant deduplication.

include/
	* ctf-api.h (ctf_lookup_enumerator): New.
	(ctf_lookup_enumerator_next): Likewise.
	(ctf_arc_lookup_enumerator_next): Likewise.

libctf/
	* libctf.ver: Add them.
	* ctf-impl.h (ctf_next_t) <ctn_next_inner>: New.
	* ctf-util.c (ctf_next_copy): Copy it.
        (ctf_next_destroy): Destroy it.
	* ctf-lookup.c (ctf_lookup_enumerator): New.
	(ctf_lookup_enumerator_next): New.
	* ctf-archive.c (ctf_arc_lookup_enumerator_next): New.
	* testsuite/libctf-lookup/enumerator-iteration.*: New test.
	* testsuite/libctf-lookup/enum-ctf-2.c: New test CTF, used by the
	  above.
2024-06-18 13:20:32 +01:00
..
aout Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
cgen Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
coff riscv64-pei uninitialised data writing relocs 2024-01-25 08:41:14 +10:30
elf Add new ELF section and segment types to readelf. 2024-05-28 10:12:28 +01:00
gdb Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
mach-o Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
opcode RISC-V: Add SiFive cease extension v1.0 2024-06-18 15:06:34 +08:00
sim sim: Fix -Werror=shadow=local by changing mem to addr in sim_{read,write} 2024-01-22 14:22:30 +01:00
som Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
vms Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
alloca-conf.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ansidecl.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
bfdlink.h Add --rosegment option to BFD linker to stop the '-z separate-code' from generating two read-only segments. 2024-06-13 15:10:15 +01:00
binary-io.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
bout.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
ChangeLog gdb: ignore -Wregister instead of -Wdeprecated-register 2024-04-07 22:57:39 -04:00
ChangeLog-0415
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020
ChangeLog-9103
collectorAPI.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
COPYING
COPYING3
ctf-api.h libctf, include: new functions for looking up enumerators 2024-06-18 13:20:32 +01:00
ctf.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
demangle.h Import gcc commit 65388b28656d65595bdaf191df85af81c35ca63 which adds support for explicit object member function mangling. 2024-01-17 12:06:48 +00:00
diagnostics.h gdb: ignore -Wregister instead of -Wdeprecated-register 2024-04-07 22:57:39 -04:00
dis-asm.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
dwarf2.def Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
dwarf2.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
dyn-string.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
environ.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
fibheap.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
filenames.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
floatformat.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
gcc-c-fe.def Synchronize GCC compile plugin headers 2024-02-29 15:34:38 -07:00
gcc-c-interface.h Synchronize GCC compile plugin headers 2024-02-29 15:34:38 -07:00
gcc-cp-fe.def Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
gcc-cp-interface.h Synchronize GCC compile plugin headers 2024-02-29 15:34:38 -07:00
gcc-interface.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
getopt.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
hashtab.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
hp-symtab.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
leb128.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
libcollector.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
libfcollector.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
libiberty.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
longlong.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
lto-symtab.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
MAINTAINERS Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
md5.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
oasys.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
objalloc.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
obstack.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
os9k.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
partition.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
plugin-api.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
sframe-api.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
sframe.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
sha1.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
simple-object.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
sort.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
splay-tree.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
symcat.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
xregex2.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
xregex.h
xtensa-config.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
xtensa-dynconfig.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2024-01-04 22:58:12 +10:30