Re: [PATCH] solib-svr4: Avoid unwanted shlib internal BPs When debugging Linux kernel or u-boot

Jan Kratochvil
2012-06-01T18:05:19Z

On Fri, 01 Jun 2012 19:37:22 +0200, Pedro Alves wrote:
> Yeah, that's a really contrived example. You're relying on stopping at main,
> not when the DSO is really loaded (_dl_debug_state) to set the breakpoint.
> I can see _start not existing, with the entry point named something else,
> but if you strip your static binary to miss _dl_debug_state, you won't get
> main either. (and then static binaries that dlopen aren't something you'd
> want to do normally.)

I do not have to strip the binary to not have _dl_debug_state, there are many
libc implementations out there and I guess they are not all compatible with
the "_dl_debug_state" naming. I guess this is also the reason why GDB knows
so many names for it:
"r_debug_state",
"_r_debug_state",
"_dl_debug_state",
"rtld_db_dlactivity",
"__dl_rtld_db_dlactivity",
"_rtld_debug_state",

And the goal of this non-ld.so breakpoint is that most of programs loads
libraries only during its init, before main, therefore a breakpoint at "main"
should catch them all.

OTOH as I said current GDB will place the breakpoint to _start first and it
will miss those libraries anyway. So it is not a regression.

Also nowadays some 3rd party runtime probably more adapts to GDB than vice
verse.

Regards,
Jan