#!/usr/bin/perl -w # vim:sw=4:et:ts=4:tw=72 # process-cad.pl - Perl script to process # seamonkey-crash-analysis-detailed reports. # L. David Baron, 2001-08-18 use 5.004; use strict; use Getopt::Long; my $logname = "seamonkey-crash-analysis-detailed"; GetOptions("date=s", "db=s"); ($::opt_db && $::opt_date) || die qq{ usage: $0 --date YYYYMMDD The date of the $logname file. [REQUIRED] --db The database. [REQUIRED] }; require "dbfuncs.pl"; sub process_cad($$) { my ($tbfile, $db) = @_; open(TBFILE, "<".$tbfile); my $line; my $stacksig; while ($line = ) { if ($line =~ /^Stack Trace: $/) { # find the signature and the real signature out of the stack trace $line = ; $line = ; ($stacksig) = ($line =~ /^\s*(\S*).*\n$/); # chop off "()" if ($stacksig =~ /\(\)$/) { ($stacksig) = ($stacksig =~ /^(.*)\(\)$/); } while ($line =~ /^\t /) { $line = ; } # process all the reports while ($line && $line =~ /\S/) { my $bbid; my %entry; $entry{stacksig} = $stacksig; if (!defined($entry{realsig})) { $entry{realsig} = ""; # we can't do any better here } $line = ; # LXR for line $line = ; if (my ($builddate) = ($line =~ /^\tBuild: ([^ ]*).*\n$/)) { $entry{builddate} = $builddate; } else { die "Build field not found in \"$line\"."; } $line = ; if (my ($platform) = ($line =~ /^\tOS: ([^ ]*).*\n$/)) { $entry{platform} = $platform; } else { die "OS field not found"; } $line = ; unless (($bbid) = ($line =~ /^.*\?bbid=(.*)\n$/)) { die "BBID not found"; } $line = ; # StackTrace $line = ; while (($line =~ /^ \([0-9]*\).*\n$/) && ($line = )) { # do nothing } $line = ; # add the report to the hash $db->{$bbid} = \%entry; } } } } my $database = {}; # nicer than |my %database;| and |\%database| read_database($::opt_db, $database); process_cad($logname . "/" . $::opt_date, $database); write_database($::opt_db, $database);