#define LTTNG_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+/*
+ * Use of __builtin_return_address(0) sometimes seems to cause stack
+ * corruption on 32-bit PowerPC. Disable this feature on that
+ * architecture for now by always using the NULL value for the ip
+ * context.
+ */
+#if defined(__PPC__) && !defined(__PPC64__)
+#define LTTNG_UST_CALLER_IP() NULL
+#else /* #if defined(__PPC__) && !defined(__PPC64__) */
+#define LTTNG_UST_CALLER_IP() __builtin_return_address(0)
+#endif /* #else #if defined(__PPC__) && !defined(__PPC64__) */
+
#endif /* _LTTNG_UST_HELPER_H */
#include <signal.h>
#include <sched.h>
#include <stdarg.h>
+#include <helper.h>
#include "usterr-signal-safe.h"
#include <lttng/ust-compiler.h>
if (dlinfo(handle, RTLD_DI_LINKMAP, &p) != -1 && p != NULL
&& p->l_addr != 0)
lttng_ust_dl_dlopen((void *) p->l_addr, p->l_name,
- __builtin_return_address(0));
+ LTTNG_UST_CALLER_IP());
}
return handle;
}
if (dlinfo(handle, RTLD_DI_LINKMAP, &p) != -1 && p != NULL
&& p->l_addr != 0)
tracepoint(lttng_ust_dl, dlclose, (void *) p->l_addr,
- __builtin_return_address(0));
+ LTTNG_UST_CALLER_IP());
}
return _lttng_ust_dl_libc_dlclose(handle);
}
#include <urcu/tls-compat.h>
#include <urcu/arch.h>
#include <lttng/align.h>
+#include <helper.h>
#define TRACEPOINT_DEFINE
#define TRACEPOINT_CREATE_PROBES
retval = cur_alloc.malloc(size);
if (URCU_TLS(malloc_nesting) == 1) {
tracepoint(lttng_ust_libc, malloc,
- size, retval, __builtin_return_address(0));
+ size, retval, LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
return retval;
if (URCU_TLS(malloc_nesting) == 1) {
tracepoint(lttng_ust_libc, free,
- ptr, __builtin_return_address(0));
+ ptr, LTTNG_UST_CALLER_IP());
}
if (cur_alloc.free == NULL) {
retval = cur_alloc.calloc(nmemb, size);
if (URCU_TLS(malloc_nesting) == 1) {
tracepoint(lttng_ust_libc, calloc,
- nmemb, size, retval, __builtin_return_address(0));
+ nmemb, size, retval, LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
return retval;
end:
if (URCU_TLS(malloc_nesting) == 1) {
tracepoint(lttng_ust_libc, realloc,
- ptr, size, retval, __builtin_return_address(0));
+ ptr, size, retval, LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
return retval;
if (URCU_TLS(malloc_nesting) == 1) {
tracepoint(lttng_ust_libc, memalign,
alignment, size, retval,
- __builtin_return_address(0));
+ LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
return retval;
if (URCU_TLS(malloc_nesting) == 1) {
tracepoint(lttng_ust_libc, posix_memalign,
*memptr, alignment, size,
- retval, __builtin_return_address(0));
+ retval, LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
return retval;
#define _GNU_SOURCE
#include <lttng/ust-dlfcn.h>
+#include <helper.h>
#include <pthread.h>
#define TRACEPOINT_DEFINE
thread_in_trace = 1;
tracepoint(lttng_ust_pthread, pthread_mutex_lock_req, mutex,
- __builtin_return_address(0));
+ LTTNG_UST_CALLER_IP());
retval = mutex_lock(mutex);
tracepoint(lttng_ust_pthread, pthread_mutex_lock_acq, mutex,
- retval, __builtin_return_address(0));
+ retval, LTTNG_UST_CALLER_IP());
thread_in_trace = 0;
return retval;
}
thread_in_trace = 1;
retval = mutex_trylock(mutex);
tracepoint(lttng_ust_pthread, pthread_mutex_trylock, mutex,
- retval, __builtin_return_address(0));
+ retval, LTTNG_UST_CALLER_IP());
thread_in_trace = 0;
return retval;
}
thread_in_trace = 1;
retval = mutex_unlock(mutex);
tracepoint(lttng_ust_pthread, pthread_mutex_unlock, mutex,
- retval, __builtin_return_address(0));
+ retval, LTTNG_UST_CALLER_IP());
thread_in_trace = 0;
return retval;
}
#define _GNU_SOURCE
#define _LGPL_SOURCE
#include <stdio.h>
+#include <helper.h>
#define TRACEPOINT_CREATE_PROBES
#define TRACEPOINT_DEFINE
if (len < 0)
goto end;
__tracepoint_cb_lttng_ust_tracef___event(msg, len,
- __builtin_return_address(0));
+ LTTNG_UST_CALLER_IP());
free(msg);
end:
va_end(ap);
#define _GNU_SOURCE
#define _LGPL_SOURCE
#include <stdio.h>
+#include <helper.h>
#define TRACEPOINT_CREATE_PROBES
#define TRACEPOINT_DEFINE
goto end; \
__tracepoint_cb_lttng_ust_tracelog___##level(file, \
line, func, msg, len, \
- __builtin_return_address(0)); \
+ LTTNG_UST_CALLER_IP()); \
free(msg); \
end: \
va_end(ap); \