diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | malloc/mtrace.pl | 29 |
2 files changed, 39 insertions, 3 deletions
@@ -1,3 +1,15 @@ +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. + 2001-07-27 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h (SC_GPRS): Fix @@ -17,6 +29,7 @@ * sysdeps/generic/tcsetattr.c (bad_speed): Accept those values. * termios/cfsetspeed.c (speeds): Likewise. +>>>>>>> 1.5525 2001-07-26 kaz Kojima <kkojima@rr.iij4u.or.jp> * sysdeps/sh/dl-machine.h (elf_machine_load_address): Don't use 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); |