This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] solib do not add ldd if in libc
- From: Aleksandar Ristovski <aristovski at qnx dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 07 Jul 2009 12:11:21 -0400
- Subject: [patch] solib do not add ldd if in libc
Hello,
On systems (QNX) that have ldd residing in libc,
svr4_current_sos will add libc twice. Once while walking the
linkmap and second time from r_ldsomap.
This patch adds check if ldsolib has already been added and
if so, prevents adding duplicate entry.
Tested on linux - i386, no regressions; however, it would be
good if someone could test for regressions on Solaris.
Thanks,
--
Aleksandar Ristovski
QNX Software Systems
* solib-svr4.c (svr4_current_sos): Do not add dynamic linker
to solist
if already added.
Index: gdb/solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.104
diff -u -p -r1.104 solib-svr4.c
--- gdb/solib-svr4.c 2 Jul 2009 17:25:58 -0000 1.104
+++ gdb/solib-svr4.c 7 Jul 2009 16:04:04 -0000
@@ -1125,7 +1125,20 @@ svr4_current_sos (void)
symbol information for the dynamic linker is quite crucial
for skipping dynamic linker resolver code. */
if (lm == 0 && ldsomap == 0)
- lm = ldsomap = solib_svr4_r_ldsomap (info);
+ {
+ struct so_list *so = head;
+
+ lm = ldsomap = solib_svr4_r_ldsomap (info);
+
+ /* On some other systems, dynamic linker resides in libc.
+ Make sure we do not add duplicated entry for it. */
+ while (so)
+ {
+ if (so->lm_info->lm_addr == lm)
+ lm = ldsomap = 0;
+ break;
+ }
+ }
discard_cleanups (old_chain);
}