/*
* Copyright (C) 2013 Paul Woegerer <paul.woegerer@mentor.com>
* Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
+ * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define _LGPL_SOURCE
#define _GNU_SOURCE
-
+#define _LGPL_SOURCE
#include <limits.h>
#include <stdio.h>
#include <sys/types.h>
#include <lttng/ust-dlfcn.h>
#include <lttng/ust-elf.h>
+#include <lttng/ust-events.h>
+#include <helper.h>
#include "usterr-signal-safe.h"
/* Include link.h last else it conflicts with ust-dlfcn. */
ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
if (ret != -1 && p != NULL && p->l_addr != 0) {
- lttng_ust_dl_dlopen((void *) p->l_addr, p->l_name,
- __builtin_return_address(0));
+ lttng_ust_dl_dlopen((void *) p->l_addr,
+ p->l_name,
+ LTTNG_UST_CALLER_IP());
}
}
-
+ lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
return handle;
}
int dlclose(void *handle)
{
+ int ret;
+
if (__tracepoint_ptrs_registered) {
struct link_map *p = NULL;
- int ret;
ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
if (ret != -1 && p != NULL && p->l_addr != 0) {
tracepoint(lttng_ust_dl, dlclose,
- __builtin_return_address(0),
+ LTTNG_UST_CALLER_IP(),
(void *) p->l_addr);
}
}
-
- return _lttng_ust_dl_libc_dlclose(handle);
+ ret = _lttng_ust_dl_libc_dlclose(handle);
+ lttng_ust_dl_update(LTTNG_UST_CALLER_IP());
+ return ret;
}