This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
Re: shlibs/1914: gdb does not notice dynamic library loads when attached to running process
- From: "Ewa Matejska" <Ewa dot Matejska at palmsource dot com>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 24 Nov 2005 02:58:01 -0000
- Subject: Re: shlibs/1914: gdb does not notice dynamic library loads when attached to running process
- Reply-to: "Ewa Matejska" <Ewa dot Matejska at palmsource dot com>
The following reply was made to PR shlibs/1914; it has been noted by GNATS.
From: "Ewa Matejska" <Ewa.Matejska@palmsource.com>
To: <gdb-gnats@sources.redhat.com>
Cc:
Subject: Re: shlibs/1914: gdb does not notice dynamic library loads when attached to running process
Date: Wed, 23 Nov 2005 18:54:17 -0800
This is a multi-part message in MIME format.
------_=_NextPart_001_01C5F0A2.5C3777DD
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi,
=20
I've noticed this problem as well.
My environment is Ubuntu Linux. I'm attaching a testcase and
instructions on how to reproduce the problem.
=20
This also reproduces with the CVS gdb. Looking at the source code, I
was able to add the following lines in infcmd.c:attach_command to partly
correct the problem:
=20
#ifdef SOLIB_CREATE_INFERIOR_HOOK
solib_create_inferior_hook();
#endif
=20
------------ start testcase ---------------
1. Compile the testcase. The testcase uses dlopen to open the
/usr/lib/libm.so library. Modify the testcase if you want it to open
something else.
gcc -O0 -g3 -Wall -c -fmessage-length=3D0 -oprogram.o ./program.c
gcc -odummyprogram ./program.o -ldl
This results in a testcase named "dummyprogram".
=20
2. Run this program.
=20
3. Check the pid and create a gdb session attached to that pid.
gdb ./dummyprogram pid
=20
4. Here is the gdb session which shows the problem:
=20
(gdb) info shared
From To Syms Read Shared Object
Library
0xb7fdce80 0xb7fddc70 Yes
/lib/tls/i686/libdl.so.2
0xb7ec46e0 0xb7fb44b8 Yes
/lib/tls/i686/libc.so.6
0xb7febc00 0xb7ffc54f Yes /lib/ld-linux.so.2
=20
(gdb) show auto-solib-add
Autoloading of shared library symbols is on.
=20
(gdb) b program.c:7
Breakpoint 1 at 0x8048413: file ./program.c, line 7.
=20
(gdb) b program.c:9
Breakpoint 2 at 0x8048421: file ./program.c, line 9.
=20
(gdb c)
Continuing
Breakpoint 1, main() at ./program.c:7
7 sleep(2);
=20
(gdb) set bla=3D0
=20
(gdb) c
Continuing.
Breakpoint 2, main() at ./program.c:9
9 dlopen("/usr/lib/libm.so", RTLD_NOW);
=20
(gdb) n
10 return 0;
=20
(gdb) info shared
From To Syms Read Shared Object
Library
0xb7fdce80 0xb7fddc70 Yes
/lib/tls/i686/libdl.so.2
0xb7ec46e0 0xb7fb44b8 Yes
/lib/tls/i686/libc.so.6
0xb7febc00 0xb7ffc54f Yes /lib/ld-linux.so.2
0xb7290620 0xb7ea6fd0 No /usr/lib/libm.so
=20
This shows that the symbols were not loaded for libm.so.
=20
------------End testcase ---------------------
=20
Thanks,
Ewa.
PalmSource.
------_=_NextPart_001_01C5F0A2.5C3777DD
Content-Type: application/octet-stream;
name="program.c"
Content-Transfer-Encoding: base64
Content-Description: program.c
Content-Disposition: attachment;
filename="program.c"
I2luY2x1ZGUgPGRsZmNuLmg+CiNpbmNsdWRlIDx1bmlzdGQuaD4KaW50IG1haW4oKQp7CglpbnQg
YmxhID0gMTsKCXdoaWxlKGJsYSkgewoJCXNsZWVwKDIpOwoJfQoJZGxvcGVuKCIvdXNyL2xpYi9s
aWJtLnNvIiwgUlRMRF9OT1cpOwoJcmV0dXJuIDA7Cn0K
------_=_NextPart_001_01C5F0A2.5C3777DD--