mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 13:59:47 +01:00
compiler_vm: improved abormal signal handling
This commit is contained in:
parent
fd1f18850a
commit
e2e54079ae
@ -13,8 +13,8 @@ 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 => 354,
|
BUILD_REVISION => 355,
|
||||||
BUILD_DATE => "2012-02-01",
|
BUILD_DATE => "2012-02-02",
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -115,19 +115,11 @@ sub execute {
|
|||||||
|
|
||||||
$vars =~ s/\(gdb\)\s*//g;
|
$vars =~ s/\(gdb\)\s*//g;
|
||||||
$local_vars = "<no output: $vars>" if length $vars;
|
$local_vars = "<no output: $vars>" if length $vars;
|
||||||
|
}
|
||||||
print $in "cont\n";
|
}
|
||||||
next;
|
|
||||||
} else {
|
|
||||||
print $in "cont\n";
|
print $in "cont\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
print $in "cont\n";
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($line =~ m/Breakpoint \d+, gdb/) {
|
if($line =~ m/Breakpoint \d+, gdb/) {
|
||||||
print $in "up\n";
|
print $in "up\n";
|
||||||
@ -281,38 +273,51 @@ sub execute {
|
|||||||
$got_output = 1;
|
$got_output = 1;
|
||||||
print "$line ";
|
print "$line ";
|
||||||
|
|
||||||
print $in "up\nup\nup\nup\nup\nup\nup\ninfo locals\nquit\ny\n";
|
|
||||||
|
|
||||||
while(my $line = <$out>) {
|
while(my $line = <$out>) {
|
||||||
chomp $line;
|
chomp $line;
|
||||||
#print "got: [$line]\n";
|
$line =~ s/^\(gdb\)\s+//;
|
||||||
if($line =~ s/^0x[0-9A-Fa-f]+\s//) {
|
$line =~ s/main \(.*?\)/main ()/;
|
||||||
next if $line =~ /in main\s*\(/;
|
|
||||||
|
|
||||||
|
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+at .*:\d+//;
|
||||||
|
$line =~ s/\s+from \/lib.*//;
|
||||||
|
|
||||||
if($line !~ m/^\s*in\s+/) {
|
if($line =~ s/^\s*in\s+//) {
|
||||||
$result = "in $line from ";
|
if(not length $result) {
|
||||||
|
$result .= "in $line ";
|
||||||
} else {
|
} else {
|
||||||
$result .= "$line at ";
|
$result .= "called by $line ";
|
||||||
}
|
}
|
||||||
|
print $in "info locals\n";
|
||||||
|
} else {
|
||||||
|
$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+//) {
|
elsif($line =~ s/^\d+\s+//) {
|
||||||
next if $line =~ /No such file/;
|
next if $line =~ /No such file/;
|
||||||
|
|
||||||
$result .= "at " if not length $result;
|
$result .= "at statement: $line ";
|
||||||
$result .= "statement: $line";
|
print $in "up\n";
|
||||||
}
|
}
|
||||||
elsif($line =~ m/([^=]+)=\s+(.*)/) {
|
elsif($line =~ m/([^=]+)=\s+(.*)/) {
|
||||||
$vars .= "$varsep$1= $2";
|
$vars .= "$varsep$1= $2";
|
||||||
$varsep = "; ";
|
$varsep = "; ";
|
||||||
}
|
}
|
||||||
|
elsif($line =~ m/^Initial frame selected; you cannot go up/) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result =~ s/^\s+//;
|
$result =~ s/^\s+//;
|
||||||
$result =~ s/\s+$//;
|
$result =~ s/\s+$//;
|
||||||
|
$result =~ s/in main \(\) //;
|
||||||
|
|
||||||
$vars =~ s/\(gdb\)\s*//g;
|
|
||||||
$vars = " <local variables: $vars>" if length $vars;
|
$vars = " <local variables: $vars>" if length $vars;
|
||||||
|
|
||||||
print "$result$vars\n";
|
print "$result$vars\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user