Fork the current process to monitor exe, generate minidump on crash

This commit is contained in:
CedricMocquillon 2020-12-12 17:29:29 +01:00
parent 11eff02a1d
commit 73afc55462
7 changed files with 571 additions and 3 deletions

View file

@ -2,10 +2,12 @@
#include <chrono>
#include <memory>
#include <functional>
#include <components/crashcatcher/crashcatcher.hpp>
#ifdef _WIN32
# include <components/crashcatcher/windows_crashcatcher.hpp>
# undef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
@ -187,13 +189,16 @@ int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, c
std::cerr.rdbuf (&cerrsb);
#endif
#if defined(_WIN32)
Crash::CrashCatcher crashy(argc, argv, (cfgMgr.getLogPath() / crashLogName).make_preferred().string());
#else
// install the crash handler as soon as possible. note that the log path
// does not depend on config being read.
crashCatcherInstall(argc, argv, (cfgMgr.getLogPath() / crashLogName).string());
#endif
ret = innerApplication(argc, argv);
}
catch (std::exception& e)
catch (const std::exception& e)
{
#if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix))
if (!isatty(fileno(stdin)))