libctf: ctf-lookup: support prefixes in ctf_lookup_by_id

ctf_lookup_by_id now has a new optional suffix argument, which,
if set, returns the suffix of a prefixed type: the ctf_type_t it
returns remains (as ever) the first one in the type (i.e. it
may be a prefix type).  This is most convenient because the prefix
is the ctf_type_t that LCTF_KIND and other LCTF functions taking
ctf_type_t's expect.

Callers not yet adjusted.
This commit is contained in:
Nick Alcock
2025-04-24 14:17:19 +01:00
parent a80b903b45
commit 2ef9554023
2 changed files with 38 additions and 9 deletions

View File

@@ -622,8 +622,9 @@ extern ctf_id_t ctf_index_to_type (const ctf_dict_t *, uint32_t);
#define LCTF_PRESERIALIZED 0x0020 /* Already serialized all but the strtab. */
extern ctf_dynhash_t *ctf_name_table (ctf_dict_t *, int);
extern const ctf_type_t *ctf_lookup_by_id (ctf_dict_t **, ctf_id_t);
extern ctf_id_t ctf_lookup_variable_here (ctf_dict_t *fp, const char *name);
extern const ctf_type_t *ctf_lookup_by_id (ctf_dict_t **, ctf_id_t,
const ctf_type_t **suffix);
extern ctf_id_t ctf_lookup_by_sym_or_name (ctf_dict_t *, unsigned long symidx,
const char *symname, int try_parent,
int is_function);