From 3516b8b7558a69dfd06410b0c997d096a78221c9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 1 Sep 2016 11:20:05 +0200 Subject: Add libmissing This patch adds a libmissing library to mtd-utils, containing implementations of functionality found in glibc but typically missing from embedded C libraries such as uclibc ot musl. For now, the library only contains stub implementations of the backtrace*() family of functions. Signed-off-by: David Oberhollenzer Signed-off-by: Richard Weinberger --- lib/execinfo.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/execinfo.c (limited to 'lib/execinfo.c') diff --git a/lib/execinfo.c b/lib/execinfo.c new file mode 100644 index 0000000..a39df83 --- /dev/null +++ b/lib/execinfo.c @@ -0,0 +1,25 @@ +#include "libmissing.h" + +#ifndef HAVE_EXECINFO +#define PROGRAM_NAME "libmissing" +#include "common.h" + +int backtrace(void **buffer, int size) +{ + void *addr = __builtin_return_address(0); + + errmsg("backtrace() is not implemented. Called from %p", addr); + return 0; +} + +char **backtrace_symbols(void *const *buffer, int size) +{ + errmsg("backtrace_symbols() is not implemented"); + return NULL; +} + +void backtrace_symbols_fd(void *const *buffer, int size, int fd) +{ + errmsg("backtrace_symbols_fd() is not implemented"); +} +#endif /* !HAVE_EXECINFO */ -- cgit v1.2.3