FreeBSD/Linux Kernel Cross Reference
sys/pci/locate.pl
1 #!/usr/bin/perl
2
3 $errpos = hex($ARGV[0])/4;
4 $ofs=0;
5
6 open (INPUT, "cc -E ncr.c 2>/dev/null |");
7
8 while ($_ = <INPUT>)
9 {
10 last if /^struct script \{/;
11 }
12
13 while ($_ = <INPUT>)
14 {
15 last if /^\}\;/;
16 ($label, $size) = /ncrcmd\s+(\S+)\s+\[([^]]+)/;
17 $size = eval($size);
18 if ($label) {
19 if ($errpos) {
20 if ($ofs + $size > $errpos) {
21 printf ("%4x: %s\n", $ofs * 4, $label);
22 printf ("%4x: %s + %d\n", $errpos * 4, $label, $errpos - $ofs);
23 last;
24 }
25 $ofs += $size;
26 } else {
27 printf ("%4x: %s\n", $ofs * 4, $label);
28 }
29 }
30 }
31
Cache object: db0f060c2a0d1439580553c4a36d19bf
|