aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-impl.h
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2020-06-05 18:15:26 +0100
committerNick Alcock <nick.alcock@oracle.com>2020-07-22 18:02:18 +0100
commit6dd2819ffc282e644e7feb476cc803d4f39d9f17 (patch)
treecbbc466b022a0c522c03f398e374e12aa7ab6655 /libctf/ctf-impl.h
parent19d4b1addcafc786360c31d02d5ef2b44aef3152 (diff)
downloadgdb-6dd2819ffc282e644e7feb476cc803d4f39d9f17.zip
gdb-6dd2819ffc282e644e7feb476cc803d4f39d9f17.tar.gz
gdb-6dd2819ffc282e644e7feb476cc803d4f39d9f17.tar.bz2
libctf, link: add the ability to filter out variables from the link
The CTF variables section (containing variables that have no corresponding symtab entries) can cause the string table to get very voluminous if the names of variables are long. Some callers want to filter out particular variables they know they won't need. So add a "variable filter" callback that does that: it's passed the name of the variable and a corresponding ctf_file_t / ctf_id_t pair, and should return 1 to filter it out. ld doesn't use this machinery yet, but we could easily add it later if desired. (But see later for a commit that turns off CTF variable- section linking in ld entirely by default.) include/ * ctf-api.h (ctf_link_variable_filter_t): New. (ctf_link_set_variable_filter): Likewise. libctf/ * libctf.ver (ctf_link_set_variable_filter): Add. * ctf-impl.h (ctf_file_t) <ctf_link_variable_filter>: New. <ctf_link_variable_filter_arg>: Likewise. * ctf-create.c (ctf_serialize): Adjust. * ctf-link.c (ctf_link_set_variable_filter): New, set it. (ctf_link_one_variable): Call it if set.
Diffstat (limited to 'libctf/ctf-impl.h')
-rw-r--r--libctf/ctf-impl.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h
index 46bceb4..7f47c68 100644
--- a/libctf/ctf-impl.h
+++ b/libctf/ctf-impl.h
@@ -333,7 +333,12 @@ struct ctf_file
/* Allow the caller to change the name of link archive members. */
ctf_link_memb_name_changer_f *ctf_link_memb_name_changer;
- void *ctf_link_memb_name_changer_arg; /* Argument for it. */
+ void *ctf_link_memb_name_changer_arg; /* Argument for it. */
+
+ /* Allow the caller to filter out variables they don't care about. */
+ ctf_link_variable_filter_f *ctf_link_variable_filter;
+ void *ctf_link_variable_filter_arg; /* Argument for it. */
+
ctf_dynhash_t *ctf_add_processing; /* Types ctf_add_type is working on now. */
char *ctf_tmp_typeslice; /* Storage for slicing up type names. */
size_t ctf_tmp_typeslicelen; /* Size of the typeslice. */