#include <iostream>
#include "callstackpp.hpp"
static callstackpp::SignalHandler sh;
int invalid_read() {
char *ptr = reinterpret_cast<char *>(42);
int v = *ptr;
return v;
}
void invalid_write() {
char *ptr = reinterpret_cast<char *>(42);
*ptr = 42;
}
void call_abort() {
std::cout << "Aborting!\n";
abort();
}
int main() {
// Try commenting and uncommenting different lines in this method to test
std::cout << invalid_read() << '\n';
// invalid_write();
// call_abort();
}
# build test binaries
make
# run tests
make test
The default test binaries will be built in release mode (with debug info). You can make Debug test binaries as well:
make clean
make debug
make test
Enable additional sanitizers to catch hard-to-find bugs, for example:
export LDFLAGS="-fsanitize=address,undefined"
export CXXFLAGS="-fsanitize=address,undefined"
make
callstackpp is licensed under MIT.