 |
Belle II Software
release-05-02-19
|
11 #include <framework/modules/core/TheKillerModule.h>
13 #include <boost/algorithm/string.hpp>
29 setDescription(R
"DOC("This Modules kills basf2 as horribly as possible (or as selected)
31 With this module you can kill basf2 in a variety of ways to test what happens if processing is interrupted by
42 This error can occur in a selected event to test behavior during processing.)DOC");
46 "quick_exit, exit, exception, signal, segfault, buserror)", std::string(
"abort"));
48 "quick_exit and exit it is the return code, for signal it is the signal number", 0u);
63 else B2ERROR(
"Unknown method , choose one of (abort, terminate, quick_exit, exit, "
80 throw std::runtime_error(
"DIE! DIE! DIE!");
85 #ifndef __clang_analyzer__
88 volatile int* foo {
nullptr};
94 #ifndef __clang_analyzer__
96 #if defined(__GNUC__) && defined(__x86_64__)
97 __asm__(
"pushf\norl $0x40000,(%rsp)\npopf");
99 auto* cptr = (
char*) malloc(
sizeof(
int) + 1);
100 auto* iptr = (
int*)(cptr + 1);
107 B2FATAL(
"Illegal method");
109 B2FATAL(
"This should never be called ...");
EMethod m_method
How to kill the event after parsing the string parameter.
std::string m_methodStr
How to kill the event, one of (abort, terminate, quick_exit, exit, exception, signal,...
void setDescription(const std::string &description)
Sets the description of the module.
int m_event
Current event.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
@ c_exception
raise std::runtime_error
@ c_terminate
call std::terminate
Abstract base class for different kinds of events.
TheKillerModule()
Constructor: Sets the description, the properties and the parameters of the module.
Class to store variables with their name which were sent to the logging service.
void event() override
kill if necessary
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
unsigned int m_parameter
Optional parameter for the kill method: for quick_exit and exit it is the return code,...
@ c_quick_exit
call std::quick_exit
int m_eventToKill
In which event to kill the processing.
@ c_signal
raise signal(N)
@ c_buserror
produce bus error
void initialize() override
parse the method parameter
@ c_segfault
produce segfault