From 6a904bbfc610f98ee2f467844434117a7bca5982 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 27 Jul 2001 07:33:58 +0000 Subject: [PATCH] Update. 2001-07-27 Ulrich Drepper * malloc/mtrace.pl: Extract addresses from DSOs. 2001-07-26 Ulrich Drepper * 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 --- ChangeLog | 13 +++++++++++++ malloc/mtrace.pl | 29 ++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 587b2f6..2b31c40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2001-07-27 Ulrich Drepper + + * malloc/mtrace.pl: Extract addresses from DSOs. + +2001-07-26 Ulrich Drepper + + * 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 * 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 * sysdeps/sh/dl-machine.h (elf_machine_load_address): Don't use diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl index a254c6e..e3ed577 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 () { + 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 = ; chomp $line; close (ADDR); -- 2.7.4