mtrace script doesn't parse mtrace() output correctly
Aharon Robbins
arnold@skeeve.com
Thu Jan 4 00:32:00 GMT 2001
>Submitter-Id: net
>Originator: Aharon Robbins
>Organization:
Aharon (Arnold) Robbins --- Pioneer Consulting Ltd. arnold@skeeve.com
P.O. Box 354 Home Phone: +972 8 979-0381 Fax: +1 603 761-6761
Nof Ayalon Cell Phone: +972 51 297-545 (See www.efax.com)
D.N. Shimshon 99785 ISRAEL
>
>Confidential: no
>Synopsis: mtrace script doesn't get file/line number info correctly
>Severity: serious
>Priority: high
>Category: libc
>Class: sw-bug
>Release: libc-2.1.92
>Environment:
Host type: i686-redhat-linux-gnu
System: Linux skeeve 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown
Architecture: i686
Addons: c_stubs glibc-compat linuxthreads soft-fp
Build CFLAGS: -march=i686 -D__USE_STRING_INLINES -fstrict-aliasing -freorder-blocks -DNDEBUG=1 -g -O3
Build CC: gcc
Compiler version: 2.96 20000731 (experimental)
Kernel headers: 2.4.0-0.26
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
The output from mtrace() isn't parsed correctly by /usr/bin/mtrace when
given both a binary name and a log file.
The regexes used in the script don't correctly match the output in order
to extract the addresses from the binary.
>How-To-Repeat:
Turn on mtrace in a program and run the script.
>Fix:
This diff seems to work for me.
*** /usr/bin/mtrace Thu Aug 31 00:55:11 2000
--- ./mtrace Thu Jan 4 10:24:45 2001
***************
*** 75,81 ****
sub location {
my $str = pop(@_);
return $str if ($str eq "");
! if ($str =~ /[[](0x[^]]*)]:(.)*/) {
my $addr = $1;
my $fct = $2;
return $cache{$addr} if (exists $cache{$addr});
--- 75,81 ----
sub location {
my $str = pop(@_);
return $str if ($str eq "");
! if ($str =~ /.*[[](0x[^]]*)]:(.)*/) {
my $addr = $1;
my $fct = $2;
return $cache{$addr} if (exists $cache{$addr});
***************
*** 89,95 ****
}
}
$cache{$addr} = $str = "$fct @ $addr";
! } elsif ($str =~ /^[[](0x[^]]*)]$/) {
my $addr = $1;
return $cache{$addr} if (exists $cache{$addr});
if ($binary ne "" && open (ADDR, "addr2line -e $binary $addr|")) {
--- 89,95 ----
}
}
$cache{$addr} = $str = "$fct @ $addr";
! } elsif ($str =~ /^.*[[](0x[^]]*)]$/) {
my $addr = $1;
return $cache{$addr} if (exists $cache{$addr});
if ($binary ne "" && open (ADDR, "addr2line -e $binary $addr|")) {
More information about the Libc-alpha
mailing list