aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--dissect.c39
-rw-r--r--options.c5
-rw-r--r--options.h2
-rw-r--r--semind.c1
4 files changed, 46 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));
}
diff --git a/options.c b/options.c
index 6704fc8d..b4684357 100644
--- a/options.c
+++ b/options.c
@@ -70,6 +70,8 @@ int dbg_postorder = 0;
int dump_macro_defs = 0;
int dump_macros_only = 0;
+int dissect_show_all_symbols = 0;
+
unsigned long fdump_ir;
int fhosted = 1;
unsigned int fmax_errors = 100;
@@ -958,6 +960,9 @@ static char **handle_param(char *arg, char **next)
if (!value)
die("missing argument for --param option");
+ if (!strcmp(value, "dissect-show-all-symbols"))
+ dissect_show_all_symbols = 1;
+
return next;
}
diff --git a/options.h b/options.h
index 0aec8764..c2a9551a 100644
--- a/options.h
+++ b/options.h
@@ -70,6 +70,8 @@ extern int dbg_postorder;
extern int dump_macro_defs;
extern int dump_macros_only;
+extern int dissect_show_all_symbols;
+
extern unsigned long fdump_ir;
extern int fhosted;
extern unsigned int fmax_errors;
diff --git a/semind.c b/semind.c
index 911fc747..ad8003ba 100644
--- a/semind.c
+++ b/semind.c
@@ -329,6 +329,7 @@ done:
optind--;
sparse_initialize(argc - optind, argv + optind, &semind_filelist);
+ dissect_show_all_symbols = 1;
}
static void parse_cmdline_rm(int argc, char **argv)