Fix: lttng-ust-malloc ip context
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 10 Jun 2015 11:15:09 +0000 (13:15 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 10 Jun 2015 11:51:25 +0000 (13:51 +0200)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-libc-wrapper/lttng-ust-malloc.c
liblttng-ust-libc-wrapper/ust_libc.h

index 54afb1445785381aefeeb658ce3ba30ae573420d..27624a3d821465bb0c1f9ceacfb09489d683f632 100644 (file)
@@ -31,6 +31,7 @@
 
 #define TRACEPOINT_DEFINE
 #define TRACEPOINT_CREATE_PROBES
+#define TP_IP_PARAM ip
 #include "ust_libc.h"
 
 #define STATIC_CALLOC_LEN 4096
@@ -260,7 +261,8 @@ void *malloc(size_t size)
        }
        retval = cur_alloc.malloc(size);
        if (URCU_TLS(malloc_nesting) == 1) {
-               tracepoint(ust_libc, malloc, size, retval);
+               tracepoint(ust_libc, malloc, size, retval,
+                       __builtin_return_address(0));
        }
        URCU_TLS(malloc_nesting)--;
        return retval;
@@ -279,7 +281,8 @@ void free(void *ptr)
        }
 
        if (URCU_TLS(malloc_nesting) == 1) {
-               tracepoint(ust_libc, free, ptr);
+               tracepoint(ust_libc, free, ptr,
+                       __builtin_return_address(0));
        }
 
        if (cur_alloc.free == NULL) {
@@ -308,7 +311,8 @@ void *calloc(size_t nmemb, size_t size)
        }
        retval = cur_alloc.calloc(nmemb, size);
        if (URCU_TLS(malloc_nesting) == 1) {
-               tracepoint(ust_libc, calloc, nmemb, size, retval);
+               tracepoint(ust_libc, calloc, nmemb, size, retval,
+                       __builtin_return_address(0));
        }
        URCU_TLS(malloc_nesting)--;
        return retval;
@@ -360,7 +364,8 @@ void *realloc(void *ptr, size_t size)
        retval = cur_alloc.realloc(ptr, size);
 end:
        if (URCU_TLS(malloc_nesting) == 1) {
-               tracepoint(ust_libc, realloc, ptr, size, retval);
+               tracepoint(ust_libc, realloc, ptr, size, retval,
+                       __builtin_return_address(0));
        }
        URCU_TLS(malloc_nesting)--;
        return retval;
@@ -380,7 +385,8 @@ void *memalign(size_t alignment, size_t size)
        }
        retval = cur_alloc.memalign(alignment, size);
        if (URCU_TLS(malloc_nesting) == 1) {
-               tracepoint(ust_libc, memalign, alignment, size, retval);
+               tracepoint(ust_libc, memalign, alignment, size, retval,
+                       __builtin_return_address(0));
        }
        URCU_TLS(malloc_nesting)--;
        return retval;
@@ -401,7 +407,7 @@ int posix_memalign(void **memptr, size_t alignment, size_t size)
        retval = cur_alloc.posix_memalign(memptr, alignment, size);
        if (URCU_TLS(malloc_nesting) == 1) {
                tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,
-                       retval);
+                       retval, __builtin_return_address(0));
        }
        URCU_TLS(malloc_nesting)--;
        return retval;
index a8ff9c65e846769f4184222e57eeff6d145fd46c..632d95de073a01eb0d4efb185bd5fd5bbe5db494 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 #include <lttng/tracepoint.h>
 
 TRACEPOINT_EVENT(ust_libc, malloc,
-       TP_ARGS(size_t, size, void *, ptr),
+       TP_ARGS(size_t, size, void *, ptr, void *, ip),
        TP_FIELDS(
                ctf_integer(size_t, size, size)
                ctf_integer_hex(void *, ptr, ptr)
@@ -41,14 +41,14 @@ TRACEPOINT_EVENT(ust_libc, malloc,
 )
 
 TRACEPOINT_EVENT(ust_libc, free,
-       TP_ARGS(void *, ptr),
+       TP_ARGS(void *, ptr, void *, ip),
        TP_FIELDS(
                ctf_integer_hex(void *, ptr, ptr)
        )
 )
 
 TRACEPOINT_EVENT(ust_libc, calloc,
-       TP_ARGS(size_t, nmemb, size_t, size, void *, ptr),
+       TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, ip),
        TP_FIELDS(
                ctf_integer(size_t, nmemb, nmemb)
                ctf_integer(size_t, size, size)
@@ -57,7 +57,7 @@ TRACEPOINT_EVENT(ust_libc, calloc,
 )
 
 TRACEPOINT_EVENT(ust_libc, realloc,
-       TP_ARGS(void *, in_ptr, size_t, size, void *, ptr),
+       TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, ip),
        TP_FIELDS(
                ctf_integer_hex(void *, in_ptr, in_ptr)
                ctf_integer(size_t, size, size)
@@ -66,7 +66,7 @@ TRACEPOINT_EVENT(ust_libc, realloc,
 )
 
 TRACEPOINT_EVENT(ust_libc, memalign,
-       TP_ARGS(size_t, alignment, size_t, size, void *, ptr),
+       TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, ip),
        TP_FIELDS(
                ctf_integer(size_t, alignment, alignment)
                ctf_integer(size_t, size, size)
@@ -75,7 +75,8 @@ TRACEPOINT_EVENT(ust_libc, memalign,
 )
 
 TRACEPOINT_EVENT(ust_libc, posix_memalign,
-       TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result),
+       TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result,
+               void *, ip),
        TP_FIELDS(
                ctf_integer_hex(void *, out_ptr, out_ptr)
                ctf_integer(size_t, alignment, alignment)
This page took 0.02701 seconds and 4 git commands to generate.