From 6dca91bc1ab2b4d9dd6d6bf2d50ce1f2e6608cab Mon Sep 17 00:00:00 2001 From: Adeel Asghar Date: Wed, 28 Dec 2016 04:56:39 +0100 Subject: [PATCH] Fix the Windows fallback backtrace implementation. --- OMEdit/OMEditGUI/MainWindow.cpp | 2 -- OMEdit/OMEditGUI/OMEditGUI.pro | 8 ++++++-- OMEdit/OMEditGUI/main.cpp | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OMEdit/OMEditGUI/MainWindow.cpp b/OMEdit/OMEditGUI/MainWindow.cpp index 1572291150b..e12ca97b94d 100644 --- a/OMEdit/OMEditGUI/MainWindow.cpp +++ b/OMEdit/OMEditGUI/MainWindow.cpp @@ -371,8 +371,6 @@ void MainWindow::setUpMainWindow() if (OptionsDialog::instance()->getGeneralSettingsPage()->getEnableAutoSaveGroupBox()->isChecked()) { mpAutoSaveTimer->start(); } - QWidget *p; - p->setObjectName("a"); } /*! diff --git a/OMEdit/OMEditGUI/OMEditGUI.pro b/OMEdit/OMEditGUI/OMEditGUI.pro index 10c508d7215..2e54230a777 100644 --- a/OMEdit/OMEditGUI/OMEditGUI.pro +++ b/OMEdit/OMEditGUI/OMEditGUI.pro @@ -98,6 +98,10 @@ win32 { CONFIG += osg } else { # Unix libraries and includes include(OMEdit.config) + # required for backtrace + # In order to get the stack trace in Windows we must add -g flag. Qt automatically adds the -O2 flag for optimization. + # We should also unset the QMAKE_LFLAGS_RELEASE define because it is defined as QMAKE_LFLAGS_RELEASE = -Wl,-s in qmake.conf file for MinGW + # -s will remove all symbol table and relocation information from the executable. # On unix we use backtrace of execinfo.h which requires -rdynamic # The symbol names may be unavailable without the use of special linker # options. For systems using the GNU linker, it is necessary to use @@ -172,7 +176,7 @@ SOURCES += main.cpp \ Debugger/DebuggerConfigurationsDialog.cpp \ Debugger/Attach/AttachToProcessDialog.cpp \ Debugger/Attach/ProcessListModel.cpp \ -# CrashReport/backtrace.c \ + CrashReport/backtrace.c \ CrashReport/GDBBacktrace.cpp \ CrashReport/CrashReportDialog.cpp @@ -240,7 +244,7 @@ HEADERS += Util/Helper.h \ Debugger/DebuggerConfigurationsDialog.h \ Debugger/Attach/AttachToProcessDialog.h \ Debugger/Attach/ProcessListModel.h \ -# CrashReport/backtrace.h \ + CrashReport/backtrace.h \ CrashReport/GDBBacktrace.h \ CrashReport/CrashReportDialog.h diff --git a/OMEdit/OMEditGUI/main.cpp b/OMEdit/OMEditGUI/main.cpp index 64c566d24fc..0d9d4d97263 100644 --- a/OMEdit/OMEditGUI/main.cpp +++ b/OMEdit/OMEditGUI/main.cpp @@ -93,8 +93,9 @@ static inline void writeGDBErrorFile(QString output) #ifdef WIN32 #include "CrashReport/backtrace.h" + static char *g_output = NULL; -LONG WINAPI exceptionFilter(LPEXCEPTION_POINTERS /*info*/) +LONG WINAPI exceptionFilter(LPEXCEPTION_POINTERS info) { GDBBacktrace *pGDBBacktrace = new GDBBacktrace; if (pGDBBacktrace->errorOccurred()) {