summary refs log tree commit diff
path: root/malloc/mtrace.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-07 13:40:55 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-07 13:40:55 +0000
commit604510f7170a912e7abd352d61b7686445216904 (patch)
tree60e34c2f1a07ef310b4bcbce0c8d20a389964ca8 /malloc/mtrace.c
parent0163d97b8c55bc320c7d867d02ca37badabd1f7c (diff)
downloadglibc-604510f7170a912e7abd352d61b7686445216904.tar.gz
glibc-604510f7170a912e7abd352d61b7686445216904.tar.xz
glibc-604510f7170a912e7abd352d61b7686445216904.zip
Update.
1998-10-07  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-open.c (_dl_global_scope_alloc): Make global.
	(dl_open_worker): Use realloc, not malloc to resize array.
	* elf/rtld.c (_dl_initial_searchlist): New variable.
	(_dl_main): Copy content of _dl_main_searchlist to
	_dl_initial_searchlist.
	* elf/ldsodefs.h: Add declarations for _dl_initial_searchlist and
	_dl_global_scope_alloc.
	* elf/Versions [libc, GLIBC_2.1]: Add _dl_initial_searchlist.
	* elf/dl-close.c (_dl_close): When removing object with global
	scope remove allocated searchlist if no dynamically loaded object
	is on it anymore.
	* elf/dl-support.c (_dl_initial_searchlist): Renamed from fake_scope.
	(_dl_global_scope, _dl_main_searchlist): Use _dl_initial_searchlist.

	* malloc/mtrace.c (tr_where): Don't print space in location string,
	print it afterwards.  Print better symbol name information.
Diffstat (limited to 'malloc/mtrace.c')
-rw-r--r--malloc/mtrace.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 86f89540d4..02da0ae764 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -97,11 +97,22 @@ tr_where (caller)
       Dl_info info;
       if (_dl_addr (caller, &info))
 	{
-	  fprintf (mallstream, "@ %s%s%s%s%s[%p]",
+	  char *buf = (char *) "";
+	  if (info.dli_sname && info.dli_sname[0])
+	    {
+	      size_t len = strlen (info.dli_sname) + 22;
+	      buf = alloca (len);
+	      if (caller >= (const __ptr_t) info.dli_saddr)
+		snprintf (buf, len, "(%s+0x%x)", info.dli_sname,
+			  caller - (const __ptr_t) info.dli_saddr);
+	      else
+		snprintf (buf, len, "(%s-0x%x)", info.dli_sname,
+			  (const __ptr_t) info.dli_saddr - caller);
+	    }
+
+	  fprintf (mallstream, "@ %s%s%s[%p] ",
 		   info.dli_fname ?: "", info.dli_fname ? ":" : "",
-		   info.dli_sname ? "(" : "",
-		   info.dli_sname ?: "", info.dli_sname ? ") " : " ",
-		   caller);
+		   buf, caller);
 	}
       else
 #endif