VCluster.cpp 959 Bytes
Newer Older
incardon's avatar
incardon committed
1
#include "VCluster.hpp"
2
#include <execinfo.h>
incardon's avatar
incardon committed
3

4
Vcluster * global_v_cluster_private = NULL;
incardon's avatar
incardon committed
5

incardon's avatar
incardon committed
6
// number of vcluster instances
7
size_t n_vcluster = 0;
Pietro Incardona's avatar
Pietro Incardona committed
8
bool ofp_initialized = false;
incardon's avatar
incardon committed
9 10 11

size_t tot_sent = 0;
size_t tot_recv = 0;
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

std::string program_name;

// Segmentation fault signal handler
void bt_sighandler(int sig, siginfo_t * info, void * ctx_p)
{
	void *trace[16];
	char **messages = NULL;
	int i, trace_size = 0;

	if (sig == SIGSEGV)
		std::cout << "Got signal " << sig << " faulty address is %p, " << info->si_addr << " from " << info->si_pid << std::endl;
	else
		std:: cout << "Got signal " << sig << std::endl;

	trace_size = backtrace(trace, 16);
	/* overwrite sigaction with caller's address */
	trace[1] = (void *)info->si_addr;
	messages = backtrace_symbols(trace, trace_size);
	/* skip first stack frame (points here) */
	printf("[bt] Execution path:\n");
	for (i=1; i<trace_size; ++i)
	{
		printf("[bt] #%d %s\n", i, messages[i]);
	}

	exit(0);
}