From 97a2a623d0193dbfc92d92545b63aaffd6099272 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Fri, 20 Nov 2020 13:34:04 +0000 Subject: libctf, include: add ctf_getsymsect and ctf_getstrsect libctf has long provided ctf_getdatasect, which hands back a pointer to the CTF section a (read-only) dict came from. But it has no such functions to return pointers to the ELF symbol table or string table it's working from, which is unfortunate because several libctf functions (ctf_open, ctf_fdopen, and ctf_bfdopen) figure out which string and symbol table to use themselves, and don't tell the user what they decided, so the caller can't agree on which symtab to use with libctf even if it wanted to. Add a pair of functions to return the symtab and strtab in use. Like ctf_getdatasect, these return ctf_sect_t structures by value, filled with all-NULL/0 content if a symtab or strtab is not being used. include/ChangeLog 2020-11-20 Nick Alcock * ctf-api.h (ctf_getsymsect): New. (ctf_getstrsect): Likewise. libctf/ChangeLog 2020-11-20 Nick Alcock * ctf-open.c (ctf_getsymsect): New. (ctf_getstrsect): Likewise. * libctf.ver: Add them. --- libctf/libctf.ver | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libctf/libctf.ver') diff --git a/libctf/libctf.ver b/libctf/libctf.ver index f0633f2..cfecc89 100644 --- a/libctf/libctf.ver +++ b/libctf/libctf.ver @@ -190,4 +190,7 @@ LIBCTF_1.1 { ctf_arc_lookup_symbol; ctf_arc_flush_caches; + + ctf_getsymsect; + ctf_getstrsect; } LIBCTF_1.0; -- cgit v1.1