Commit ddd01cfb authored by Kirill Smelkov's avatar Kirill Smelkov

Revert "X switch to libbacktrace"

This reverts commit 30740602.

libbracktrace is not always automatically installed.
parent 30740602
......@@ -70,8 +70,6 @@ CFLAGS := -g -Wall -D_GNU_SOURCE -std=gnu99 -fplan9-extensions \
-Wno-declaration-after-statement \
-Wno-error=declaration-after-statement \
LDLIBS := -lbacktrace
# XXX hack ugly
LOADLIBES=lib/bug.c lib/utils.c 3rdparty/ccan/ccan/tap/tap.c
TESTS := $(patsubst %.c,%,$(wildcard bigfile/tests/test_*.c))
......@@ -199,6 +197,7 @@ tfault := bigfile/tests/tfault
FAULTS := $(shell grep '{"fault.*"' $(tfault).c | sed 's/"/ /g' |awk '{print $$2}')
test.fault : $(FAULTS:%=%.tfault)
$(tfault).t: CFLAGS += -rdynamic # so that backtrace_symbols works
%.tfault : $(tfault).t
t/tfault-run $< $* $(shell grep '{"$*"' $(tfault).c | awk '{print $$NF}')
......
......@@ -28,8 +28,7 @@
#include <unistd.h>
#include <string.h>
#include <signal.h>
//#include <execinfo.h>
#include <backtrace.h>
#include <execinfo.h>
/* ilog2 that must be exact */
......@@ -177,32 +176,12 @@ void xwrite(int fd, const void *buf, size_t count)
}
}
static struct backtrace_state *__backtrace_state;
__attribute__((constructor))
static void traceback_init(void)
{
__backtrace_state = backtrace_create_state(
/*filename*/NULL,
/*threaded*/1,
/*error callback*/NULL,
/*data*/NULL);
}
/* dump traceback to fd */
void dump_traceback(int fd)
{
#if 0
void *pcv[256];
int n;
/* XXX better use https://github.com/ianlancetaylor/libbacktrace
* because backtrace_symbols often does not provide symbolic information */
n = backtrace(pcv, 256);
backtrace_symbols_fd(pcv, n, fd);
#else
backtrace_print(__backtrace_state, 0, stderr); // XXX use fd instead
#endif
}
......@@ -307,7 +307,6 @@ setup(
'lib/utils.c'],
depends = libvirtmem_h,
define_macros = [('_GNU_SOURCE',None), ('BUILDING_LIBVIRTMEM',None)],
libraries = ['backtrace'],
language = 'c'),
DSO('wendelin.wcfs.client.libwcfs',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment