On 2023/05/30 12:18, lijiang wrote: > On Thu, May 11, 2023 at 12:35 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx> > wrote: > >> Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx> >> --- >> symbols.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++---- >> 1 file changed, 99 insertions(+), 6 deletions(-) >> >> diff --git a/symbols.c b/symbols.c >> index 9714453400bf..db22f3c4e8b3 100644 >> --- a/symbols.c >> +++ b/symbols.c >> @@ -1526,8 +1526,13 @@ check_for_dups(struct load_module *lm) >> { >> struct syment *sp, *sp_end; >> >> - sp = lm->mod_symtable; >> - sp_end = lm->mod_symend; >> + if (MODULE_MEMORY()) { >> + sp = lm->mod_load_symtable; >> + sp_end = lm->mod_load_symend; >> + } else { >> + sp = lm->mod_symtable; >> + sp_end = lm->mod_symend; >> + } >> >> for ( ; sp <= sp_end; sp++) { >> if (symbol_name_count(sp->name) > 1) >> @@ -5033,8 +5038,11 @@ get_section(ulong vaddr, char *buf) >> if (module_symbol(vaddr, NULL, &lm, NULL, *gdb_output_radix)) { >> if (lm->mod_flags & MOD_LOAD_SYMS) { >> for (i = (lm->mod_sections-1); i >= 0; i--) { >> - start = lm->mod_base + >> - lm->mod_section_data[i].offset; >> + if (MODULE_MEMORY()) >> + start = >> lm->mod_section_data[i].addr; >> + else >> + start = lm->mod_base + >> + >> lm->mod_section_data[i].offset; >> end = start + >> lm->mod_section_data[i].size; >> >> if ((vaddr >= start) && (vaddr < end)) { >> @@ -5089,7 +5097,7 @@ get_build_directory(char *buf) >> int >> symbol_query(char *s, char *print_pad, struct syment **spp) >> { >> - int i; >> + int i, j; >> struct syment *sp, *sp_end; >> struct load_module *lm; >> int cnt, search_init; >> @@ -5109,6 +5117,60 @@ symbol_query(char *s, char *print_pad, struct >> syment **spp) >> } >> } >> >> + if (!MODULE_MEMORY()) >> + goto old_module; >> + >> + for (i = 0; i < st->mods_installed; i++) { >> + lm = &st->load_modules[i]; >> + >> + if (lm->mod_flags & MOD_LOAD_SYMS) { >> + sp = lm->mod_load_symtable; >> + sp_end = lm->mod_load_symend; >> + >> + for (; sp < sp_end; sp++) { >> + if (MODULE_PSEUDO_SYMBOL(sp)) >> + continue; >> > > This means that it will also skip searching for any *_INIT_* , is it > expected behavior? No, it skips only module pseudo symbols, which *start* with "_MODULE_". Thanks, Kazu > > Other changes in this patch are fine to me. > > Thanks. > Lianbo > > >> + > > + if (strstr(sp->name, s)) { >> + if (print_pad) { >> + if (strlen(print_pad)) >> + fprintf(fp, "%s", >> print_pad); >> + show_symbol(sp, 0, >> SHOW_RADIX()|SHOW_MODULE); >> + } >> + if (spp) >> + *spp = sp; >> + cnt++; >> + } >> + } >> + } else { >> + for (j = MOD_TEXT; j < MOD_MEM_NUM_TYPES; j++) { >> + if (!lm->symtable[j]) >> + continue; >> + >> + sp = lm->symtable[j]; >> + sp_end = lm->symend[j]; >> + >> + for (; sp < sp_end; sp++) { >> + if (MODULE_PSEUDO_SYMBOL(sp)) >> + continue; >> + >> + if (strstr(sp->name, s)) { >> + if (print_pad) { >> + if >> (strlen(print_pad)) >> + >> fprintf(fp, "%s", print_pad); >> + show_symbol(sp, 0, >> SHOW_RADIX()|SHOW_MODULE); >> + } >> + if (spp) >> + *spp = sp; >> + cnt++; >> + } >> + } >> + } >> + } >> + } >> + return cnt; >> + >> +old_module: >> search_init = FALSE; >> >> for (i = 0; i < st->mods_installed; i++) { >> @@ -5214,7 +5276,7 @@ symbol_search(char *s) >> int >> symbol_name_count(char *s) >> { >> - int i; >> + int i, j; >> struct syment *sp, *sp_end; >> struct load_module *lm; >> int count, pseudos, search_init; >> @@ -5228,6 +5290,37 @@ symbol_name_count(char *s) >> } >> } >> >> + if (!MODULE_MEMORY()) >> + goto old_module; >> + >> + for (i = 0; i < st->mods_installed; i++) { >> + lm = &st->load_modules[i]; >> + >> + if (lm->mod_flags & MOD_LOAD_SYMS) { >> + sp = lm->mod_load_symtable; >> + sp_end = lm->mod_load_symend; >> + >> + for (; sp < sp_end; sp++) { >> + if (STREQ(s, sp->name)) >> + count++; >> + } >> + } else { >> + for (j = MOD_TEXT; j < MOD_MEM_NUM_TYPES; j++) { >> + if (!lm->symtable[j]) >> + continue; >> + >> + sp = lm->symtable[j]; >> + sp_end = lm->symend[j]; >> + for (; sp < sp_end; sp++) { >> + if (STREQ(s, sp->name)) >> + count++; >> + } >> + } >> + } >> + } >> + return count++; >> + >> +old_module: >> pseudos = (strstr(s, "_MODULE_START_") || strstr(s, >> "_MODULE_END_")); >> search_init = FALSE; >> >> -- >> 2.31.1 >> >> >> -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/crash-utility Contribution Guidelines: https://github.com/crash-utility/crash/wiki