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:
parent
56bd0e9101
commit
e3ec59322e
@ -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",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
@ -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,22 +54,18 @@ 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;/) {
|
my ($line_number) = $line =~ m/^(\d+)/g;
|
||||||
$break = $1;
|
while($line =~ m/(.)/g) {
|
||||||
} else {
|
my $char = $1;
|
||||||
my ($line_number) = $line =~ m/^(\d+)/g;
|
if($char eq '{') {
|
||||||
while($line =~ m/(.)/g) {
|
$bracket++;
|
||||||
my $char = $1;
|
} elsif($char eq '}') {
|
||||||
if($char eq '{') {
|
$bracket--;
|
||||||
$bracket++;
|
|
||||||
} elsif($char eq '}') {
|
|
||||||
$bracket--;
|
|
||||||
|
|
||||||
if($bracket == 0 and not $main_ended) {
|
if($bracket == 0 and not $main_ended) {
|
||||||
$break = $line_number;
|
$break = $line_number;
|
||||||
$main_ended = 1;
|
$main_ended = 1;
|
||||||
last;
|
last;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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,24 +209,19 @@ 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(.*?);/) {
|
my ($line_number) = $line =~ m/^(\d+)/g;
|
||||||
print "breaking at $1\n" if $debug >= 5;
|
while($line =~ m/(.)/g) {
|
||||||
print $in "break $1\n";
|
my $char = $1;
|
||||||
} else {
|
if($char eq '{') {
|
||||||
my ($line_number) = $line =~ m/^(\d+)/g;
|
$bracket++;
|
||||||
while($line =~ m/(.)/g) {
|
} elsif($char eq '}') {
|
||||||
my $char = $1;
|
$bracket--;
|
||||||
if($char eq '{') {
|
|
||||||
$bracket++;
|
|
||||||
} elsif($char eq '}') {
|
|
||||||
$bracket--;
|
|
||||||
|
|
||||||
if($bracket == 0 and not $func_ended) {
|
if($bracket == 0 and not $func_ended) {
|
||||||
print $in "break $line_number\n";
|
print $in "break $line_number\n";
|
||||||
print "func ended, breaking at $line_number\n" if $debug >= 5;
|
print "func ended, breaking at $line_number\n" if $debug >= 5;
|
||||||
$func_ended = 1;
|
$func_ended = 1;
|
||||||
last;
|
last;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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;
|
||||||
|
|
||||||
$next_line =~ s/^\(gdb\)\s*\(gdb\)\s+\$\d+ = "Ok."//;
|
last if $next_line =~ m/\$\d+ = "Ok."/;
|
||||||
$next_line =~ s/^\(gdb\)\s+\$\d+//;
|
$next_line =~ s/^\(gdb\)\s*\(gdb\)\s+\$\d+ = "Ok."//;
|
||||||
$next_line =~ s/^\(gdb\)\s+type//;
|
$next_line =~ s/^\(gdb\)\s+\$\d+//;
|
||||||
|
$next_line =~ s/^\(gdb\)\s+type//;
|
||||||
|
$next_line =~ s/^\(gdb\)\s*//;
|
||||||
|
|
||||||
if(not $ignore_response) {
|
next if not length $next_line;
|
||||||
if($next_line =~ m/=/) {
|
|
||||||
$got_output = 1;
|
if(not $ignore_response) {
|
||||||
print "<$args$next_line>\n";
|
if($next_line =~ m/=/) {
|
||||||
} else {
|
$got_output = 1;
|
||||||
print "<$next_line>\n" if length $next_line;
|
print "<$args$next_line>\n";
|
||||||
$got_output = 1 if length $next_line;
|
} else {
|
||||||
|
$got_output = 1;
|
||||||
|
print "<$next_line>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user