aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dissect.c
diff options
Diffstat (limited to 'dissect.c')
-rw-r--r--dissect.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/dissect.c b/dissect.c
index 582e8fc3..0d6c3288 100644
--- a/dissect.c
+++ b/dissect.c
@@ -652,9 +652,46 @@ static void do_sym_list(struct symbol_list *list)
DO_LIST(list, sym, do_symbol(sym));
}
+static inline bool valid_namespace(enum namespace ns)
+{
+ return (ns == NS_STRUCT || ns == NS_SYMBOL);
+}
+
+static void do_file(char *file)
+{
+ struct symbol_list *res = sparse_keep_tokens(file);
+
+ if (!dissect_show_all_symbols) {
+ do_sym_list(res);
+ goto end;
+ }
+
+ DO_LIST(file_scope->symbols, sym,
+ if (input_streams[sym->pos.stream].fd != -1 && valid_namespace(sym->namespace)) {
+ if (sym->type == SYM_STRUCT || sym->type == SYM_UNION) {
+ sym->ctype.base_type = sym;
+ examine_sym_node(sym, NULL);
+ continue;
+ }
+
+ do_symbol(sym);
+ }
+ );
+
+ DO_LIST(global_scope->symbols, sym,
+ if (input_streams[sym->pos.stream].fd != -1 && valid_namespace(sym->namespace)) {
+ do_symbol(sym);
+ }
+ );
+
+end:
+ /* Drop the tokens for this file after parsing */
+ clear_token_alloc();
+}
+
void dissect(struct reporter *rep, struct string_list *filelist)
{
reporter = rep;
- DO_LIST(filelist, file, do_sym_list(__sparse(file)));
+ DO_LIST(filelist, file, do_file(file));
}