Go to the documentation of this file.
65 #ifndef JOURNALEXCEPTION_H
66 #define JOURNALEXCEPTION_H
84 const char*
msg()
const;
85 const std::string&
stack()
const;
93 #define JLTHROW(msg) do { std::ostringstream os; os << msg; throw JournalException(os.str()); } while(0)
99 LONG journallerExceptionFilter(EXCEPTION_POINTERS* pExPtrs,
Journaller*);
102 #if JLDEF_BUILD > JLL_FATAL
103 #define JOURNALCRASHES_SIGNAL_FUNCTIONS
104 #define JOURNALCRASHES_BEGIN(journal)
105 #define JOURNALCRASHES_END(journal)
108 #define JOURNALCRASHES_SIGNAL_FUNCTIONS
109 #define JOURNALCRASHES_BEGIN(journal) \
112 #define JOURNALCRASHES_END(journal) \
113 } __except (journallerExceptionFilter(GetExceptionInformation(), journal)) {}
116 #define JOURNALCRASHES_SIGNAL_FUNCTIONS \
117 Journaller *gSCJ = 0;\
118 extern "C" void signal_handler(int signal, siginfo_t *, void *)\
122 JLFATAL_NODEC(gSCJ, strsignal(signal));\
123 gSCJ->writeCallstack(JLL_Fatal);\
128 #define JOURNALCRASHES_BEGIN(journal) \
131 struct sigaction act;\
132 memset(&act, 0, sizeof(act));\
133 act.sa_flags = SA_SIGINFO;\
134 act.sa_sigaction = &signal_handler;\
135 sigaction(SIGSEGV, &act, NULL);\
136 sigaction(SIGILL, &act, NULL);\
137 sigaction(SIGABRT, &act, NULL);\
138 sigaction(SIGFPE, &act, NULL);\
140 #define JOURNALCRASHES_END(journal)
144 #if JLDEF_BUILD > JLL_ERROR
145 #define JOURNALEXCEPTIONS_BEGIN(journal) try {
146 #define JOURNALEXCEPTIONS_END_NOTHROW(journal) } catch(...) { }
147 #define JOURNALEXCEPTIONS_END_RETHROW(journal) } catch(...) { throw; }
149 #define JOURNALEXCEPTIONS_BEGIN(journal) \
152 #define JOURNALEXCEPTIONS_END_NOTHROW(journal) \
153 } catch (JournalException& e) { JLERROR(journal, e.msg()); JLERROR_NODEC(journal, e.stack()); }\
154 catch (XsException& e) { JLERROR(journal, e.what()); }\
155 catch (std::exception& e) { JLERROR(journal, e.what()); }
157 #define JOURNALEXCEPTIONS_END_RETHROW(journal) \
158 } catch (JournalException& e) { JLERROR(journal, e.msg()); JLERROR_NODEC(journal, e.stack()); throw; }\
159 catch (XsException& e) { JLERROR(journal, e.what()); throw; }\
160 catch (std::exception& e) { JLERROR(journal, e.what()); throw; }
bool gOnExceptionGotoDebugger
A helper class that combines the StackWalker output into a std::string.
JournalException(std::string const &message)
Constructor, copies the message and creates a stack dump.
A journalling class for debugging applications.
An exception class that automatically includes stack dump information.
const std::string & stack() const
The stack dump as it was at the time of object construction.
const char * msg() const
The message as supplied to the constructor.
std::string m_stack
A string that contains a stack dump.