carl
24.04
Computer ARithmetic Library
|
#include <csignal>
#include <forward_list>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <typeinfo>
#include <unordered_map>
#include <vector>
#include "../meta/platform.h"
#include <unistd.h>
Go to the source code of this file.
Namespaces | |
carl | |
carl is the main namespace for the library. | |
Macros | |
#define | REGISTER_ASSERT |
Registers an upcoming assertion with the SIGABRT signal handler. More... | |
#define | UNREGISTER_ASSERT |
#define | REGISTERED_ASSERT(condition) REGISTER_ASSERT; assert(condition); UNREGISTER_ASSERT |
Functions | |
void | carl::printStacktrace () |
Uses GDB to print a stack trace. More... | |
std::string | carl::demangle (const char *name) |
std::string | carl::callingFunction () |
template<typename T > | |
std::string | carl::typeString () |
Definition in file debug.h.
#define REGISTER_ASSERT |
Registers an upcoming assertion with the SIGABRT signal handler.
If the program is compiled in debug mode, a signal handler is installed automatically that catches SIGABRT that is send when an assertion fails. The signal handler uses the data in last_assertion_string and last_assertion_code to generate an additional message and a custom exit code whenever an assertion is thrown. As for last_assertion_code the line number of the usage of this macro is used.
If REGISTER_ASSERT was not called before SIGABRT is catched, the exit code is 23.
This macro is intended to be used to identify a single assertion from the exit code in automated testing, for example using the delta debugger. The usage will usually look like this:
#define REGISTERED_ASSERT | ( | condition | ) | REGISTER_ASSERT; assert(condition); UNREGISTER_ASSERT |
#define UNREGISTER_ASSERT |