From d0d9c3a676063e407b42e733f65ac2368536926a Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 10 Oct 2019 17:33:12 +1100 Subject: [PATCH] tools: add a 'crash' tool that triggers a segfault --- CMakeLists.txt | 2 +- tools/crash.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tools/crash.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c9ad9b9..dc20202d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -622,7 +622,7 @@ endif () ############################################################################### -foreach (tool backtrace cpuid log poisson macro scratch) +foreach (tool backtrace cpuid crash log poisson macro scratch) add_executable (util_${tool} tools/${tool}.cpp) set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool}) target_link_libraries (util_${tool} cruft) diff --git a/tools/crash.cpp b/tools/crash.cpp new file mode 100644 index 00000000..2f6ba28b --- /dev/null +++ b/tools/crash.cpp @@ -0,0 +1,7 @@ +#include + +int main () +{ + cruft::debug::init (); + return *reinterpret_cast (0x01); +} \ No newline at end of file