diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-27 13:41:40 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-27 13:43:09 +0200 |
commit | 61fdc3c23af1c842da8cd66673d5ce0ad5f1c6cf (patch) | |
tree | 0bc34c617b5cd3b81d18912399bc154991c5fe64 /src | |
parent | b17cf07336199d7e23b8c6a2d6e948e1a50bf07c (diff) |
wrapper: Don't wrap NULL functions
Diffstat (limited to 'src')
-rw-r--r-- | src/wrapper/verbose.h | 13 | ||||
-rw-r--r-- | 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 <stdio.h> -# include <stdarg.h> -# include <pthread.h> +#include <stdio.h> +#include <stdarg.h> +#include <pthread.h> + 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"); |