diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 52b2e060..36c7774f 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -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", }; diff --git a/modules/compiler_vm/compiler_vm_client.pl b/modules/compiler_vm/compiler_vm_client.pl index 8b6a1c9d..c2dc2f60 100755 --- a/modules/compiler_vm/compiler_vm_client.pl +++ b/modules/compiler_vm/compiler_vm_client.pl @@ -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 = ) { @@ -736,13 +736,12 @@ if($output =~ m/^\s*$/) { $output =~ s/\(gdb\)//g; $output =~ s/", '\\(\d{3})' ,? ?"/\\$1/g; $output =~ s/, '\\(\d{3})' \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) { diff --git a/modules/compiler_vm/compiler_watchdog.pl b/modules/compiler_vm/compiler_watchdog.pl index a9583951..982e194a 100755 --- a/modules/compiler_vm/compiler_watchdog.pl +++ b/modules/compiler_vm/compiler_watchdog.pl @@ -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"; + } } }