X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=include%2Flttng%2Ftracepoint.h;h=cf3519cd25739aee8688811e963a48c3d25a7cc1;hb=63661b6634527fca365d4ac9e46cc9c8c94c1e49;hp=17fa2a0c68ef884857cc6dfa5066172e425d2b0d;hpb=e0ca901df9ff4742dfcaf1c8839f042760197555;p=lttng-ust.git diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 17fa2a0c..cf3519cd 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -413,25 +413,40 @@ bool lttng_ust_tracepoint_logging_debug_enabled(void) } #endif /* #ifdef LTTNG_UST_DEBUG */ +#ifdef LTTNG_UST_ABORT_ON_CRITICAL +static inline +bool lttng_ust_tracepoint_logging_abort_on_critical_enabled(void) +{ + return true; +} +#else /* #ifdef LTTNG_UST_ABORT_ON_CRITICAL */ +static inline +bool lttng_ust_tracepoint_logging_abort_on_critical_enabled(void) +{ + return getenv("LTTNG_UST_ABORT_ON_CRITICAL"); +} +#endif + #define LTTNG_UST_TRACEPOINT_THIS_IP \ ({ __label__ here; here: &&here; }) static void lttng_ust_tracepoints_print_disabled_message(void) { - if (!lttng_ust_tracepoint_logging_debug_enabled()) - return; - fprintf(stderr, "lttng-ust-tracepoint [%ld]: dlopen() failed to find '%s', tracepoints in this binary won't be registered. " - "(at addr=%p in %s() at " __FILE__ ":" lttng_ust_stringify(__LINE__) ")\n", - (long) getpid(), - LTTNG_UST_TRACEPOINT_LIB_SONAME, - LTTNG_UST_TRACEPOINT_THIS_IP, - __func__); + if (lttng_ust_tracepoint_logging_debug_enabled()) + fprintf(stderr, "lttng-ust-tracepoint [%ld]: Critical: dlopen() failed to find '%s', tracepoints in this binary won't be registered. " + "(at addr=%p in %s() at " __FILE__ ":" lttng_ust_stringify(__LINE__) ")\n", + (long) getpid(), + LTTNG_UST_TRACEPOINT_LIB_SONAME, + LTTNG_UST_TRACEPOINT_THIS_IP, + __func__); + if (lttng_ust_tracepoint_logging_abort_on_critical_enabled()) + abort(); } static void lttng_ust__tracepoints__init(void) - lttng_ust_notrace __attribute__((constructor)); + lttng_ust_notrace __attribute__((constructor(LTTNG_UST_CONSTRUCTOR_PRIO))); static void lttng_ust__tracepoints__init(void) { @@ -456,7 +471,7 @@ lttng_ust__tracepoints__init(void) static void lttng_ust__tracepoints__destroy(void) - lttng_ust_notrace __attribute__((destructor)); + lttng_ust_notrace __attribute__((destructor(LTTNG_UST_CONSTRUCTOR_PRIO))); static void lttng_ust__tracepoints__destroy(void) { @@ -568,7 +583,7 @@ extern struct lttng_ust_tracepoint * const __stop_lttng_ust_tracepoints_ptrs[] static void lttng_ust__tracepoints__ptrs_init(void) - lttng_ust_notrace __attribute__((constructor)); + lttng_ust_notrace __attribute__((constructor(LTTNG_UST_CONSTRUCTOR_PRIO))); static void lttng_ust__tracepoints__ptrs_init(void) { @@ -611,7 +626,7 @@ lttng_ust__tracepoints__ptrs_init(void) static void lttng_ust__tracepoints__ptrs_destroy(void) - lttng_ust_notrace __attribute__((destructor)); + lttng_ust_notrace __attribute__((destructor(LTTNG_UST_CONSTRUCTOR_PRIO))); static void lttng_ust__tracepoints__ptrs_destroy(void) {