This is the mail archive of the
mailing list for the GDB project.
Re: auto-solib-add when attaching to inferior
> > Remember that you don't use attach with the normal remote protocol.
> > When you to_open the target has already started. For your agent it
> > sounds like you need to do it at to_attach time; but why isn't the one
> > in infcmd.c:attach_command working?
> Good question. For some reason locate_base() seems to be failing. Maybe
> that's the answer to the puzzle. It looks like the SOLIB_ADD() in
> attach_command() should do the right thing. I'll chase it deeper from
Well, I think I've found the cause but only part of the solution. When
solib-svr4.c:elf_locate_base() is called, the dynamic pointer stored in the
DT_DEBUG section is zero. This is because QNX has a util called 'on' which
can spawn a process in a 'held' state where it's stopped on the very first
instruction. This is handy if you want to attach to a process before it
gets going but in this case, the loader hasn't been run yet so the DT_DEBUG
section isn't filled in. If I attach to a process that is running properly,
I get my solibs loaded up and everything is fine.
This, however, presents the next problem: the shlib_event breakpoint not
being set. On our native gdb, if I just add a SOLIB_CREATE_INFERIOR_HOOK
call to the attach function, it works properly. The remote is another case.
I'm still thinking it's a sync issue with the debug agent though.
Thanks for the help. You definitely got me barking up the right tree.