1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#!/usr/bin/perl
#
# (C) Finite State Machine Labs Inc. 1999-2000 <business@fsmlabs.com>
#
# Released under the terms of GPL 2.
# Open RTLinux makes use of a patented process described in
# US Patent 5,995,745. Use of this process is governed
# by the Open RTLinux Patent License which can be obtained from
# www.fsmlabs.com/PATENT or by sending email to
# licensequestions@fsmlabs.com
# first, build the hash containing the resolved addresses
# we recognize addresses by angle brackets around them
# open(TEMP, /tmp/Tmp$$);
$KSYMOOPS="ksymoops";
$RTLINUX_DIR=`grep RTLINUX_DIR rtl.mk`;
$RTLINUX_DIR =~ s%.*= +(.*)\n%$1/System.map%;
$RTL_DIR=`grep RTL_DIR rtl.mk`;
$RTL_DIR =~ s%.*= +(.*)\n%$1%;
#open (TEMP, "| cat >/tmp/Tmp$$");
open (TEMP, "| $KSYMOOPS -x -o $RTL_DIR -o . -m $RTLINUX_DIR >/tmp/Tmp$$") or die "Can run ksymoops: $!";
open (TEMPCOPY, ">/tmp/TmpA$$");
while (<>) {
print TEMPCOPY $_;
print TEMP "EIP: ", $1, "\n" while m/(<[^>]*>)/gc;
}
close (TEMP);
close (TEMPCOPY);
open (TEMP, "/tmp/Tmp$$");
while (<TEMP>) {
print STDERR if /warning/i;
if (/>>EIP; ([^ ]+) (<[^>]+>)/) {
$trans{$1} = $2 ;
}
}
close (TEMP);
open(TEMPCOPY, "/tmp/TmpA$$");
# now, write out the output
while (<TEMPCOPY>) {
s/<([^>]*)>/$trans{$1}/ge;
print $_;
}
unlink "/tmp/Tmp$$";
unlink "/tmp/TmpA$$";
|