Re: Internals of -readnow implementation

Tom Tromey <[email protected]> Tue, 11 Nov 2025 14:18:27 -0700
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Jan> looking at how -readnow is implemented, I'm puzzled
Jan> why implementation of readnow_functions inherits/user
Jan> dwarf2_base_index_functions?

It's mostly a convenience, because that class implements some methods.

Jan> My understanding is that if -readnow is specified, then
Jan> all compunit symbtabs in that objfile are fully read.
Jan> It seems to me that in theory one can implement it "directly" 
Jan> by traversing compunit symtabs, its blockvector and symbols 
Jan> (rather than using dwarf2_per_objfile and alike). 

Jan> Is that because it was just easier to implement it this way
Jan> or is there a reason why it has to go through DWARF reader
Jan> structures?

There's no deep reason.

For this bug:

    https://sourceware.org/bugzilla/show_bug.cgi?id=33554

... I am planning to reimplement it as you say: just search things
directly without regard to the DWARF data structures.

-readnow is weird because it's mostly there as a debugging aid, and
sometimes a workaround for other bugs.  While I have recommended it to
users, I don't really like doing so.  Occasionally I think about
removing it.

Tom