Re: [RFA] Find and read symbol files after attach (linux)

Michael Snyder
2002-01-08T23:15:31Z

Daniel Jacobowitz wrote:
>
> On Tue, Jan 08, 2002 at 09:58:06AM -0800, Michael Snyder wrote:
> > Daniel Jacobowitz wrote:
> > >
> > > On Mon, Jan 07, 2002 at 04:40:00PM -0800, Michael Snyder wrote:
> > > > [oops, hit send too soon...]
> > > > This change allows GDB to find and read the symbol files (including
> > > > all shared libraries) on Linux when you attach to an anonymous PID.
> > > > It should work for all Linuxen, but for now I've only added it to the
> > > > linux.mh and nm-linux.h files in config/i386. Please feel free to
> > > > add it to your targets.
> > >
> > > [without actually looking at it...]
> > >
> > > (A) Is there any reason not to do it for all Linuxen in
> > > config/nm-linux.h?
> >
> > Probably can. I was being conservative.
>
> I'd prefer you to do this, then. I believe it will work.
>
> > > (B) Why do we need /proc to do this? We should be able to use the
> > > information in the link map - which we already access in solib-svr4.h -
> > > to get all of this.
> >
> > There may be another method of doing it -- I just used the
> > method I know (copied from Solaris). We need to discover
> > the mapped memory regions so you can find the "debug_base".
> > But this isn't one of my strong areas, so you may well know
> > a better way to do the same thing.
>
> Well, Mark's comment is completely correct. Eventually I remembered
> that this works by looking up data at _DYNAMIC, which means we need the
> executable first :)
>
> I believe that we should be able to find the rest of what we need by
> the shared library code, without the mappings file, though. I also
> thought that this would just 'work'. Have you tried with the code to
> find the executable but without the code to find shared libraries?
> What happens?

Oops, I answered "yes, it works", but my email is out to lunch.
Yes, it works. Submitted separately, approved, and checked in.