OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
CrashHandler.h
Go to the documentation of this file.
1
9// Copyright (c) 2008-2019 OpenShot Studios, LLC
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_CRASH_HANDLER_H
14#define OPENSHOT_CRASH_HANDLER_H
15
16#include <cstdlib>
17#include <stdio.h>
18#include <signal.h>
19#ifdef __MINGW32__
20 #include <winsock2.h>
21 #include <windows.h>
22 #include <DbgHelp.h>
23#else
24 #include <execinfo.h>
25#endif
26#include <errno.h>
27#include <cxxabi.h>
28#include "ZmqLogger.h"
29
30namespace openshot {
31
39 private:
41 CrashHandler(){return;}; // Don't allow user to create an instance of this singleton
42
44 //CrashHandler(CrashHandler const&){}; // Don't allow the user to copy this instance
45 CrashHandler(CrashHandler const&) = delete; // Don't allow the user to copy this instance
46
48 CrashHandler & operator=(CrashHandler const&) = delete; // Don't allow the user to assign this instance
49
51 static CrashHandler *m_pInstance;
52
53 public:
56 static CrashHandler *Instance();
57
58#ifdef __MINGW32__
59 // TODO: Windows exception handling methods
60 static void abortHandler(int signum);
61#else
63 static void abortHandler(int signum, siginfo_t* si, void* unused);
64#endif
65
67 static void printStackTrace(FILE *out, unsigned int max_frames);
68 };
69
70}
71
72#endif
Header file for ZeroMQ-based Logger class.
This class is designed to catch exceptions thrown by libc (SIGABRT, SIGSEGV, SIGILL,...
static void abortHandler(int signum, siginfo_t *si, void *unused)
Method which handles crashes and logs error.
static void printStackTrace(FILE *out, unsigned int max_frames)
Method which prints a stacktrace.
static CrashHandler * Instance()
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29