Re: [PATCH v2 13/13] gdb: update message in symbol_file_add_with_addrs after changes in readnow_functions

Jan Vraný
2025-12-02T18:49:01Z

On Tue, 2025-12-02 at 10:29 -0700, Tom Tromey wrote:
> > > > > > "Jan" == Jan Vrany <jan.vrany@labware.com> writes:
>
> Jan> When loading a file with -readnow, GDB prints message like:
> Jan>     Reading symbols from some_program...
> Jan>     Expanding full symbols from some_program...
>
> Jan> I assume the reason for the second message ("Expanding ...") is to let
> Jan> the user know what's happening as symbol expansion may take time.
>
> Yeah.
>
> I wonder if instead of rewriting expand_all_symtabs in this series, you
> could leave most of that patch in place but still have
> readnow_functions::expand_all_symtabs actually do the work.

Sure.

>
> Then when/if readnow_functions is moved out of the DWARF reader,

I already have a patch that does this and planed to submit it once this
one is in. The reason I stared digging around readnow_function is that
search-via-psyms series broke my "Python JIT API" code as well as JIT
reader precisely because they do not install any quick functions.

Maybe better way to go about it might be:

1) introduce new quick functions, say "default_symbol_functions" with
the code from this (V2) series.
2) then DWARF's readnow_functions may inherit from "default_symbol_functions"
and override what's desirable

and then JIT reader would just use these new "default_symbol_functions".

> the
> DWARF reader could subclass it to just add the one new method.
>
> This way the message would still arrive at the right time, which seems
> friendlier to users.
>
> Jan> This commit therefore checks if there are any unexpanded CUs and if
> Jan> so, prints "Expanding full..." message as before. If all CUs are already
> Jan> expanded, say just "Expanded full...".
>
> Also if there are multiple debug readers for an objfile, we could get
> the "wrong" message here through no fault of the reader itself, if that
> makes sense.

I'm lost. In what situation we'd get "wrong" message?

Thanks!
Jan

>
> Tom