author | Alberto Bertogli
<albertito@blitiri.com.ar> 2014-05-25 19:02:16 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2014-05-25 23:45:16 UTC |
parent | 5e3a2b4357a5b4bed091f70418612b3682e06257 |
libfiu/Makefile | +3 | -0 |
libfiu/fiu.c | +14 | -3 |
diff --git a/libfiu/Makefile b/libfiu/Makefile index 5981b64..4a752ca 100644 --- a/libfiu/Makefile +++ b/libfiu/Makefile @@ -15,6 +15,9 @@ else endif endif +ifdef TRACE + ALL_CFLAGS += -DFIU_TRACE=1 +endif # prefix for installing the binaries PREFIX=/usr/local diff --git a/libfiu/fiu.c b/libfiu/fiu.c index ce89112..fd71815 100644 --- a/libfiu/fiu.c +++ b/libfiu/fiu.c @@ -14,6 +14,15 @@ #include "internal.h" #include "wtable.h" +/* Tracing mode for debugging libfiu itself. */ +#ifdef FIU_TRACE + #include <stdio.h> + #define trace(...) \ + do { fprintf(stderr, __VA_ARGS__); fflush(stderr); } while (0) +#else + #define trace(...) do { } while(0) +#endif + /* Different methods to decide when a point of failure fails */ enum pf_method { @@ -275,9 +284,7 @@ int fiu_fail(const char *name) /* None found. */ if (pf == NULL) { - ef_runlock(); - rec_count--; - return 0; + goto exit; } if (pf->flags & FIU_ONETIME) { @@ -318,11 +325,15 @@ int fiu_fail(const char *name) } exit: + trace("FIU Not failing %s\n", name); + ef_runlock(); rec_count--; return 0; exit_fail: + trace("FIU Failing %s on %s\n", name, pf->name); + pthread_setspecific(last_failinfo_key, pf->failinfo); failnum = pf->failnum;