mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 16:40:42 +08:00
A better test program for core files.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
hellocore
|
||||
*.seer
|
||||
core.*
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "function1.h"
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
void function1 (const std::string& text);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "function1.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
int main (int argc, char** argv) {
|
||||
|
||||
for (int i=0; i<argc; i++) {
|
||||
std::cout << "XX: " << i << " " << argv[i] << std::endl;
|
||||
}
|
||||
|
||||
std::string message = "Hello, World!";
|
||||
|
||||
function1(message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user