mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Merge pull request #8701 from Kolcha/musl-support
Allow to disable Stacktrace support
This commit is contained in:
commit
7e4b62c68d
9 changed files with 117 additions and 44 deletions
|
@ -51,9 +51,9 @@ if (NOT WEBUI)
|
|||
add_definitions(-DDISABLE_WEBUI)
|
||||
endif (NOT WEBUI)
|
||||
|
||||
if (STACKTRACE_WIN)
|
||||
add_definitions(-DSTACKTRACE_WIN)
|
||||
endif(STACKTRACE_WIN)
|
||||
if (STACKTRACE)
|
||||
add_definitions(-DSTACKTRACE)
|
||||
endif(STACKTRACE)
|
||||
# nogui {
|
||||
# TARGET = qbittorrent-nox
|
||||
# } else {
|
||||
|
|
|
@ -53,16 +53,16 @@ if (WIN32)
|
|||
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
|
||||
endif (WIN32)
|
||||
|
||||
if (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
||||
endif (UNIX)
|
||||
|
||||
if (STACKTRACE_WIN)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
||||
if (GUI)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
||||
endif (GUI)
|
||||
endif (STACKTRACE_WIN)
|
||||
if (STACKTRACE)
|
||||
if (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
||||
else (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
||||
if (GUI)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
||||
endif (GUI)
|
||||
endif (UNIX)
|
||||
endif (STACKTRACE)
|
||||
|
||||
# usesystemqtsingleapplication {
|
||||
# nogui {
|
||||
|
|
|
@ -25,12 +25,16 @@ SOURCES += \
|
|||
$$PWD/filelogger.cpp \
|
||||
$$PWD/main.cpp
|
||||
|
||||
unix: HEADERS += $$PWD/stacktrace.h
|
||||
strace_win {
|
||||
HEADERS += $$PWD/stacktrace_win.h
|
||||
!nogui {
|
||||
HEADERS += $$PWD/stacktrace_win_dlg.h
|
||||
FORMS += $$PWD/stacktrace_win_dlg.ui
|
||||
stacktrace {
|
||||
unix {
|
||||
HEADERS += $$PWD/stacktrace.h
|
||||
}
|
||||
else {
|
||||
HEADERS += $$PWD/stacktrace_win.h
|
||||
!nogui {
|
||||
HEADERS += $$PWD/stacktrace_win_dlg.h
|
||||
FORMS += $$PWD/stacktrace_win_dlg.ui
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,17 +57,15 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
|||
#endif
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
#include <signal.h>
|
||||
#ifdef STACKTRACE
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
#include "stacktrace.h"
|
||||
#endif // Q_OS_UNIX
|
||||
|
||||
#ifdef STACKTRACE_WIN
|
||||
#include <signal.h>
|
||||
#else
|
||||
#include "stacktrace_win.h"
|
||||
#include "stacktrace_win_dlg.h"
|
||||
#endif //STACKTRACE_WIN
|
||||
#endif // Q_OS_UNIX
|
||||
#endif //STACKTRACE
|
||||
|
||||
#include "application.h"
|
||||
#include "base/profile.h"
|
||||
|
@ -77,9 +75,10 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
|||
#include "upgrade.h"
|
||||
|
||||
// Signal handlers
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
void sigNormalHandler(int signum);
|
||||
#ifdef STACKTRACE
|
||||
void sigAbnormalHandler(int signum);
|
||||
#endif
|
||||
// sys_signame[] is only defined in BSD
|
||||
const char *sysSigName[] = {
|
||||
#if defined(Q_OS_WIN)
|
||||
|
@ -94,7 +93,6 @@ const char *sysSigName[] = {
|
|||
"SIGPWR", "SIGUNUSED"
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
void reportToUser(const char* str);
|
||||
|
@ -255,9 +253,9 @@ int main(int argc, char *argv[])
|
|||
showSplashScreen();
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
signal(SIGINT, sigNormalHandler);
|
||||
signal(SIGTERM, sigNormalHandler);
|
||||
#ifdef STACKTRACE
|
||||
signal(SIGABRT, sigAbnormalHandler);
|
||||
signal(SIGSEGV, sigAbnormalHandler);
|
||||
#endif
|
||||
|
@ -281,7 +279,6 @@ void reportToUser(const char* str)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
void sigNormalHandler(int signum)
|
||||
{
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
|
@ -295,6 +292,7 @@ void sigNormalHandler(int signum)
|
|||
qApp->exit(); // unsafe, but exit anyway
|
||||
}
|
||||
|
||||
#ifdef STACKTRACE
|
||||
void sigAbnormalHandler(int signum)
|
||||
{
|
||||
const char *sigName = sysSigName[signum];
|
||||
|
@ -307,16 +305,18 @@ void sigAbnormalHandler(int signum)
|
|||
reportToUser(sigName);
|
||||
reportToUser("\n");
|
||||
print_stacktrace(); // unsafe
|
||||
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
#ifdef STACKTRACE_WIN
|
||||
#endif
|
||||
|
||||
#if defined Q_OS_WIN
|
||||
StraceDlg dlg; // unsafe
|
||||
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace());
|
||||
dlg.exec();
|
||||
#endif // STACKTRACE_WIN
|
||||
#endif
|
||||
|
||||
signal(signum, SIG_DFL);
|
||||
raise(signum);
|
||||
}
|
||||
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
#endif // STACKTRACE
|
||||
|
||||
#if !defined(DISABLE_GUI)
|
||||
void showSplashScreen()
|
||||
|
|
12
src/src.pro
12
src/src.pro
|
@ -33,13 +33,17 @@ nogui {
|
|||
LIBS += -lobjc
|
||||
}
|
||||
}
|
||||
|
||||
nowebui {
|
||||
DEFINES += DISABLE_WEBUI
|
||||
}
|
||||
strace_win {
|
||||
DEFINES += STACKTRACE_WIN
|
||||
DEFINES += STACKTRACE_WIN_PROJECT_PATH=$$PWD
|
||||
DEFINES += STACKTRACE_WIN_MAKEFILE_PATH=$$OUT_PWD
|
||||
|
||||
stacktrace {
|
||||
DEFINES += STACKTRACE
|
||||
win32 {
|
||||
DEFINES += STACKTRACE_WIN_PROJECT_PATH=$$PWD
|
||||
DEFINES += STACKTRACE_WIN_MAKEFILE_PATH=$$OUT_PWD
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release): message(Project is built in DEBUG mode.)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue