libctf, open: new API for getting the size of CTF/BTF file sections

I wrote this for BTF type size querying programs, but it might be
of more general use and it's impossible to get this info in any
other way, so we might want to keep it.

New API:
+size_t ctf_sect_size (ctf_dict_t *, ctf_sect_names_t sect);
This commit is contained in:
Nick Alcock
2025-04-25 11:51:04 +01:00
parent 4837852527
commit f7f72bcca6
3 changed files with 49 additions and 0 deletions

View File

@@ -894,6 +894,10 @@ extern char *ctf_dump (ctf_dict_t *, ctf_dump_state_t **state,
ctf_sect_names_t sect, ctf_dump_decorate_f *,
void *arg);
/* Return the size in bytes of a given CTF section, or 0 if none. */
extern size_t ctf_sect_size (ctf_dict_t *, ctf_sect_names_t sect);
/* 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. */