Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [patch] solib do not add ldd if in libc
Date: Tue, 07 Jul 2009 17:44:00 -0000	[thread overview]
Message-ID: <h301hr$dlb$1@ger.gmane.org> (raw)
In-Reply-To: <h2vs39$pvq$1@ger.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

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.


[-- Attachment #2: solib-svr4-ldsomap-20090707.diff --]
[-- Type: text/x-patch, Size: 931 bytes --]

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);
     }

  reply	other threads:[~2009-07-07 17:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-07 16:11 Aleksandar Ristovski
2009-07-07 17:44 ` Aleksandar Ristovski [this message]
2009-07-21 15:40   ` Aleksandar Ristovski
2009-07-21 18:13     ` Daniel Jacobowitz
2009-07-20 14:09 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='h301hr$dlb$1@ger.gmane.org' \
    --to=aristovski@qnx.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox