summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-07-27 07:33:58 +0000
committerUlrich Drepper <drepper@redhat.com>2001-07-27 07:33:58 +0000
commit6a904bbfc610f98ee2f467844434117a7bca5982 (patch)
tree4d3b5d6981355f75e3c6a180dd5c9cd2d35b6695 /malloc
parentadef37445c9c4e1c134e9a2bd1ca8c70472ffb55 (diff)
downloadglibc-6a904bbfc610f98ee2f467844434117a7bca5982.tar.gz
glibc-6a904bbfc610f98ee2f467844434117a7bca5982.tar.xz
glibc-6a904bbfc610f98ee2f467844434117a7bca5982.zip
Update.
2001-07-27  Ulrich Drepper  <drepper@redhat.com>

	* malloc/mtrace.pl: Extract addresses from DSOs.

2001-07-26  Ulrich Drepper  <drepper@redhat.com>

	* malloc/mcheck.c (checkhdr): Disable mcheck before reporting an
	error.  Don't run any tests if mcheck is disabled.

	* elf/dl-support.c (_dl_important_hwcaps): Avoid using malloc
	early in the program.

>>>>>>> 1.5525
Diffstat (limited to 'malloc')
-rw-r--r--malloc/mtrace.pl29
1 files changed, 26 insertions, 3 deletions
diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index a254c6e860..e3ed5771dd 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -68,6 +68,21 @@ if ($#ARGV == 0) {
 } elsif ($#ARGV == 1) {
     $binary=$ARGV[0];
     $data=$ARGV[1];
+
+    if ($binary =~ /^.*[\/].*$/) {
+	$prog = $binary;
+    } else {
+	$prog = "./$binary";
+    }
+    if (open (LOCS, "env LD_TRACE_LOADED_OBJECTS=1 $prog |")) {
+	while (<LOCS>) {
+	    chop;
+	    if (/^.*=> (.*) .(0x[0123456789abcdef]*).$/) {
+		$locs{$1} = $2;
+	    }
+	}
+	close (LOCS);
+    }
 } else {
     die "Wrong number of arguments, run $progname --help for help.";
 }
@@ -89,10 +104,18 @@ sub location {
 	    }
 	}
 	$cache{$addr} = $str = "$fct @ $addr";
-    } elsif ($str =~ /^.*[[](0x[^]]*)]$/) {
-	my $addr = $1;
+    } elsif ($str =~ /^(.*):.*[[](0x[^]]*)]$/) {
+	my $prog = $1;
+	my $addr = $2;
+	my $searchaddr;
 	return $cache{$addr} if (exists $cache{$addr});
-	if ($binary ne "" && open (ADDR, "addr2line -e $binary $addr|")) {
+	if ($locs{$prog} ne "") {
+	    $searchaddr = sprintf "%#x", $addr - $locs{$prog};
+	} else {
+	    $searchaddr = $addr;
+	    $prog = $binary;
+	}
+	if ($binary ne "" && open (ADDR, "addr2line -e $prog $searchaddr|")) {
 	    my $line = <ADDR>;
 	    chomp $line;
 	    close (ADDR);