You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.4 KiB

#!/usr/bin/perl
14 years ago
use strict;
use warnings;
use Term::ANSIColor qw(:constants);
$Term::ANSIColor::AUTORESET = 1;
14 years ago
my $line = "";
my $left;
while ( <> ) {
14 years ago
if (/Segmentation fault/) {
print "\n" . YELLOW . "Segmentation fault." . RESET . "\n";
$left = 3;
next;
}
if (/^(Thread \d+)/) {
14 years ago
print "\n" . BOLD BLUE . $1 . RESET . " $'";
next;
}
14 years ago
if ($left) {
if ( $left == 3 ) {
$line = $_;
chomp($line);
$left--;
next;
}
elsif ( $left == 2 ) {
$line .= $_;
$left--;
}
elsif ( $left == 1 ) {
print BOLD YELLOW . $_ . RESET . "\n";
$left--;
next;
}
} else {
$line = $_;
}
if ( $line =~ /^(#\d+)\s+(\S+)\s+in\s+(.+)( \(.*)(at.*\/)(\S+):(\d+)/ )
{
print "\n" .
BOLD . $1 . # no
RESET . " $2 in " . # mem in
GREEN . $3 . # function
RESET . " $4\n$5" . # args, path
BOLD CYAN . "$6" . # filename
RESET . ":" .
YELLOW . $7 . # line
RESET . "\n";
}
14 years ago
elsif ( $line =~ /^(#\d+)\s+(\S+)\s+in\s+(.+)( \(.*)(from.*\/)(\S+)/ )
{
print "\n" .
BOLD . $1 . # no
RESET . " $2 in " . # mem in
GREEN . $3 . # function
RESET . " $4\n$5" . # args, path
BLUE . "$6" . # filename
RESET . "\n";
}
}