Re: [RFC PATCH 09/15] Support "sym -n" option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 2, 2023 at 10:33 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx> wrote:
>
> Are there any differences?

Yes, because those are before this subtraction in store_load_module_symbols():

         lm->mod_load_symend--;
         if (!MODULE_MEMORY() && !MODULE_END(lm->mod_load_symend) &&

 
Got it, thanks.

 
>
>>
>>>> +/* Only for 6.4 and later */
>>>> +struct syment *
>>>> +next_module_symbol(char *symbol, struct syment *sp_in, ulong val_in)
>>>> +{
>>>> +       int i, j, k;
>>>> +       struct load_module *lm;
>>>> +       struct syment *sp, *sp_end;
>>>> +
>>>> +       if (symbol)
>>>> +               goto symbol_search;
>>>> +       if (val_in)
>>>> +               goto value_search;
>>>> +
>>>> +       /* for sp_in */
>>>> +       for (i = 0; i < st->mods_installed; i++) {
>>>> +               lm = &st->load_modules[i];
>>>> +
>>>> +               /* quick check: sp_in is not in the module range. */
>>>> +               if (sp_in < lm->symtable[lm->address_order[0]] ||
>>>> +                   sp_in >
>> lm->symend[lm->address_order[lm->nr_mems-1]])
>>>> +                       continue;
>>>> +
>>>> +               for (j = 0; j < lm->nr_mems; j++) {
>>>> +                       k = lm->address_order[j];
>>>> +                       if (sp_in < lm->symtable[k] || sp_in >
>>>> lm->symend[k])
>>>> +                               continue;
>>>> +
>>>> +                       if (sp_in == lm->symend[k])
>>>> +                               return next_module_symbol(NULL, NULL,
>>>> sp_in->value);
>>>> +
>>>>
>>>
>>> This means it has to be invoked recursively.
>>
>> It looks to be a recursive call, but actually it's just a composite
>> of three functions, i.e. symbol, syment and value search, and the
>> value search does not do a recursive call.  So I think it's not a
>> real recursive call.
>>
>>
> Ok, but it looks unusual and hard to understand.

ok, I will try to split the function into e.g.


Thanks a lot.
 
next_module_symbol_by_syment()
next_module_symbol_by_symname()
next_module_symbol_by_value()

Thanks,
Kazu
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux