This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Question about _dl_debug_state and new glibc
On Mon, 11 Oct 2004 13:55:25 -0400
Daniel Jacobowitz <drow@false.org> wrote:
> On Mon, Oct 11, 2004 at 10:46:47AM -0700, Kevin Buettner wrote:
>
> > I can't think of any reason. I'm guessing that it was more expedient
> > for the original authors of the code to do it the way it was done.
> > In any case, I know of no reason not to change it so that it's done
> > "properly".
>
> We set the breakpoint on _dl_debug_state before starting the inferior.
> _dl_debug_initialize initializes _r_debug somewhat later... I'm not
> sure how it is supposed to be used. Do either of you know?
Ah! Perhaps that's the reason why _dl_debug_state was used directly.
I ran into this problem when I wrote the FR-V's solib code. (Due to
the fact that text and data are independetly relocated, the code in
solib-svr4.c couldn't be used.) The symbol in question was not
exported and could only be accessed from the r_debug struct. But as you
say, it's value wasn't immediately available. So, we set the solib
event breakpoint on the executable's entry point (probably _start).
Once this breakpoint was hit, the data structures in question had been
initialized, and so we reset it to the address determined by examining
the r_debug struct.
I suspect that a similar strategy could be used for solib-svr4.c.
Kevin