about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-06 17:21:35 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-06 17:21:35 +0000
commitac8e29977aac325fc9223ae38326a0ece7a74101 (patch)
treebbc59e266e6a4cd686c9193cbf6f2980785f536a /sysdeps
parent8eaaffdeedf5a34a68a785e62b181e4e5fc6cf43 (diff)
downloadglibc-ac8e29977aac325fc9223ae38326a0ece7a74101.tar.gz
glibc-ac8e29977aac325fc9223ae38326a0ece7a74101.tar.xz
glibc-ac8e29977aac325fc9223ae38326a0ece7a74101.zip
Update.
1998-07-06  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/elf/backtracesyms.c (__backtrace_symbols):
	Improve generated strings a bit.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/elf/backtracesyms.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sysdeps/generic/elf/backtracesyms.c b/sysdeps/generic/elf/backtracesyms.c
index 4147d956eb..7de0bfc9ee 100644
--- a/sysdeps/generic/elf/backtracesyms.c
+++ b/sysdeps/generic/elf/backtracesyms.c
@@ -53,7 +53,7 @@ __backtrace_symbols (array, size)
 	   "<fct-name>(<sym-name>)[+offset].  */
 	total += (strlen (info[cnt].dli_fname ?: "")
 		  + (info[cnt].dli_sname
-		     ? strlen (info[cnt].dli_sname) + 3
+		     ? strlen (info[cnt].dli_sname) + 3 + WORD_WIDTH + 3
 		     : 1)
 		  + WORD_WIDTH + 6);
       else
@@ -72,12 +72,22 @@ __backtrace_symbols (array, size)
 
 	  if (status[cnt] && info[cnt].dli_fname
 	      && info[cnt].dli_fname[0] != '\0')
-	    last += 1 + sprintf (last, "%s%s%s%s[+%p]",
-				 info[cnt].dli_fname ?: "",
-				 info[cnt].dli_sname ? "(" : "",
-				 info[cnt].dli_sname ?: "",
-				 info[cnt].dli_sname ? ") " : " ",
-				 info[cnt].dli_fbase);
+	    {
+	      char buf[20];
+
+	      if (array[cnt] >= (void *) info[cnt].dli_saddr)
+		sprintf (buf, "+0x%x", array[cnt] - info[cnt].dli_saddr);
+	      else
+		sprintf (buf, "-0x%x", info[cnt].dli_saddr - array[cnt]);
+
+	      last += 1 + sprintf (last, "%s%s%s%s%s[+%p]",
+				   info[cnt].dli_fname ?: "",
+				   info[cnt].dli_sname ? "(" : "",
+				   info[cnt].dli_sname ?: "",
+				   info[cnt].dli_sname ? buf : "",
+				   info[cnt].dli_sname ? ") " : " ",
+				   array[cnt]);
+	    }
 	  else
 	    last += 1 + sprintf (last, "[+%p]", array[cnt]);
 	}