This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: debugging a dynamically loaded library
- To: Kevin Buettner <kevinb at cygnus dot com>
- Subject: Re: debugging a dynamically loaded library
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Wed, 5 Sep 2001 22:29:50 -0700
- Cc: Mike Krogh <krogh at ceintl dot com>, gdb at sourceware dot cygnus dot com
- References: <15245.21579.555348.285018@gomer.ceintl.com> <krogh@ceintl.com> <1010829224126.ZM19874@ocotillo.lan> <20010829160725.A25904@lucon.org> <hjl@lucon.org> <1010903225850.ZM1797@ocotillo.lan>
On Mon, Sep 03, 2001 at 03:58:50PM -0700, Kevin Buettner wrote:
> On Aug 29, 4:07pm, H . J . Lu wrote:
>
> > > (gdb) b main.c:23
> > > Breakpoint 1 at 0x80487fc: file main.c, line 23.
> > > (gdb) r
> > > Starting program: /home/kev/ctests/dynlib/main
> > >
> > > Breakpoint 1, main (argc=1, argv=0xbffffa2c) at main.c:23
> > > 23 init = dlsym(handle, "dso_init");
> > > (gdb) b dso_init
> > > Breakpoint 2 at 0x400188a2: file dso.c, line 10.
> >
> > For some reason, it doesn't work for me:
> >
> > GNU gdb 2001-08-29-cvs (MI_OUT)
> > ....
> > (gdb) b main.c:23
> > Breakpoint 1 at 0x8048820: file main.c, line 23.
> > (gdb) r
> > Starting program: /home/hjl/bugs/gdb/dlopen/main
> >
> > Breakpoint 1, main (argc=1, argv=0xbffff804) at main.c:23
> > 23 init = dlsym(handle, "dso_init");
> > (gdb) b dso_init
> > Cannot access memory at address 0x123
> > (gdb) p dso_init
> > $1 = {<text variable, no debug info>} 0x40017800 <dso_init>
> > (gdb) info shared
> > >From To Syms Read Shared Object Library
> > 0x400281d0 0x40028fc0 Yes /lib/libdl.so.2
> > 0x40047400 0x40147080 Yes /lib/i686/libc.so.6
> > 0x40001eb0 0x40012f20 Yes /lib/ld-linux.so.2
> > 0x400176d0 0x400178b0 Yes ./dso.so
> >
> > I am using glibc 2.2.4 on x86. It seems that gdb doesn't add the base
> > address of ./dso.so.
>
> H. J.,
>
> Could you try
>
> http://sources.redhat.com/ml/gdb-patches/2001-09/msg00003.html
>
> and let me know if it fixes the above problem?
>
I just came back from a trip. I will give it try tomorrow. I know there
was at least one gcc bug, which generated bogus debug code for glibc.
I am wondering if
1327 FUN 0 36 00000000 31372 __strtol_internal:F(0,3)
is a valid stab entry. It it is valid, why does it trigger the
SOFUN_ADDRESS_MAYBE_MISSING code in gdb. Is that possible a linker
or assembler bug?
H.J.