mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-10 12:02:33 +01:00
compiler_vm: watchdog wraps more gdb output with <>
This commit is contained in:
parent
56bd0e9101
commit
e3ec59322e
@ -13,7 +13,7 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 356,
|
||||
BUILD_REVISION => 357,
|
||||
BUILD_DATE => "2012-02-03",
|
||||
};
|
||||
|
||||
|
@ -33,7 +33,7 @@ sub pretty {
|
||||
my $code = join '', @_;
|
||||
my $result;
|
||||
|
||||
my $pid = open2(\*IN, \*OUT, 'astyle -Upf');
|
||||
my $pid = open2(\*IN, \*OUT, 'astyle -Ujpf');
|
||||
print OUT "$code\n";
|
||||
close OUT;
|
||||
while(my $line = <IN>) {
|
||||
@ -736,13 +736,12 @@ if($output =~ m/^\s*$/) {
|
||||
$output =~ s/\(gdb\)//g;
|
||||
$output =~ s/", '\\(\d{3})' <repeats \d+ times>,? ?"/\\$1/g;
|
||||
$output =~ s/, '\\(\d{3})' <repeats \d+ times>\s*//g;
|
||||
print FILE $output, "\n";
|
||||
$output =~ s/(\\000)+/\\0/g;
|
||||
$output =~ s/\\0[^">]+/\\0/g;
|
||||
#$output =~ s/(\\\d{3})+//g;
|
||||
$output =~ s/\\0"/"/g;
|
||||
$output =~ s/"\\0/"/g;
|
||||
$output =~ s/\.\.\.>/>/g;
|
||||
$output =~ s/(\\\d{3})+//g;
|
||||
}
|
||||
|
||||
unless($got_run) {
|
||||
|
@ -7,7 +7,7 @@ use IPC::Open2;
|
||||
|
||||
my $stdin_input = join ' ', @ARGV;
|
||||
|
||||
my $debug = 5;
|
||||
my $debug = 0;
|
||||
|
||||
my $watching = 0;
|
||||
my $got_output = 0;
|
||||
@ -54,22 +54,18 @@ sub execute {
|
||||
while(my $line = <$out>) {
|
||||
chomp $line;
|
||||
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;
|
||||
while($line =~ m/(.)/g) {
|
||||
my $char = $1;
|
||||
if($char eq '{') {
|
||||
$bracket++;
|
||||
} elsif($char eq '}') {
|
||||
$bracket--;
|
||||
my ($line_number) = $line =~ m/^(\d+)/g;
|
||||
while($line =~ m/(.)/g) {
|
||||
my $char = $1;
|
||||
if($char eq '{') {
|
||||
$bracket++;
|
||||
} elsif($char eq '}') {
|
||||
$bracket--;
|
||||
|
||||
if($bracket == 0 and not $main_ended) {
|
||||
$break = $line_number;
|
||||
$main_ended = 1;
|
||||
last;
|
||||
}
|
||||
if($bracket == 0 and not $main_ended) {
|
||||
$break = $line_number;
|
||||
$main_ended = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,7 +81,7 @@ sub execute {
|
||||
if($line =~ m/^Breakpoint \d+, main/) {
|
||||
my $line = <$out>;
|
||||
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) {
|
||||
print "no output, checking locals\n" if $debug >= 5;
|
||||
print $in "print \"Go.\"\ninfo locals\nprint \"Ok.\"\n";
|
||||
@ -213,24 +209,19 @@ sub execute {
|
||||
while(my $line = <$out>) {
|
||||
chomp $line;
|
||||
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;
|
||||
while($line =~ m/(.)/g) {
|
||||
my $char = $1;
|
||||
if($char eq '{') {
|
||||
$bracket++;
|
||||
} elsif($char eq '}') {
|
||||
$bracket--;
|
||||
my ($line_number) = $line =~ m/^(\d+)/g;
|
||||
while($line =~ m/(.)/g) {
|
||||
my $char = $1;
|
||||
if($char eq '{') {
|
||||
$bracket++;
|
||||
} elsif($char eq '}') {
|
||||
$bracket--;
|
||||
|
||||
if($bracket == 0 and not $func_ended) {
|
||||
print $in "break $line_number\n";
|
||||
print "func ended, breaking at $line_number\n" if $debug >= 5;
|
||||
$func_ended = 1;
|
||||
last;
|
||||
}
|
||||
if($bracket == 0 and not $func_ended) {
|
||||
print $in "break $line_number\n";
|
||||
print "func ended, breaking at $line_number\n" if $debug >= 5;
|
||||
$func_ended = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -247,21 +238,26 @@ sub execute {
|
||||
}
|
||||
|
||||
print $in "$command\nprint \"Ok.\"\n";
|
||||
my $next_line = <$out>;
|
||||
chomp $next_line;
|
||||
print "nextline: $next_line\n" if $debug >= 1;
|
||||
while(my $next_line = <$out>) {
|
||||
chomp $next_line;
|
||||
print "nextline: $next_line\n" if $debug >= 1;
|
||||
|
||||
$next_line =~ s/^\(gdb\)\s*\(gdb\)\s+\$\d+ = "Ok."//;
|
||||
$next_line =~ s/^\(gdb\)\s+\$\d+//;
|
||||
$next_line =~ s/^\(gdb\)\s+type//;
|
||||
last if $next_line =~ m/\$\d+ = "Ok."/;
|
||||
$next_line =~ s/^\(gdb\)\s*\(gdb\)\s+\$\d+ = "Ok."//;
|
||||
$next_line =~ s/^\(gdb\)\s+\$\d+//;
|
||||
$next_line =~ s/^\(gdb\)\s+type//;
|
||||
$next_line =~ s/^\(gdb\)\s*//;
|
||||
|
||||
if(not $ignore_response) {
|
||||
if($next_line =~ m/=/) {
|
||||
$got_output = 1;
|
||||
print "<$args$next_line>\n";
|
||||
} else {
|
||||
print "<$next_line>\n" if length $next_line;
|
||||
$got_output = 1 if length $next_line;
|
||||
next if not length $next_line;
|
||||
|
||||
if(not $ignore_response) {
|
||||
if($next_line =~ m/=/) {
|
||||
$got_output = 1;
|
||||
print "<$args$next_line>\n";
|
||||
} else {
|
||||
$got_output = 1;
|
||||
print "<$next_line>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user