* Internals of -readnow implementation
@ 2025-11-11 16:18 Jan Vrany via Gdb
2025-11-11 21:18 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Jan Vrany via Gdb @ 2025-11-11 16:18 UTC (permalink / raw)
To: GDB mailing list
Hi,
looking at how -readnow is implemented, I'm puzzled
why implementation of readnow_functions inherits/user
dwarf2_base_index_functions?
My understanding is that if -readnow is specified, then
all compunit symbtabs in that objfile are fully read.
It seems to me that in theory one can implement it "directly"
by traversing compunit symtabs, its blockvector and symbols
(rather than using dwarf2_per_objfile and alike).
Is that because it was just easier to implement it this way
or is there a reason why it has to go through DWARF reader
structures?
Thanks,
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Internals of -readnow implementation
2025-11-11 16:18 Internals of -readnow implementation Jan Vrany via Gdb
@ 2025-11-11 21:18 ` Tom Tromey
2025-11-11 21:44 ` Jan Vrany via Gdb
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2025-11-11 21:18 UTC (permalink / raw)
To: Jan Vrany via Gdb; +Cc: Jan Vrany
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Internals of -readnow implementation
2025-11-11 21:18 ` Tom Tromey
@ 2025-11-11 21:44 ` Jan Vrany via Gdb
0 siblings, 0 replies; 3+ messages in thread
From: Jan Vrany via Gdb @ 2025-11-11 21:44 UTC (permalink / raw)
On Tue, 2025-11-11 at 14:18 -0700, Tom Tromey wrote:
> 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.
I see, thanks.
>
> 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.
Yes! I encountered the same issue when working on Python JIT API
and came to the same realization.
In fact, I already started working on it and got relatively far
in replacing current implementation of readnow_functions but still
have loose ends especially in ::search method. It seems to me that the
implementations not always match its comment.
Jan
>
> -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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-11 22:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-11 16:18 Internals of -readnow implementation Jan Vrany via Gdb
2025-11-11 21:18 ` Tom Tromey
2025-11-11 21:44 ` Jan Vrany via Gdb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox