Bochs/bochs/bios/makesym.perl

44 lines
921 B
Plaintext
Raw Normal View History

#!/usr/bin/perl
#
2009-12-30 23:28:23 +03:00
# $Id: makesym.perl,v 1.3 2009-12-30 20:28:23 sshwarts Exp $
#
2008-01-26 12:15:27 +03:00
# Read output file from as86 (e.g. rombios.txt) and write out a symbol
# table suitable for the Bochs debugger.
#
2009-12-30 23:28:23 +03:00
use strict;
use warnings;
2009-12-30 23:28:23 +03:00
my $WHERE_BEFORE_SYM_TABLE = 0;
my $WHERE_IN_SYM_TABLE = 1;
my $WHERE_AFTER_SYM_TABLE = 2;
my $where = $WHERE_BEFORE_SYM_TABLE;
while (<STDIN>) {
chop;
2009-12-30 23:28:23 +03:00
if ($where == $WHERE_BEFORE_SYM_TABLE && /^Symbols:/) {
$where = $WHERE_IN_SYM_TABLE;
} elsif ($where == $WHERE_IN_SYM_TABLE && /^$/) {
$where = $WHERE_AFTER_SYM_TABLE;
}
if ($where == $WHERE_IN_SYM_TABLE) {
2009-12-30 23:28:23 +03:00
my $name;
my $junk;
foreach my $f (split(/\s+/)) {
if ($f =~ /^[[:xdigit:]]{4,}$/) {
if (defined($name)) {
print '000f', lc($f), ' ', $name, "\n";
undef($name);
undef($junk);
next;
}
}
$name = $junk
if (defined($junk));
$junk = $f;
}
}
}
2009-12-30 23:28:23 +03:00
exit(0);