compiler_vm: updated to run properly on Linux; untested on Cygwin

This commit is contained in:
Pragmatic Software 2011-02-02 07:46:03 +00:00
parent be8c03ba27
commit c8bc14183b
6 changed files with 19 additions and 8 deletions

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 292,
BUILD_DATE => "2011-01-31",
BUILD_REVISION => 298,
BUILD_DATE => "2011-02-01",
};
1;

View File

@ -28,6 +28,7 @@ sub vm_stop {
my $pid = shift @_;
return if not defined $pid;
kill 'TERM', $pid;
waitpid($pid, 0);
}
sub vm_start {
@ -38,7 +39,9 @@ sub vm_start {
}
if($pid == 0) {
exec('"/cygdrive/c/Program Files (x86)\QemuManager\qemu\qemu-system-x86_64.exe" -L "C:\Program Files (x86)\QemuManager\qemu" -M "pc" -m 512 -cpu "qemu64" -vga cirrus -drive "file=C:\Program Files (x86)\QemuManager\images\Test.qcow2,index=0,media=disk" -enable-kqemu -kernel-kqemu -net none -localtime -serial "tcp:127.0.0.1:4444,server,nowait" -monitor "tcp:127.0.0.1:4445,server,nowait" -kernel-kqemu -loadvm 1 -nographic');
my $command = 'qemu-system-x86_64 -M pc -hda /home/compiler/compiler-vm-image -m 128 -monitor tcp:127.0.0.1:4445,server,nowait -serial tcp:127.0.0.1:4444,server,nowait -boot c -loadvm 2 -nographic';
my @command_list = split / /, $command;
exec(@command_list);
} else {
return $pid;
}
@ -58,7 +61,7 @@ sub execute {
my $pid = open(my $fh, '-|', "$cmdline 2>&1");
local $SIG{ALRM} = sub { print "Time out\n"; kill 'TERM', $pid; die "Timed-out\n"; };
alarm(6);
alarm(5);
while(my $line = <$fh>) {
$result .= $line;

View File

@ -73,7 +73,7 @@ sub compile {
$pid = open2($compiler_output, $compiler, './compiler_vm_server.pl') || die "repl failed: $@\n";
print "Started compiler, pid: $pid\n";
} else {
$compiler = IO::Socket::INET->new(PeerAddr => '127.0.0.1', PeerPort => '4444', Proto => 'tcp', Type => 'SOCK_STREAM');
$compiler = IO::Socket::INET->new(PeerAddr => '127.0.0.1', PeerPort => '4444', Proto => 'tcp', Type => SOCK_STREAM);
die "Could not create socket: $!" unless $compiler;
$compiler_output = $compiler;
}

View File

@ -95,9 +95,17 @@ sub debug_program {
next if $line =~ /in main\s*\(/;
$line =~ s/\s*0x[0-9a-fA-F]+\s*//;
$result .= "$line ";
$line =~ s/\s+at .*:\d+//;
if($line !~ m/^\s*in\s+/) {
$result = "in $line from ";
} else {
$result .= "$line at ";
}
}
elsif($line =~ s/^\d+//) {
next if $line =~ /No such file/;
$result .= "at " if not length $result;
$result .= "statement: $line";
last;

View File

@ -1 +1 @@
"/cygdrive/c/Program Files (x86)\QemuManager\qemu\qemu-system-x86_64.exe" -L "C:\Program Files (x86)\QemuManager\qemu" -M "pc" -m 512 -cpu "qemu64" -vga cirrus -drive "file=C:\Program Files (x86)\QemuManager\images\Test.qcow2,index=0,media=disk" -enable-kqemu -kernel-kqemu -net none -localtime -serial "tcp:127.0.0.1:4444,server,nowait" -monitor "tcp:127.0.0.1:4445,server,nowait" -kernel-kqemu -loadvm 1
qemu-system-x86_64 -M pc -hda /home/compiler/compiler-vm-image -m 128 -monitor "tcp:127.0.0.1:4445,server,nowait" -serial "tcp:127.0.0.1:4444,server,nowait" -boot c -loadvm 2

View File

@ -1 +1 @@
"/cygdrive/c/Program Files (x86)\QemuManager\qemu\qemu-system-x86_64.exe" -L "C:\Program Files (x86)\QemuManager\qemu" -M "pc" -m 512 -cpu "qemu64" -vga cirrus -drive "file=C:\Program Files (x86)\QemuManager\images\Test.qcow2,index=0,media=disk" -enable-kqemu -net nic,vlan=0,macaddr=52-54-00-F0-EC-8D,model=rtl8139 -net user,vlan=0 -localtime -serial "tcp:127.0.0.1:4444,server,nowait" -monitor "tcp:127.0.0.1:4445,server,nowait" -loadvm 1
qemu-system-x86_64 -M pc -hda /home/compiler/compiler-vm-image -m 128 -monitor "tcp:127.0.0.1:4445,server,nowait" -serial "tcp:127.0.0.1:4444,server,nowait" -net nic,vlan=0 -net user,vlan=0,hostname=compiler -boot c -loadvm 2