Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dschmidt/libcrashreporter-qt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-08-19 16:16:01 +0300
committerGitHub <noreply@github.com>2021-08-19 16:16:01 +0300
commitcf6fd0ec745edb99fcd4232077a4e5f2ebc4b885 (patch)
tree360462253206f0b5925882064294c3022575b452
parent8ea0cf72882ae80b1557e419ac6b3a102369360a (diff)
parent83ecd5e3958e9a695a55acba33ec623bc72dd5c7 (diff)
Merge pull request #28 from dschmidt/fix-linux
Make ENABLE_GPL_CODE optional on Linux
-rw-r--r--3rdparty/breakpad/client/linux/handler/exception_handler.cc14
-rw-r--r--3rdparty/breakpad/client/linux/handler/exception_handler.h2
-rw-r--r--3rdparty/breakpad/client/linux/minidump_writer/minidump_writer.cc10
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/libcrashreporter-gui/CMakeLists.txt6
-rw-r--r--src/libcrashreporter-gui/CrashReporter.cpp4
6 files changed, 17 insertions, 23 deletions
diff --git a/3rdparty/breakpad/client/linux/handler/exception_handler.cc b/3rdparty/breakpad/client/linux/handler/exception_handler.cc
index fc777a6..a772321 100644
--- a/3rdparty/breakpad/client/linux/handler/exception_handler.cc
+++ b/3rdparty/breakpad/client/linux/handler/exception_handler.cc
@@ -103,12 +103,6 @@
#define PR_SET_PTRACER 0x59616d61
#endif
-// A wrapper for the tgkill syscall: send a signal to a specific thread.
-static int tgkill(pid_t tgid, pid_t tid, int sig) {
- return syscall(__NR_tgkill, tgid, tid, sig);
- return 0;
-}
-
namespace google_breakpad {
namespace {
@@ -347,7 +341,7 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
// In order to retrigger it, we have to queue a new signal by calling
// kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is
// due to the kernel sending a SIGABRT from a user request via SysRQ.
- if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
+ if (sys_tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
// If we failed to kill ourselves (e.g. because a sandbox disallows us
// to do so), we instead resort to terminating our process. This will
// result in an incorrect exit code.
@@ -397,12 +391,12 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
}
CrashContext context;
memcpy(&context.siginfo, info, sizeof(siginfo_t));
- memcpy(&context.context, uc, sizeof(struct ucontext));
+ memcpy(&context.context, uc, sizeof(struct ucontext_t));
#if !defined(__ARM_EABI__) && !defined(__mips__)
// FP state is not part of user ABI on ARM Linux.
// In case of MIPS Linux FP state is already part of struct ucontext
// and 'float_state' is not a member of CrashContext.
- struct ucontext *uc_ptr = (struct ucontext*)uc;
+ struct ucontext_t *uc_ptr = (struct ucontext_t*)uc;
if (uc_ptr->uc_mcontext.fpregs) {
memcpy(&context.float_state,
uc_ptr->uc_mcontext.fpregs,
@@ -426,7 +420,7 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) {
// ExceptionHandler::HandleSignal().
siginfo.si_code = SI_USER;
siginfo.si_pid = getpid();
- struct ucontext context;
+ struct ucontext_t context;
getcontext(&context);
return HandleSignal(sig, &siginfo, &context);
}
diff --git a/3rdparty/breakpad/client/linux/handler/exception_handler.h b/3rdparty/breakpad/client/linux/handler/exception_handler.h
index b57f58d..ece68d7 100644
--- a/3rdparty/breakpad/client/linux/handler/exception_handler.h
+++ b/3rdparty/breakpad/client/linux/handler/exception_handler.h
@@ -189,7 +189,7 @@ class ExceptionHandler {
struct CrashContext {
siginfo_t siginfo;
pid_t tid; // the crashing thread.
- struct ucontext context;
+ struct ucontext_t context;
#if !defined(__ARM_EABI__) && !defined(__mips__)
// #ifdef this out because FP state is not part of user ABI for Linux ARM.
// In case of MIPS Linux FP state is already part of struct ucontext
diff --git a/3rdparty/breakpad/client/linux/minidump_writer/minidump_writer.cc b/3rdparty/breakpad/client/linux/minidump_writer/minidump_writer.cc
index ee75927..100dbf6 100644
--- a/3rdparty/breakpad/client/linux/minidump_writer/minidump_writer.cc
+++ b/3rdparty/breakpad/client/linux/minidump_writer/minidump_writer.cc
@@ -177,7 +177,7 @@ void CPUFillFromThreadInfo(MDRawContextX86 *out,
// Juggle an x86 ucontext into minidump format
// out: the minidump structure
// info: the collection of register structures.
-void CPUFillFromUContext(MDRawContextX86 *out, const ucontext *uc,
+void CPUFillFromUContext(MDRawContextX86 *out, const ucontext_t *uc,
const struct _libc_fpstate* fp) {
const greg_t* regs = uc->uc_mcontext.gregs;
@@ -277,7 +277,7 @@ void CPUFillFromThreadInfo(MDRawContextAMD64 *out,
my_memcpy(&out->flt_save.xmm_registers, &info.fpregs.xmm_space, 16 * 16);
}
-void CPUFillFromUContext(MDRawContextAMD64 *out, const ucontext *uc,
+void CPUFillFromUContext(MDRawContextAMD64 *out, const ucontext_t *uc,
const struct _libc_fpstate* fpregs) {
const greg_t* regs = uc->uc_mcontext.gregs;
@@ -344,7 +344,7 @@ void CPUFillFromThreadInfo(MDRawContextARM* out,
#endif
}
-void CPUFillFromUContext(MDRawContextARM* out, const ucontext* uc,
+void CPUFillFromUContext(MDRawContextARM* out, const ucontext_t* uc,
const struct _libc_fpstate* fpregs) {
out->context_flags = MD_CONTEXT_ARM_FULL;
@@ -405,7 +405,7 @@ static void CPUFillFromThreadInfo(MDRawContextMIPS* out,
out->float_save.fir = info.fpregs.fir;
}
-static void CPUFillFromUContext(MDRawContextMIPS* out, const ucontext* uc,
+static void CPUFillFromUContext(MDRawContextMIPS* out, const ucontext_t* uc,
const struct _libc_fpstate* fpregs) {
out->context_flags = MD_CONTEXT_MIPS_FULL;
@@ -1725,7 +1725,7 @@ class MinidumpWriter {
const int fd_; // File descriptor where the minidum should be written.
const char* path_; // Path to the file where the minidum should be written.
- const struct ucontext* const ucontext_; // also from the signal handler
+ const struct ucontext_t* const ucontext_; // also from the signal handler
const struct _libc_fpstate* const float_state_; // ditto
LinuxDumper* dumper_;
MinidumpFileWriter minidump_writer_;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 43fa720..7e1e269 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,10 @@ if(POLICY CMP0063)
endif()
option(ENABLE_GPL_CODE "Enable GPL-licensed depencencies of libcrashreporter-qt (dr.konqui integration)" OFF)
+if(ENABLE_GPL_CODE AND NOT APPLE AND NOT WIN32)
+ add_definitions( -DENABLE_GPL_CODE )
+endif()
+
option(ENABLE_CRASH_REPORTER "Enable libcrashreporter-qt GUI component" ON)
find_package(Qt5 COMPONENTS Core Network Widgets)
diff --git a/src/libcrashreporter-gui/CMakeLists.txt b/src/libcrashreporter-gui/CMakeLists.txt
index 4420e33..feb32c0 100644
--- a/src/libcrashreporter-gui/CMakeLists.txt
+++ b/src/libcrashreporter-gui/CMakeLists.txt
@@ -3,11 +3,7 @@ set(crashreporter_UI CrashReporter.ui)
set(crashreporter_RC ../../resources.qrc)
set(crashreporter_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES})
-if(UNIX AND NOT APPLE)
- if(NOT ENABLE_GPL_CODE)
- message(FATAL_ERROR "Using the Linux build requires ENABLE_GPL_CODE to be true.")
- endif()
-
+if(ENABLE_GPL_CODE)
list(APPEND crashreporter_INCLUDE_DIRECTORIES
${CMAKE_CURRENT_LIST_DIR}/../../3rdparty/drkonqi-parser
)
diff --git a/src/libcrashreporter-gui/CrashReporter.cpp b/src/libcrashreporter-gui/CrashReporter.cpp
index b419265..ced151a 100644
--- a/src/libcrashreporter-gui/CrashReporter.cpp
+++ b/src/libcrashreporter-gui/CrashReporter.cpp
@@ -21,7 +21,7 @@
#include "CrashReporter.h"
-#ifdef Q_OS_LINUX
+#ifdef ENABLE_GPL_CODE
#include "linux-backtrace-generator/backtracegenerator.h"
#include "linux-backtrace-generator/crashedapplication.h"
#include "CrashReporterGzip.h"
@@ -87,7 +87,7 @@ CrashReporter::CrashReporter( const QUrl& url, const QStringList& args )
adjustSize();
setFixedSize( size() );
-#ifdef Q_OS_LINUX
+#ifdef ENABLE_GPL_CODE
if ( args.count() == 8 )
{
qDebug() << "These are all our args:" << args.join( ", " );