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

Pedro Alves
2012-06-01T17:37:42Z

On 06/01/2012 06:22 PM, Jan Kratochvil wrote:

> On Fri, 01 Jun 2012 18:21:28 +0200, Pedro Alves wrote:
>> --- a/gdb/solib-svr4.c
>> +++ b/gdb/solib-svr4.c
>> @@ -1707,7 +1707,7 @@ enable_break (struct svr4_info *info, int from_tty)
>> }
>> }
>>
>> - if (!current_inferior ()->attach_flag)
>> + if (interp_name != NULL && !current_inferior ()->attach_flag)
>> {
>> for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
>> {
>
> It has a regression in the case below.
>
> OTOH one has to strip _start to make it a regression as with _start GDB did not
> catch startup libraries even before.

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.)

--
Pedro Alves