From e2e54079aeb7321f3e8b8ae32102b5b67abb0660 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 2 Feb 2012 18:28:24 +0000 Subject: [PATCH] compiler_vm: improved abormal signal handling --- PBot/VERSION.pm | 4 +- modules/compiler_vm/compiler_watchdog.pl | 49 +++++++++++++----------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index e46f080c..8b7f1dfd 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 354, - BUILD_DATE => "2012-02-01", + BUILD_REVISION => 355, + BUILD_DATE => "2012-02-02", }; 1; diff --git a/modules/compiler_vm/compiler_watchdog.pl b/modules/compiler_vm/compiler_watchdog.pl index 84a86984..30332833 100755 --- a/modules/compiler_vm/compiler_watchdog.pl +++ b/modules/compiler_vm/compiler_watchdog.pl @@ -115,20 +115,12 @@ sub execute { $vars =~ s/\(gdb\)\s*//g; $local_vars = "" if length $vars; - - print $in "cont\n"; - next; - } else { - print $in "cont\n"; - next; - } - } else { - print $in "cont\n"; - next; + } } + print $in "cont\n"; + next; } - if($line =~ m/Breakpoint \d+, gdb/) { print $in "up\n"; $line = <$out>; @@ -281,38 +273,51 @@ sub execute { $got_output = 1; print "$line "; - print $in "up\nup\nup\nup\nup\nup\nup\ninfo locals\nquit\ny\n"; - while(my $line = <$out>) { chomp $line; - #print "got: [$line]\n"; - if($line =~ s/^0x[0-9A-Fa-f]+\s//) { - next if $line =~ /in main\s*\(/; + $line =~ s/^\(gdb\)\s+//; + $line =~ s/main \(.*?\)/main ()/; + print "signal got: [$line]\n" if $debug >= 5; + + if($line =~ s/^(#\d+\s+)?0x[0-9A-Fa-f]+\s//) { $line =~ s/\s+at .*:\d+//; + $line =~ s/\s+from \/lib.*//; - if($line !~ m/^\s*in\s+/) { - $result = "in $line from "; + if($line =~ s/^\s*in\s+//) { + if(not length $result) { + $result .= "in $line "; + } else { + $result .= "called by $line "; + } + print $in "info locals\n"; } else { - $result .= "$line at "; + $result = "in $line from "; + print $in "info locals\n"; } } + elsif($line =~ m/^No symbol table info available/) { + print $in "up\n"; + } elsif($line =~ s/^\d+\s+//) { next if $line =~ /No such file/; - $result .= "at " if not length $result; - $result .= "statement: $line"; + $result .= "at statement: $line "; + print $in "up\n"; } elsif($line =~ m/([^=]+)=\s+(.*)/) { $vars .= "$varsep$1= $2"; $varsep = "; "; } + elsif($line =~ m/^Initial frame selected; you cannot go up/) { + last; + } } $result =~ s/^\s+//; $result =~ s/\s+$//; + $result =~ s/in main \(\) //; - $vars =~ s/\(gdb\)\s*//g; $vars = " " if length $vars; print "$result$vars\n";