30 #endif |
30 #endif |
31 |
31 |
32 #include "crashCatcher.h" |
32 #include "crashCatcher.h" |
33 #include "basics.h" |
33 #include "basics.h" |
34 #include "dialogs.h" |
34 #include "dialogs.h" |
|
35 #include "mainWindow.h" |
35 |
36 |
36 // Is the crash catcher active now? |
37 // Is the crash catcher active now? |
37 static bool g_crashCatcherActive = false; |
38 static bool g_crashCatcherActive = false; |
38 |
39 |
39 // If an assertion failed, what was it? |
40 // If an assertion failed, what was it? |
87 #endif |
91 #endif |
88 |
92 |
89 proc.waitForFinished (1000); |
93 proc.waitForFinished (1000); |
90 String output = String (proc.readAllStandardOutput()); |
94 String output = String (proc.readAllStandardOutput()); |
91 String err = String (proc.readAllStandardError()); |
95 String err = String (proc.readAllStandardError()); |
|
96 QFile f ("ldforge-crash.log"); |
|
97 |
|
98 if (f.open (QIODevice::WriteOnly)) |
|
99 { |
|
100 fprint (f, format ("=== Program crashed with signal %1 ===\n\n%2" |
|
101 "GDB stdout:\n%3\n" |
|
102 "GDB stderr:\n%4\n", |
|
103 sig, (not g_assertionFailure.isEmpty()) ? g_assertionFailure + "\n\n" : "", output, err)); |
|
104 f.close(); |
|
105 } |
92 |
106 |
93 bombBox (format ("<h3>Program crashed with signal %1</h3>\n\n" |
107 bombBox (format ("<h3>Program crashed with signal %1</h3>\n\n" |
94 "%2" |
108 "%2" |
95 "<p><b>GDB <tt>stdout</tt>:</b></p><pre>%3</pre>\n" |
109 "<p><b>GDB <tt>stdout</tt>:</b></p><pre>%3</pre>\n" |
96 "<p><b>GDB <tt>stderr</tt>:</b></p><pre>%4</pre>", |
110 "<p><b>GDB <tt>stderr</tt>:</b></p><pre>%4</pre>", |
97 sig, (not g_assertionFailure.isEmpty()) ? g_assertionFailure : "", output, err)); |
111 sig, g_assertionFailure, output, err)); |
98 } |
112 } |
99 |
113 |
100 // ============================================================================= |
114 // ============================================================================= |
101 // |
115 // |
102 void initCrashCatcher() |
116 void initCrashCatcher() |