File: symresolve

package info (click to toggle)
rtlinux 3.1pre3-3
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 4,896 kB
  • ctags: 4,228
  • sloc: ansic: 26,204; sh: 2,069; makefile: 1,414; perl: 855; tcl: 489; asm: 380; cpp: 42
file content (61 lines) | stat: -rwxr-xr-x 1,317 bytes parent folder | download | duplicates (2)
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$$";