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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Felke <martin.felke@googlemail.com>2018-09-09 17:12:31 +0300
committerMartin Felke <martin.felke@googlemail.com>2018-09-09 17:12:31 +0300
commitcdf05d154a13cf3be1bbffee68b9f9a508774baf (patch)
treeb4616f67e91b05d923b7f6e6655438262c072a0a /source/creator
parenta607ddd66afd99a5d9bff5b82881354394ffbb6a (diff)
do not show dump writing routine in dump any more
did also use exception handler and manually set up signals
Diffstat (limited to 'source/creator')
-rw-r--r--source/creator/CMakeLists.txt9
-rw-r--r--source/creator/creator.c4
-rw-r--r--source/creator/creator_breakpad_linux.cpp60
-rw-r--r--source/creator/creator_intern.h7
-rw-r--r--source/creator/creator_signals.c24
5 files changed, 79 insertions, 25 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index e2d4ab2d5f2..8fb04c320a0 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -450,11 +450,18 @@ if(WITH_CRASHPAD)
FILES ${LIBDIR}/crashpad/bin/crashpad_handler.exe
DESTINATION "."
)
-elseif(APPLE)
+ elseif(APPLE)
install(
PROGRAMS ${LIBDIR}/crashpad/bin/crashpad_handler
DESTINATION $<TARGET_FILE_DIR:blender>/../Resources/crashpad/
)
+ elseif(UNIX)
+ add_custom_command(
+ TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+ COMMAND ${LIBDIR}/breakpad/bin/dump_syms $<TARGET_FILE_DIR:blender>/blender > $<TARGET_FILE_DIR:blender>/blender.syms
+ # ToDo, make sure sentry-cli has been installed and configured
+ COMMAND sentry-cli upload-dif -t breakpad $<TARGET_FILE_DIR:blender>/blender.syms
+ )
endif()
endif()
diff --git a/source/creator/creator.c b/source/creator/creator.c
index fa5b05846a4..427d613f11b 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -82,12 +82,15 @@
# include "FRS_freestyle.h"
#endif
+#if 0
+//moved to creator_intern.h, gave compiler error on windows with crashpad
/* for passing information between creator and gameengine */
#ifdef WITH_GAMEENGINE
# include "BL_System.h"
#else /* dummy */
# define SYS_SystemHandle int
#endif
+#endif
#include <signal.h>
@@ -405,6 +408,7 @@ int main(
psys_init_rng();
/* end second init */
+ //Test crash for crashpad / breakpad testing
//int* whoops = (int*)0;
//*whoops = 41;
diff --git a/source/creator/creator_breakpad_linux.cpp b/source/creator/creator_breakpad_linux.cpp
index b6bf9d39186..529e2d525d2 100644
--- a/source/creator/creator_breakpad_linux.cpp
+++ b/source/creator/creator_breakpad_linux.cpp
@@ -31,15 +31,6 @@
extern "C"
{
-//old dummy shit for game engine... taken from creator.c
-
-/* for passing information between creator and gameengine */
-#ifdef WITH_GAMEENGINE
-# include "BL_System.h"
-#else /* dummy */
-# define SYS_SystemHandle int
-#endif
-
#include "BLI_path_util.h"
#include "BLI_utildefines.h"
#include "BKE_appdir.h"
@@ -47,10 +38,15 @@ extern "C"
#include "creator_intern.h"
}
+#include <signal.h>
+
using namespace google_breakpad;
namespace {
+ static ExceptionHandler *eh;
+ static void (*crash_handler)(int);
+ static void (*abort_handler)(int);
static void sendMinidump(const MinidumpDescriptor &descriptor);
static bool dumpCallback(const MinidumpDescriptor& descriptor, void* context, bool succeeded)
@@ -121,16 +117,54 @@ namespace {
printf("%s\n", response.c_str());
}
- static void startCrashHandler()
+ static void handleSignals(int signum, siginfo_t* info, void *uc)
+ {
+ eh->HandleSignal(signum, info, uc);
+ delete eh;
+
+ //additionally try to call blenders old passed in function pointers here (old handler routines)
+ if (signum == SIGSEGV) {
+ crash_handler(signum);
+ }
+
+ if (signum == SIGABRT) {
+ abort_handler(signum);
+ }
+ }
+
+ static void startCrashHandler(void (*crash)(int), void (*abort)(int))
{
- ExceptionHandler::WriteMinidump("/tmp", dumpCallback, NULL);
+ const int kExceptionSignals[] = {
+ SIGSEGV, SIGABRT, SIGFPE, SIGILL, SIGBUS, SIGTRAP
+ };
+
+ int size = sizeof(kExceptionSignals) / sizeof(int);
+
+ //ExceptionHandler::WriteMinidump("/tmp", dumpCallback, NULL);
+ MinidumpDescriptor descriptor("/tmp");
+ eh = new ExceptionHandler(descriptor, NULL, dumpCallback, NULL, false, -1);
+ crash_handler = crash;
+ abort_handler = abort;
+
+ //try to manually install handlers here (ExceptionHandlers own installation routine seems a bit brittle)
+ struct sigaction handler;
+ memset(&handler, 0, sizeof(handler));
+ sigemptyset(&handler.sa_mask);
+
+ handler.sa_flags = SA_ONSTACK | SA_SIGINFO;
+ handler.sa_sigaction = handleSignals;
+
+ for (int i = 0; i < size; i++)
+ {
+ sigaction(kExceptionSignals[i], &handler, NULL);
+ }
}
}
extern "C"
{
- void breakpad_write()
+ void breakpad_init(void (*crash_handler)(int), void (*abort_handler)(int))
{
- startCrashHandler();
+ startCrashHandler(crash_handler, abort_handler);
}
}
diff --git a/source/creator/creator_intern.h b/source/creator/creator_intern.h
index fb6798d1a64..435f3da66a5 100644
--- a/source/creator/creator_intern.h
+++ b/source/creator/creator_intern.h
@@ -30,6 +30,13 @@
struct bArgs;
struct bContext;
+/* for passing information between creator and gameengine */
+#ifdef WITH_GAMEENGINE
+# include "BL_System.h"
+#else /* dummy */
+# define SYS_SystemHandle int
+#endif
+
#ifndef WITH_PYTHON_MODULE
/* creator_args.c */
diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c
index 51b5ffbb0c1..2696d979bec 100644
--- a/source/creator/creator_signals.c
+++ b/source/creator/creator_signals.c
@@ -77,7 +77,7 @@
#ifdef WITH_CRASHPAD
void crashpad_init(void);
- void breakpad_write(void);
+ void breakpad_init(void (*crash_handler)(int), void (*abort_handler)(int));
#ifdef WIN32
void crashpad_activate(void *ExceptionInfo);
#endif
@@ -182,12 +182,6 @@ static void sig_handle_crash(int signum)
/* Delete content of temp dir! */
BKE_tempdir_session_purge();
-#if defined(WITH_CRASHPAD) && !defined(__APPLE__)
- //linux only, try to write the dump now (instead of relying on own exception handler)
- //this generates DUMP_REQUESTED issues
- breakpad_write();
-#endif
-
/* really crash */
signal(signum, SIG_DFL);
#ifndef WIN32
@@ -302,17 +296,25 @@ void main_signal_setup(void)
#endif
SetUnhandledExceptionFilter(windows_exception_handler);
#else
- #if defined(WITH_CRASHPAD) && defined(__APPLE__)
- crashpad_init();
- #endif
+ #if defined(WITH_CRASHPAD)
+ #if defined(__APPLE__)
+ crashpad_init();
+ #else
+ //pass the old handlers here so they will be executed after the new handler from breakpad
+ breakpad_init(sig_handle_crash, sig_handle_abort);
+ #endif
+ #else
/* after parsing args */
- signal(SIGSEGV, sig_handle_crash);
+ signal(SIGSEGV, sig_handle_crash);
+ #endif
#endif
}
+#if !defined(WITH_CRASHPAD) || (defined(WITH_CRASHPAD) && defined(__APPLE__))
if (app_state.signal.use_abort_handler) {
signal(SIGABRT, sig_handle_abort);
}
+#endif
}
void main_signal_setup_background(void)