diff --git a/tests/hellocore/.gitignore b/tests/hellocore/.gitignore new file mode 100644 index 0000000..a2b46dd --- /dev/null +++ b/tests/hellocore/.gitignore @@ -0,0 +1,3 @@ +hellocore +*.seer +core.* diff --git a/tests/hellocore/Makefile b/tests/hellocore/Makefile new file mode 100644 index 0000000..4710755 --- /dev/null +++ b/tests/hellocore/Makefile @@ -0,0 +1,10 @@ +.PHONY: all +all: hellocore + +hellocore: hellocore.cpp + g++ -g -o hellocore hellocore.cpp function1.cpp + +.PHONY: clean +clean: + rm -f hellocore hellocore.o function1.o + diff --git a/tests/hellocore/README.corefile b/tests/hellocore/README.corefile new file mode 100644 index 0000000..d6b4d3f --- /dev/null +++ b/tests/hellocore/README.corefile @@ -0,0 +1,11 @@ + +See notes/README.coredump + +Quick setup. Some as root. + + % ulimit -c unlimited + % install -m 1777 -d /var/local/dumps + % (root) echo "/var/local/dumps/core.%e.%p"> /proc/sys/kernel/core_pattern + % (root) rcapparmor stop + % (root) sysctl -w kernel.suid_dumpable=2 + diff --git a/tests/hellocore/function1.cpp b/tests/hellocore/function1.cpp new file mode 100644 index 0000000..f65e752 --- /dev/null +++ b/tests/hellocore/function1.cpp @@ -0,0 +1,23 @@ +#include "function1.h" +#include +#include +#include + + +void function1 (const std::string& text) { + + int i = 42; + + sleep(2); // Simulate doing work. + + std::cout << text << i << std::endl; + + //raise(SIGSEGV); + + int* x = 0; + + *x = 2112; + + sleep(3); // Simulate doing work. +} + diff --git a/tests/hellocore/function1.h b/tests/hellocore/function1.h new file mode 100644 index 0000000..8f24a9b --- /dev/null +++ b/tests/hellocore/function1.h @@ -0,0 +1,6 @@ +#pragma once + +#include + +void function1 (const std::string& text); + diff --git a/tests/hellocore/hellocore.cpp b/tests/hellocore/hellocore.cpp new file mode 100644 index 0000000..73eab62 --- /dev/null +++ b/tests/hellocore/hellocore.cpp @@ -0,0 +1,17 @@ +#include "function1.h" +#include +#include + +int main (int argc, char** argv) { + + for (int i=0; i