]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: create, lookup: delete DVDs; ctf_lookup_by_kind
authorNick Alcock <nick.alcock@oracle.com>
Thu, 24 Apr 2025 14:58:12 +0000 (15:58 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:07:42 +0000 (18:07 +0100)
commit05a2970ad1e49be050a5e8ec4b7e0acac9b54b4e
tree0a91eb320a1c74e23fa6535f8eb3fffc8b8742ab
parenta93ad066f717d47a97700a09c1c744edaefb327d
libctf: create, lookup: delete DVDs; ctf_lookup_by_kind

Variable handling in BTF and CTFv4 works quite differently from in CTFv3.
Rather than a separate section containing sorted, bsearchable variables,
they are simply named entities like types, stored in CTF_K_VARs.

As a first stage towards migrating to this, delete most references to
the ctf_varent_t and ctf_dvdef_t, including the DVD lookup code, all
the linking code, and quite a lot of the serialization code.

Note: CTF_LINK_OMIT_VARIABLES_SECTION, and the whole "delete variables that
already exist in the symtypetabs section" stuff, has yet to be
reimplemented.  We can implement CTF_LINK_OMIT_VARIABLES_SECTION by simply
excising all CTF_K_VARs at deduplication time if requested.  (Note:
symtypetabs should still point directly at the type, not at the CTF_K_VAR.)

(Symtypetabs in general need a bit more thought -- perhaps we can now store
them in a separate .ctf.symtypetab section with its own little four-entry
header for the symtypetabs and their indexes, making .ctf even more like
.BTF; the only difference would then be that .ctf could include prefix
types, CTF_K_FLOAT, and external string refs.  For later discussion.)

We also add ctf_lookup_by_kind() at this stage (because it is hopelessly
diff-entangled with ctf_lookup_variable): this looks up a type of a
particular kind, without needing a per-kind lookup function for it,
nor needing to hack around adding string prefixes (so you can do
ctf_lookup_by_kind (fp, CTF_K_STRUCT, "foo") rather than having to
do ctf_lookup_by_name (fp, "struct foo"): often this is more convenient, and
anything that reduces string buffer manipulation in C is good.)
include/ctf-api.h
libctf/ctf-create.c
libctf/ctf-impl.h
libctf/ctf-link.c
libctf/ctf-lookup.c
libctf/ctf-open.c
libctf/ctf-serialize.c
libctf/libctf.ver