lib_LTLIBRARIES = liblttng-ust-dl.la
liblttng_ust_dl_la_SOURCES = \
- ustdl.c \
- ust_baddr.c \
- ust_baddr.h
+ lttng-ust-dl.c \
+ ust_dl.c \
+ ust_dl.h
liblttng_ust_dl_la_LIBADD = \
$(top_builddir)/liblttng-ust/liblttng-ust.la
--- /dev/null
+/*
+ * Copyright (C) 2013 Paul Woegerer <paul.woegerer@mentor.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; version 2.1 of
+ * the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define _LGPL_SOURCE
+#define _GNU_SOURCE
+#include <lttng/ust-dlfcn.h>
+#include <inttypes.h>
+#include <link.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <sched.h>
+#include <stdarg.h>
+#include "usterr-signal-safe.h"
+
+#include <lttng/ust-compiler.h>
+#include <lttng/ust.h>
+
+#define TRACEPOINT_DEFINE
+#include "ust_dl.h"
+
+static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flag);
+static int (*__lttng_ust_plibc_dlclose)(void *handle);
+
+static
+void *_lttng_ust_dl_libc_dlopen(const char *filename, int flag)
+{
+ if (!__lttng_ust_plibc_dlopen) {
+ __lttng_ust_plibc_dlopen = dlsym(RTLD_NEXT, "dlopen");
+ if (__lttng_ust_plibc_dlopen == NULL) {
+ fprintf(stderr, "%s\n", dlerror());
+ return NULL;
+ }
+ }
+ return __lttng_ust_plibc_dlopen(filename, flag);
+}
+
+static
+int _lttng_ust_dl_libc_dlclose(void *handle)
+{
+ if (!__lttng_ust_plibc_dlclose) {
+ __lttng_ust_plibc_dlclose = dlsym(RTLD_NEXT, "dlclose");
+ if (__lttng_ust_plibc_dlclose == NULL) {
+ fprintf(stderr, "%s\n", dlerror());
+ return -1;
+ }
+ }
+ return __lttng_ust_plibc_dlclose(handle);
+}
+
+static
+void lttng_ust_dl_dlopen(void *so_base, const char *so_name)
+{
+ char resolved_path[PATH_MAX];
+ struct stat sostat;
+
+ if (!realpath(so_name, resolved_path)) {
+ ERR("could not resolve path '%s'", so_name);
+ return;
+ }
+
+ if (stat(resolved_path, &sostat)) {
+ ERR("could not access file status for %s", resolved_path);
+ return;
+ }
+
+ tracepoint(lttng_ust_dl, dlopen,
+ so_base, resolved_path, sostat.st_size, sostat.st_mtime);
+ return;
+}
+
+void *dlopen(const char *filename, int flag)
+{
+ void *handle = _lttng_ust_dl_libc_dlopen(filename, flag);
+ if (__tracepoint_ptrs_registered && handle) {
+ struct link_map *p = NULL;
+ 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);
+ }
+ return handle;
+}
+
+int dlclose(void *handle)
+{
+ if (__tracepoint_ptrs_registered && handle) {
+ struct link_map *p = NULL;
+ if (dlinfo(handle, RTLD_DI_LINKMAP, &p) != -1 && p != NULL
+ && p->l_addr != 0)
+ tracepoint(lttng_ust_dl, dlclose, (void *) p->l_addr);
+ }
+ return _lttng_ust_dl_libc_dlclose(handle);
+}
+++ /dev/null
-/*
- * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define _LGPL_SOURCE
-#define TRACEPOINT_CREATE_PROBES
-#include "ust_baddr.h"
+++ /dev/null
-#undef TRACEPOINT_PROVIDER
-#define TRACEPOINT_PROVIDER ust_baddr
-
-#if !defined(_TRACEPOINT_UST_BADDR_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
-#define _TRACEPOINT_UST_BADDR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <unistd.h>
-
-#define LTTNG_UST_BADDR_PROVIDER
-#include <lttng/tracepoint.h>
-
-TRACEPOINT_EVENT(ust_baddr, push,
- TP_ARGS(void *, baddr, const char*, sopath, int64_t, size, int64_t, mtime),
- TP_FIELDS(
- ctf_integer_hex(void *, baddr, baddr)
- ctf_string(sopath, sopath)
- ctf_integer(int64_t, size, size)
- ctf_integer(int64_t, mtime, mtime)
- )
-)
-
-TRACEPOINT_EVENT(ust_baddr, pop,
- TP_ARGS(void *, baddr),
- TP_FIELDS(
- ctf_integer_hex(void *, baddr, baddr)
- )
-)
-
-#endif /* _TRACEPOINT_UST_BADDR_H */
-
-#undef TRACEPOINT_INCLUDE
-#define TRACEPOINT_INCLUDE "./ust_baddr.h"
-
-/* This part must be outside ifdef protection */
-#include <lttng/tracepoint-event.h>
-
-#ifdef __cplusplus
-}
-#endif
--- /dev/null
+/*
+ * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define _LGPL_SOURCE
+#define TRACEPOINT_CREATE_PROBES
+#include "ust_dl.h"
--- /dev/null
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER lttng_ust_dl
+
+#if !defined(_TRACEPOINT_UST_DL_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_UST_DL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2013 Paul Woegerer <paul_woegerer@mentor.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <unistd.h>
+
+#define LTTNG_UST_DL_PROVIDER
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(lttng_ust_dl, dlopen,
+ TP_ARGS(void *, baddr, const char*, sopath, int64_t, size, int64_t, mtime),
+ TP_FIELDS(
+ ctf_integer_hex(void *, baddr, baddr)
+ ctf_string(sopath, sopath)
+ ctf_integer(int64_t, size, size)
+ ctf_integer(int64_t, mtime, mtime)
+ )
+)
+
+TRACEPOINT_EVENT(lttng_ust_dl, dlclose,
+ TP_ARGS(void *, baddr),
+ TP_FIELDS(
+ ctf_integer_hex(void *, baddr, baddr)
+ )
+)
+
+#endif /* _TRACEPOINT_UST_DL_H */
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./ust_dl.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
+++ /dev/null
-/*
- * Copyright (C) 2013 Paul Woegerer <paul.woegerer@mentor.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define _LGPL_SOURCE
-#define _GNU_SOURCE
-#include <lttng/ust-dlfcn.h>
-#include <inttypes.h>
-#include <link.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <sched.h>
-#include <stdarg.h>
-#include "usterr-signal-safe.h"
-
-#include <lttng/ust-compiler.h>
-#include <lttng/ust.h>
-
-#define TRACEPOINT_DEFINE
-#include "ust_baddr.h"
-
-static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flag);
-static int (*__lttng_ust_plibc_dlclose)(void *handle);
-
-static
-void *_lttng_ust_dl_libc_dlopen(const char *filename, int flag)
-{
- if (!__lttng_ust_plibc_dlopen) {
- __lttng_ust_plibc_dlopen = dlsym(RTLD_NEXT, "dlopen");
- if (__lttng_ust_plibc_dlopen == NULL) {
- fprintf(stderr, "%s\n", dlerror());
- return NULL;
- }
- }
- return __lttng_ust_plibc_dlopen(filename, flag);
-}
-
-static
-int _lttng_ust_dl_libc_dlclose(void *handle)
-{
- if (!__lttng_ust_plibc_dlclose) {
- __lttng_ust_plibc_dlclose = dlsym(RTLD_NEXT, "dlclose");
- if (__lttng_ust_plibc_dlclose == NULL) {
- fprintf(stderr, "%s\n", dlerror());
- return -1;
- }
- }
- return __lttng_ust_plibc_dlclose(handle);
-}
-
-static
-void lttng_ust_baddr_push(void *so_base, const char *so_name)
-{
- char resolved_path[PATH_MAX];
- struct stat sostat;
-
- if (!realpath(so_name, resolved_path)) {
- ERR("could not resolve path '%s'", so_name);
- return;
- }
-
- if (stat(resolved_path, &sostat)) {
- ERR("could not access file status for %s", resolved_path);
- return;
- }
-
- tracepoint(ust_baddr, push,
- so_base, resolved_path, sostat.st_size, sostat.st_mtime);
- return;
-}
-
-void *dlopen(const char *filename, int flag)
-{
- void *handle = _lttng_ust_dl_libc_dlopen(filename, flag);
- if (__tracepoint_ptrs_registered && handle) {
- struct link_map *p = NULL;
- if (dlinfo(handle, RTLD_DI_LINKMAP, &p) != -1 && p != NULL
- && p->l_addr != 0)
- lttng_ust_baddr_push((void *) p->l_addr, p->l_name);
- }
- return handle;
-}
-
-int dlclose(void *handle)
-{
- if (__tracepoint_ptrs_registered && handle) {
- struct link_map *p = NULL;
- if (dlinfo(handle, RTLD_DI_LINKMAP, &p) != -1 && p != NULL
- && p->l_addr != 0)
- tracepoint(ust_baddr, pop, (void *) p->l_addr);
- }
- return _lttng_ust_dl_libc_dlclose(handle);
-}
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
}
retval = cur_alloc.malloc(size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(ust_libc, malloc, size, retval, __builtin_return_address(0));
+ tracepoint(lttng_ust_libc, malloc,
+ size, retval, __builtin_return_address(0));
}
URCU_TLS(malloc_nesting)--;
return retval;
}
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(ust_libc, free, ptr, __builtin_return_address(0));
+ tracepoint(lttng_ust_libc, free,
+ ptr, __builtin_return_address(0));
}
if (cur_alloc.free == NULL) {
}
retval = cur_alloc.calloc(nmemb, size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(ust_libc, calloc, nmemb, size, retval, __builtin_return_address(0));
+ tracepoint(lttng_ust_libc, calloc,
+ nmemb, size, retval, __builtin_return_address(0));
}
URCU_TLS(malloc_nesting)--;
return retval;
retval = cur_alloc.realloc(ptr, size);
end:
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(ust_libc, realloc, ptr, size, retval, __builtin_return_address(0));
+ tracepoint(lttng_ust_libc, realloc,
+ ptr, size, retval, __builtin_return_address(0));
}
URCU_TLS(malloc_nesting)--;
return retval;
}
retval = cur_alloc.memalign(alignment, size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(ust_libc, memalign, alignment, size, retval, __builtin_return_address(0));
+ tracepoint(lttng_ust_libc, memalign,
+ alignment, size, retval,
+ __builtin_return_address(0));
}
URCU_TLS(malloc_nesting)--;
return retval;
}
retval = cur_alloc.posix_memalign(memptr, alignment, size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(ust_libc, posix_memalign, *memptr, alignment, size,
+ tracepoint(lttng_ust_libc, posix_memalign,
+ *memptr, alignment, size,
retval, __builtin_return_address(0));
}
URCU_TLS(malloc_nesting)--;
}
thread_in_trace = 1;
- tracepoint(ust_pthread, pthread_mutex_lock_req, mutex);
+ tracepoint(lttng_ust_pthread, pthread_mutex_lock_req, mutex);
retval = mutex_lock(mutex);
- tracepoint(ust_pthread, pthread_mutex_lock_acq, mutex, retval);
+ tracepoint(lttng_ust_pthread, pthread_mutex_lock_acq, mutex, retval);
thread_in_trace = 0;
return retval;
}
thread_in_trace = 1;
retval = mutex_trylock(mutex);
- tracepoint(ust_pthread, pthread_mutex_trylock, mutex, retval);
+ tracepoint(lttng_ust_pthread, pthread_mutex_trylock, mutex, retval);
thread_in_trace = 0;
return retval;
}
thread_in_trace = 1;
retval = mutex_unlock(mutex);
- tracepoint(ust_pthread, pthread_mutex_unlock, mutex, retval);
+ tracepoint(lttng_ust_pthread, pthread_mutex_unlock, mutex, retval);
thread_in_trace = 0;
return retval;
}
#undef TRACEPOINT_PROVIDER
-#define TRACEPOINT_PROVIDER ust_libc
+#define TRACEPOINT_PROVIDER lttng_ust_libc
#if !defined(_TRACEPOINT_UST_LIBC_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define _TRACEPOINT_UST_LIBC_H
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_libc, malloc,
+TRACEPOINT_EVENT(lttng_ust_libc, malloc,
TP_ARGS(size_t, size, void *, ptr, void *, caller),
TP_FIELDS(
ctf_integer(size_t, size, size)
)
)
-TRACEPOINT_EVENT(ust_libc, free,
+TRACEPOINT_EVENT(lttng_ust_libc, free,
TP_ARGS(void *, ptr, void *, caller),
TP_FIELDS(
ctf_integer_hex(void *, ptr, ptr)
)
)
-TRACEPOINT_EVENT(ust_libc, calloc,
+TRACEPOINT_EVENT(lttng_ust_libc, calloc,
TP_ARGS(size_t, nmemb, size_t, size, void *, ptr, void *, caller),
TP_FIELDS(
ctf_integer(size_t, nmemb, nmemb)
)
)
-TRACEPOINT_EVENT(ust_libc, realloc,
+TRACEPOINT_EVENT(lttng_ust_libc, realloc,
TP_ARGS(void *, in_ptr, size_t, size, void *, ptr, void *, caller),
TP_FIELDS(
ctf_integer_hex(void *, in_ptr, in_ptr)
)
)
-TRACEPOINT_EVENT(ust_libc, memalign,
+TRACEPOINT_EVENT(lttng_ust_libc, memalign,
TP_ARGS(size_t, alignment, size_t, size, void *, ptr, void *, caller),
TP_FIELDS(
ctf_integer(size_t, alignment, alignment)
)
)
-TRACEPOINT_EVENT(ust_libc, posix_memalign,
+TRACEPOINT_EVENT(lttng_ust_libc, posix_memalign,
TP_ARGS(void *, out_ptr, size_t, alignment, size_t, size, int, result, void *, caller),
TP_FIELDS(
ctf_integer_hex(void *, out_ptr, out_ptr)
#undef TRACEPOINT_PROVIDER
-#define TRACEPOINT_PROVIDER ust_pthread
+#define TRACEPOINT_PROVIDER lttng_ust_pthread
#if !defined(_TRACEPOINT_UST_PTHREAD_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define _TRACEPOINT_UST_PTHREAD_H
#include <lttng/tracepoint.h>
-TRACEPOINT_EVENT(ust_pthread, pthread_mutex_lock_req,
+TRACEPOINT_EVENT(lttng_ust_pthread, pthread_mutex_lock_req,
TP_ARGS(pthread_mutex_t *, mutex),
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
)
)
-TRACEPOINT_EVENT(ust_pthread, pthread_mutex_lock_acq,
+TRACEPOINT_EVENT(lttng_ust_pthread, pthread_mutex_lock_acq,
TP_ARGS(pthread_mutex_t *, mutex, int, status),
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
)
)
-TRACEPOINT_EVENT(ust_pthread, pthread_mutex_trylock,
+TRACEPOINT_EVENT(lttng_ust_pthread, pthread_mutex_trylock,
TP_ARGS(pthread_mutex_t *, mutex, int, status),
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)
)
)
-TRACEPOINT_EVENT(ust_pthread, pthread_mutex_unlock,
+TRACEPOINT_EVENT(lttng_ust_pthread, pthread_mutex_unlock,
TP_ARGS(pthread_mutex_t *, mutex, int, status),
TP_FIELDS(
ctf_integer_hex(void *, mutex, mutex)