From 39efdd9473c4ced60f9b2a4b553ab041cb1d5169 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 6 Nov 2007 16:13:07 +0000 Subject: report gdb trace if possible --- perl-install/NEWS | 1 + perl-install/standalone/drakbug | 42 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index a24ba70e1..574e5165c 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -2,6 +2,7 @@ o add support for ext4 - drakbug: o keep buggy process around so that we can run gdb on it (if perl segfaulted) + o report gdb trace if possible - harddrake: detect storage and various controllers before anything else (so that storage devices get detected at first boot on live) diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index c786fa045..d2f55b05a 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -29,10 +29,11 @@ use mygtk2 qw(gtknew); use ugtk2 qw(:all); use Config; use URI::Escape; +use run_program; my $prog; my $incident = 0; -my ($table, $comb_app, $com_app, $button_pkg, $package, $distrocode, $error); +my ($table, $comb_app, $com_app, $button_pkg, $package, $distrocode, $error, $gdb_trace); my $i; foreach (@ARGV) { @@ -43,9 +44,27 @@ foreach (@ARGV) { /^--incident$/ and do { $incident = 1; $prog = splice(@ARGV, $i, 1) }; } +if ($error =~ /SEGV/ && -x '/usr/bin/gdb') { + local $ENV{TMP} ||= '/tmp'; + my $file = chomp_(`mktemp $ENV{TMP}/drakbug.XXXXXXXX`); + my $_guard = before_leaving { rm_rf $file }; + if (-e $file) { + output($file, qq(bt +quit)); + local $ENV{LANGUAGE} = 'C'; + my $temp = run_program::get_stdout('gdb', '-q', 'perl', $$, '-x', $file); + $gdb_trace = join "\n", grep { !/^done\.$/ && !/Reading symbols from/ + && !/Loaded symbols/ && !/The program is run/ } split(/\n/, $temp); + } +} if (!check_for_xserver) { print("Cannot be run in console mode.\n"); - print N("The \"%s\" program has crashed with the following error:", $prog) . "\n$error\n" if $error; + print join("\n", + N("The \"%s\" program has crashed with the following error:", $prog), + $error, + $gdb_trace, + '') + if $error; } mygtk2::init(); @@ -110,13 +129,24 @@ gtkadd($window->{window}, text => [ if_($prog && $error, [ - N("The \"%s\" program has crashed with the following error:", $prog), + ($gdb_trace ? + N("The \"%s\" program has segfaulted with the following error:", $prog) + : N("The \"%s\" program has crashed with the following error:", $prog)), ], [ "\n\n " . join("\n ", split("\n", $error)) . "\n\n", { family => 'monospace' } ] ), + if_($prog && $gdb_trace, + [ + N("Its gdb trace is:") + ], + [ + "\n\n " . join("\n ", split("\n", $gdb_trace)) . "\n\n", + { family => 'monospace' } + ] + ), [ N("To submit a bug report, click on the report button. \nThis will open a web browser window on %s where you'll find a form to fill in. The information displayed above will be transferred to that server. \nThings useful to include in your report are the output of lspcidrake -v, kernel version, and /proc/cpuinfo.", $wizard_name) ] @@ -147,12 +177,14 @@ Please describe what you were doing when it crashed. ) . ($error ? qq(Backtrace was: $error) : -qq(If you can, try to run the "$prog" program from a terminal and copy and paste here any error messages and/or backtrace)), +qq(If you can, try to run the "$prog" program from a terminal and copy and paste here any error messages and/or backtrace)) + . if_($gdb_trace, qq( +GDB backtrace was: +$gdb_trace)), ), ), ); print($bugzilla_url . "?" . $options . "\n"); - require run_program; run_program::raw({ detach => 1, setuid => $parent_uid }, '/usr/bin/www-browser', "$bugzilla_url?$options"); } -- cgit v1.2.1