From 61fdc3c23af1c842da8cd66673d5ce0ad5f1c6cf Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Tue, 27 Feb 2018 13:41:40 +0200 Subject: wrapper: Don't wrap NULL functions --- src/wrapper/verbose.h | 13 ++++++++----- src/wrapper/wrapper.c | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/wrapper/verbose.h b/src/wrapper/verbose.h index 06ee681..00f72a0 100644 --- a/src/wrapper/verbose.h +++ b/src/wrapper/verbose.h @@ -1,11 +1,11 @@ #pragma once -#ifdef VERBOSE_FUNCTIONS -# include -# include -# include +#include +#include +#include + static void -verbose(const char *fmt, ...) +verbose_log(const char *fmt, ...) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&mutex); @@ -17,6 +17,9 @@ verbose(const char *fmt, ...) fputc('\n', stderr); pthread_mutex_unlock(&mutex); } + +#ifdef VERBOSE_FUNCTIONS +# define verbose verbose_log #else # define verbose(...) #endif diff --git a/src/wrapper/wrapper.c b/src/wrapper/wrapper.c index 44e0802..d7feff5 100644 --- a/src/wrapper/wrapper.c +++ b/src/wrapper/wrapper.c @@ -61,6 +61,11 @@ wrapper_create(const char *const symbol, void *function) { assert(symbol); + if (!function) { + verbose_log("FIXME: unimplemented symbol: %s", symbol); + return NULL; + } + #ifdef WRAPPER_TRACE if (!__cxa_demangle.ptr) __cxa_demangle.ptr = dlsym(RTLD_DEFAULT, "__cxa_demangle"); -- cgit v1.2.3-70-g09d2