This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _r_debug_state getting screwed on x86_64 ?


On Mon, Jul 20, 2009 at 2:03 PM, Daniel Jacobowitz<drow@false.org> wrote:
>> (gdb) si
>> warning: Temporarily disabling breakpoints for unloaded shared library "../ldso"
>> Stopped due to shared library event
>
> This is your problem. ÂYou're supposed to have ldso in the list
> already.

ha, I see: thanks for putting me on the right track.

1) gdb initializes its linkmap from the inferior's PT_INTERP (coming
from its auxv)
2) when the dynamic loader calls _r_debug_state for the first time,
gdb iterates over the linkmap and assumes that any item which is
present in its own linkmap and which is not present in the inferior's
linkmap has been unloaded.

In my case, the filename of the ldso entry in the inferior's linkmap
did not match _exactly_ the inferior's main PT_INTERP so, gdb wrongly
assumed it was unloaded. Then, it disabled the breakpoint from the
inferior's _r_debug_state, hence, leaving around the int3 I observed
below.

>
>> ------------ and, yes, we can see the gdb int3 instruction in the
>> function. -------------
>
> And that's not a feature. ÂYou should never be able to observe gdb's
> software breakpoints by reading memory with GDB; if you do, it means
> something has already gone wrong.

I just had to adjust the filename field of my inferior's ldso entry in
the linkmap, and, gone were the crashes :)

Mathieu
-- 
Mathieu Lacage <mathieu.lacage@gmail.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]