From 12a0b67d289e2c3ed266d93e8a8c80087f7d18f8 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Thu, 18 Jul 2019 18:44:21 +0100 Subject: libctf: introduce ctf_func_type_{info,args}, ctf_type_aname_raw The first two of these allow you to get function type info and args out of the types section give a type ID: astonishingly, this was missing from libctf before now: so even though types of kind CTF_K_FUNCTION were supported, you couldn't find out anything about them. (The existing ctf_func_info and ctf_func_args only allow you to get info about functions in the function section, i.e. given symbol table indexes, not type IDs.) The second of these allows you to get the raw undecorated name out of the CTF section (strdupped for safety) without traversing subtypes to build a full C identifier out of it. It's useful for things that are already tracking the type kind etc and just need an unadorned name. include/ * ctf-api.h (ECTF_NOTFUNC): Fix description. (ctf_func_type_info): New. (ctf_func_type_args): Likewise. libctf/ * ctf-types.c (ctf_type_aname_raw): New. (ctf_func_type_info): Likewise. (ctf_func_type_args): Likewise. * ctf-error.c (_ctf_errlist): Fix description. --- include/ChangeLog | 7 +++++++ include/ctf-api.h | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ChangeLog b/include/ChangeLog index 8954558..07e0c5c 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2019-07-18 Nick Alcock + + * ctf-api.h (ECTF_NOTFUNC): Fix description. + (ctf_func_type_info): New. + (ctf_func_type_args): Likewise. + (ctf_type_aname_raw): Likewise. + 2019-07-16 Jan Beulich * opcode/i386.h (POP_SEG386_SHORT): New. diff --git a/include/ctf-api.h b/include/ctf-api.h index 3acbc91..1a0d47e 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -160,7 +160,7 @@ enum ECTF_NAMELEN, /* Buffer is too small to hold type name. */ ECTF_NOTYPE, /* No type found corresponding to name. */ ECTF_SYNTAX, /* Syntax error in type name. */ - ECTF_NOTFUNC, /* Symtab entry does not refer to a function. */ + ECTF_NOTFUNC, /* Symbol entry or type is not a function. */ ECTF_NOFUNCDAT, /* No func info available for function. */ ECTF_NOTDATA, /* Symtab entry does not refer to a data obj. */ ECTF_NOTYPEDAT, /* No type info available for object. */ @@ -277,6 +277,8 @@ extern int ctf_version (int); extern int ctf_func_info (ctf_file_t *, unsigned long, ctf_funcinfo_t *); extern int ctf_func_args (ctf_file_t *, unsigned long, uint32_t, ctf_id_t *); +extern int ctf_func_type_info (ctf_file_t *, ctf_id_t, ctf_funcinfo_t *); +extern int ctf_func_type_args (ctf_file_t *, ctf_id_t, uint32_t, ctf_id_t *); extern ctf_id_t ctf_lookup_by_name (ctf_file_t *, const char *); extern ctf_id_t ctf_lookup_by_symbol (ctf_file_t *, unsigned long); @@ -284,6 +286,7 @@ extern ctf_id_t ctf_lookup_variable (ctf_file_t *, const char *); extern ctf_id_t ctf_type_resolve (ctf_file_t *, ctf_id_t); extern char *ctf_type_aname (ctf_file_t *, ctf_id_t); +extern char *ctf_type_aname_raw (ctf_file_t *, ctf_id_t); extern ssize_t ctf_type_lname (ctf_file_t *, ctf_id_t, char *, size_t); extern char *ctf_type_name (ctf_file_t *, ctf_id_t, char *, size_t); extern ssize_t ctf_type_size (ctf_file_t *, ctf_id_t); -- cgit v1.1