3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-25 11:34:15 +01:00

compiler_vm: watchdog wraps more gdb output with <>

This commit is contained in:
Pragmatic Software 2012-02-04 06:02:52 +00:00
parent 56bd0e9101
commit e3ec59322e
3 changed files with 46 additions and 51 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 356, BUILD_REVISION => 357,
BUILD_DATE => "2012-02-03", BUILD_DATE => "2012-02-03",
}; };

View File

@ -33,7 +33,7 @@ sub pretty {
my $code = join '', @_; my $code = join '', @_;
my $result; my $result;
my $pid = open2(\*IN, \*OUT, 'astyle -Upf'); my $pid = open2(\*IN, \*OUT, 'astyle -Ujpf');
print OUT "$code\n"; print OUT "$code\n";
close OUT; close OUT;
while(my $line = <IN>) { while(my $line = <IN>) {
@ -736,13 +736,12 @@ if($output =~ m/^\s*$/) {
$output =~ s/\(gdb\)//g; $output =~ s/\(gdb\)//g;
$output =~ s/", '\\(\d{3})' <repeats \d+ times>,? ?"/\\$1/g; $output =~ s/", '\\(\d{3})' <repeats \d+ times>,? ?"/\\$1/g;
$output =~ s/, '\\(\d{3})' <repeats \d+ times>\s*//g; $output =~ s/, '\\(\d{3})' <repeats \d+ times>\s*//g;
print FILE $output, "\n";
$output =~ s/(\\000)+/\\0/g; $output =~ s/(\\000)+/\\0/g;
$output =~ s/\\0[^">]+/\\0/g; $output =~ s/\\0[^">]+/\\0/g;
#$output =~ s/(\\\d{3})+//g;
$output =~ s/\\0"/"/g; $output =~ s/\\0"/"/g;
$output =~ s/"\\0/"/g; $output =~ s/"\\0/"/g;
$output =~ s/\.\.\.>/>/g; $output =~ s/\.\.\.>/>/g;
$output =~ s/(\\\d{3})+//g;
} }
unless($got_run) { unless($got_run) {

View File

@ -7,7 +7,7 @@ use IPC::Open2;
my $stdin_input = join ' ', @ARGV; my $stdin_input = join ' ', @ARGV;
my $debug = 5; my $debug = 0;
my $watching = 0; my $watching = 0;
my $got_output = 0; my $got_output = 0;
@ -54,9 +54,6 @@ sub execute {
while(my $line = <$out>) { while(my $line = <$out>) {
chomp $line; chomp $line;
print "list got: [$line]\n" if $debug >= 4; print "list got: [$line]\n" if $debug >= 4;
if(not $main_ended and $line =~ m/^(\d+)\s+return 0;/) {
$break = $1;
} else {
my ($line_number) = $line =~ m/^(\d+)/g; my ($line_number) = $line =~ m/^(\d+)/g;
while($line =~ m/(.)/g) { while($line =~ m/(.)/g) {
my $char = $1; my $char = $1;
@ -72,7 +69,6 @@ sub execute {
} }
} }
} }
}
last if $line =~ m/^\(gdb\) \$\d+ = "Ok."/; last if $line =~ m/^\(gdb\) \$\d+ = "Ok."/;
} }
@ -85,7 +81,7 @@ sub execute {
if($line =~ m/^Breakpoint \d+, main/) { if($line =~ m/^Breakpoint \d+, main/) {
my $line = <$out>; my $line = <$out>;
print "== got: $line\n" if $debug >= 5; print "== got: $line\n" if $debug >= 5;
if($line =~ m/^\d+\s+return 0;\s*$/ or $line =~ m/^\d+\s+}\s*$/) { if($line =~ m/^\d+\s+return.*?;\s*$/ or $line =~ m/^\d+\s+}\s*$/) {
if($got_output == 0) { if($got_output == 0) {
print "no output, checking locals\n" if $debug >= 5; print "no output, checking locals\n" if $debug >= 5;
print $in "print \"Go.\"\ninfo locals\nprint \"Ok.\"\n"; print $in "print \"Go.\"\ninfo locals\nprint \"Ok.\"\n";
@ -213,10 +209,6 @@ sub execute {
while(my $line = <$out>) { while(my $line = <$out>) {
chomp $line; chomp $line;
print "list break got: [$line]\n" if $debug >= 4; print "list break got: [$line]\n" if $debug >= 4;
if(not $func_ended and $line =~ m/^(\d+)\s+return(.*?);/) {
print "breaking at $1\n" if $debug >= 5;
print $in "break $1\n";
} else {
my ($line_number) = $line =~ m/^(\d+)/g; my ($line_number) = $line =~ m/^(\d+)/g;
while($line =~ m/(.)/g) { while($line =~ m/(.)/g) {
my $char = $1; my $char = $1;
@ -233,7 +225,6 @@ sub execute {
} }
} }
} }
}
last if $line =~ m/^\(gdb\) \$\d+ = "Ok."/; last if $line =~ m/^\(gdb\) \$\d+ = "Ok."/;
} }
@ -247,21 +238,26 @@ sub execute {
} }
print $in "$command\nprint \"Ok.\"\n"; print $in "$command\nprint \"Ok.\"\n";
my $next_line = <$out>; while(my $next_line = <$out>) {
chomp $next_line; chomp $next_line;
print "nextline: $next_line\n" if $debug >= 1; print "nextline: $next_line\n" if $debug >= 1;
last if $next_line =~ m/\$\d+ = "Ok."/;
$next_line =~ s/^\(gdb\)\s*\(gdb\)\s+\$\d+ = "Ok."//; $next_line =~ s/^\(gdb\)\s*\(gdb\)\s+\$\d+ = "Ok."//;
$next_line =~ s/^\(gdb\)\s+\$\d+//; $next_line =~ s/^\(gdb\)\s+\$\d+//;
$next_line =~ s/^\(gdb\)\s+type//; $next_line =~ s/^\(gdb\)\s+type//;
$next_line =~ s/^\(gdb\)\s*//;
next if not length $next_line;
if(not $ignore_response) { if(not $ignore_response) {
if($next_line =~ m/=/) { if($next_line =~ m/=/) {
$got_output = 1; $got_output = 1;
print "<$args$next_line>\n"; print "<$args$next_line>\n";
} else { } else {
print "<$next_line>\n" if length $next_line; $got_output = 1;
$got_output = 1 if length $next_line; print "<$next_line>\n";
}
} }
} }