On Wed 2015-07-08 17:16 -0400, Dave Anderson wrote: > > Hi Aaron, > > I was revisiting your v1 patch, and realized that the duplicate symbol check > also needs to apply to the "can_eval()" section as well, because a user could > enter "dis symbol+<offset>". > > So I extracted your do-while loop into a discrete function, and beefed it > up to handle the entry of symbols with multiple text and data symbols, as > well as some other possibilities. In so doing, things got a bit murkier > than your original patch. I've attached what I've come up with so far. > Tell me what you think. > > Thanks, > Dave Hi Dave, The changes seem great - thanks for this! I'd like to propose the following on top of what you've done so far: diff --git a/defs.h b/defs.h index ac17455..cc63de8 100644 --- a/defs.h +++ b/defs.h @@ -4542,6 +4542,7 @@ void symtab_init(void); char *check_specified_kernel_debug_file(void); void no_debugging_data(int); void get_text_init_space(void); +int is_symbol_text(struct syment *); int is_kernel_text(ulong); int is_kernel_data(ulong); int is_init_data(ulong value); diff --git a/kernel.c b/kernel.c index 7331a5b..9a3f14d 100644 --- a/kernel.c +++ b/kernel.c @@ -1347,7 +1347,7 @@ resolve_text_symbol(char *arg, struct syment *sp_in, struct gnu_request *req, in sp = sp_orig; do { - if ((sp->type == 't') || (sp->type == 'T')) { + if (is_symbol_text(sp)) { if (!first_text) first_text = sp; text_symbols++; @@ -1383,7 +1383,7 @@ resolve_text_symbol(char *arg, struct syment *sp_in, struct gnu_request *req, in count = 0; sp = sp_orig; do { - if ((sp->type == 't') || (sp->type == 'T')) { + if (is_symbol_text(sp)) { if (++count == 1) fprintf(fp, "duplicate text symbols found: %s\n", diff --git a/symbols.c b/symbols.c index b83b8b5..e190f24 100644 --- a/symbols.c +++ b/symbols.c @@ -2672,6 +2672,14 @@ compare_mods(const void *v1, const void *v2) lm1->mod_base == lm2->mod_base ? 0 : 1); } +int +is_symbol_text(struct syment *sp) +{ + if ((sp->type == 'T') || (sp->type == 't')) + return TRUE; + else + return FALSE; +} /* * Check whether a value falls into a text-type (SEC_CODE) section. -- Aaron Tomlin -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility