This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] solib do not add ldd if in libc


Aleksandar Ristovski wrote:
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.



This time with the right patch.




--
Aleksandar Ristovski
QNX Software Systems


ChangeLog:
* 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 17:41:49 -0000
@@ -1125,7 +1125,23 @@ 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;
+		}
+	      so = so->next;
+	    }
+	}
 
       discard_cleanups (old_chain);
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]