summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2012-07-04 14:16:26 +0200
committerNikolai Kosjar <nikolai.kosjar@digia.com>2012-09-21 15:57:41 +0200
commit903281b3520693e1e116523c6690d07f420feca5 (patch)
tree47c56cd6596e8ac137b8ea7940b1d15eed63a2e4 /src/app
parent6d06d47a6e96e531af7ad622076e1aff39c14efc (diff)
downloadqt-creator-903281b3520693e1e116523c6690d07f420feca5.tar.gz
Linux: Add a crash handler providing a backtrace for debug builds.
Use case: You're working with a debug version of Qt Creator and you're interested in getting a backtrace displayed as soon as Qt Creator crashes without searching for the core file, starting your debugger, ... Once a 'serious signal' (currently SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGPIPE) is delivered, a popup displays the following debug information: - Qt Creator version (same as in the about dialog) - Kernel version (uname -a) - GNU/Linux Distribution (/etc/lsb-release) - Backtrace (by gdb) Please note that this crash handler is built and used only in debug mode on GNU/Linux. It's solely meant as a convenience tool for the developer. In contrast to the breakpad integration, this crash handler operates 'offline'. There is no network i/o involved. Change-Id: Idcfb1bf1ad68942615ecfe0dffc0d03154455049 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com> Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.pro7
-rw-r--r--src/app/main.cpp7
2 files changed, 13 insertions, 1 deletions
diff --git a/src/app/app.pro b/src/app/app.pro
index 896b2cc884..85831adb6f 100644
--- a/src/app/app.pro
+++ b/src/app/app.pro
@@ -6,6 +6,13 @@ TARGET = $$IDE_APP_TARGET
DESTDIR = $$IDE_APP_PATH
SOURCES += main.cpp
+linux-* {
+ # Build only in debug mode.
+ debug_and_release|CONFIG(debug, debug|release) {
+ HEADERS += ../tools/qtcreatorcrashhandler/crashhandlersetup.h
+ SOURCES += ../tools/qtcreatorcrashhandler/crashhandlersetup.cpp
+ }
+}
include(../rpath.pri)
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 526ca15477..e96692b04f 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -29,6 +29,7 @@
**************************************************************************/
#include "qtsingleapplication.h"
+#include "../tools/qtcreatorcrashhandler/crashhandlersetup.h"
#include <app/app_version.h>
#include <extensionsystem/iplugin.h>
@@ -228,6 +229,8 @@ int main(int argc, char **argv)
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));
+ setupCrashHandler(); // Display a backtrace once a serious signal is delivered.
+
#ifdef ENABLE_QT_BREAKPAD
QtSystemExceptionHandler systemExceptionHandler;
#endif
@@ -432,5 +435,7 @@ int main(int argc, char **argv)
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
#endif
- return app.exec();
+ const int r = app.exec();
+ cleanupCrashHandler();
+ return r;
}