about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-24 01:34:10 +0000
committerRoland McGrath <roland@gnu.org>1996-01-24 01:34:10 +0000
commitfd86137937b2be15f18c6564f39aa51fd0c48b00 (patch)
treedc7bfce2017d697a0d04ddd170f27840151fdf64 /elf
parent1d8dc4293f772369e2da018ba5f1bf6e67967f3a (diff)
downloadglibc-fd86137937b2be15f18c6564f39aa51fd0c48b00.tar.gz
glibc-fd86137937b2be15f18c6564f39aa51fd0c48b00.tar.xz
glibc-fd86137937b2be15f18c6564f39aa51fd0c48b00.zip
(dl_main): Support additional args in --list mode for debugging: look them up as symbol names and print values.
Diffstat (limited to 'elf')
-rw-r--r--elf/rtld.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 070febc59f..aa004f325e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -300,6 +300,8 @@ of this helper program; chances are you did not intend to run this program.\n",
 	     functions we call below for output may no longer work properly
 	     after relocation.  */
 
+	  int i;
+
 	  if (! _dl_loaded->l_info[DT_NEEDED])
 	    _dl_sysdep_message ("\t", "statically linked\n", NULL);
 	  else
@@ -314,6 +316,25 @@ of this helper program; chances are you did not intend to run this program.\n",
 				    " (0x", bp, ")\n", NULL);
 	      }
 
+	  for (i = 1; i < _dl_argc; ++i)
+	    {
+	      const Elf32_Sym *ref = NULL;
+	      Elf32_Addr loadbase = _dl_lookup_symbol (_dl_argv[i], &ref,
+						       _dl_loaded, "argument",
+						       1);
+	      char buf[20], *bp;
+	      buf[sizeof buf - 1] = '\0';
+	      bp = _itoa (ref->st_value, &buf[sizeof buf - 1], 16, 0);
+	      while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2)
+		*--bp = '0';
+	      _dl_sysdep_message (_dl_argv[i], " found at 0x", bp, NULL);
+	      buf[sizeof buf - 1] = '\0';
+	      bp = _itoa (loadbase, &buf[sizeof buf - 1], 16, 0);
+	      while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2)
+		*--bp = '0';
+	      _dl_sysdep_message (" in object at 0x", bp, "\n", NULL);
+	    }
+
 	  _exit (0);
 	}