Mon, 05 May 2014 17:04:30 +0300
- crashcatcher: hide the main window before doing anything and also write the crashlog into a file
src/crashCatcher.cc | file | annotate | diff | comparison | revisions |
--- a/src/crashCatcher.cc Mon May 05 16:50:36 2014 +0300 +++ b/src/crashCatcher.cc Mon May 05 17:04:30 2014 +0300 @@ -32,6 +32,7 @@ #include "crashCatcher.h" #include "basics.h" #include "dialogs.h" +#include "mainWindow.h" // Is the crash catcher active now? static bool g_crashCatcherActive = false; @@ -59,6 +60,9 @@ exit (149); } + if (g_win != null) + g_win->hide(); + const pid_t pid = getpid(); QProcess proc; QTemporaryFile commandsFile; @@ -89,12 +93,22 @@ proc.waitForFinished (1000); String output = String (proc.readAllStandardOutput()); String err = String (proc.readAllStandardError()); + QFile f ("ldforge-crash.log"); + + if (f.open (QIODevice::WriteOnly)) + { + fprint (f, format ("=== Program crashed with signal %1 ===\n\n%2" + "GDB stdout:\n%3\n" + "GDB stderr:\n%4\n", + sig, (not g_assertionFailure.isEmpty()) ? g_assertionFailure + "\n\n" : "", output, err)); + f.close(); + } bombBox (format ("<h3>Program crashed with signal %1</h3>\n\n" "%2" "<p><b>GDB <tt>stdout</tt>:</b></p><pre>%3</pre>\n" "<p><b>GDB <tt>stderr</tt>:</b></p><pre>%4</pre>", - sig, (not g_assertionFailure.isEmpty()) ? g_assertionFailure : "", output, err)); + sig, g_assertionFailure, output, err)); } // =============================================================================