Integrate base-address statedump into lttng-ust
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index 77d8e3fcb3564de19100b0a50c080ecba5ba2ad4..2d3766f1326ff407351e3d41088d2d5c0aacf094 100644 (file)
@@ -52,6 +52,7 @@
 #include "lttng-tracer-core.h"
 #include "compat.h"
 #include "../libringbuffer/tlsfixup.h"
+#include "../liblttng-ust-baddr/lttng-ust-baddr.h"
 
 /*
  * Has lttng ust comm constructor been called ?
@@ -183,7 +184,6 @@ static const char *cmd_name_mapping[] = {
 
 static const char *str_timeout;
 static int got_timeout_env;
-static void *ust_baddr_handle;
 
 extern void lttng_ring_buffer_client_overwrite_init(void);
 extern void lttng_ring_buffer_client_overwrite_rt_init(void);
@@ -242,39 +242,6 @@ void print_cmd(int cmd, int handle)
                lttng_ust_obj_get_name(handle), handle);
 }
 
-static
-void *lttng_ust_baddr_handle(void)
-{
-       if (!ust_baddr_handle) {
-               ust_baddr_handle = dlopen(
-                       "liblttng-ust-baddr.so.0", RTLD_NOW | RTLD_GLOBAL);
-               if (ust_baddr_handle == NULL)
-                       ERR("%s", dlerror());
-       }
-       return ust_baddr_handle;
-}
-
-static
-int lttng_ust_baddr_statedump(struct lttng_session *session)
-{
-       static
-       int (*lttng_ust_baddr_init_fn)(struct lttng_session *);
-
-       if (!lttng_ust_baddr_init_fn) {
-               void *baddr_handle = lttng_ust_baddr_handle();
-               if (baddr_handle) {
-                       lttng_ust_baddr_init_fn = dlsym(baddr_handle,
-                               "lttng_ust_baddr_statedump");
-                       if (lttng_ust_baddr_init_fn == NULL)
-                               ERR("%s", dlerror());
-               }
-               if (!lttng_ust_baddr_init_fn)
-                       return -1;
-       }
-
-       return lttng_ust_baddr_init_fn(session);
-}
-
 static
 int setup_local_apps(void)
 {
@@ -1247,8 +1214,9 @@ restart:
                        if (ret) {
                                ERR("Error handling message for %s socket", sock_info->name);
                        } else {
-                               struct lttng_session *session =
-                                       sock_info->session_enabled;
+                               struct lttng_session *session;
+
+                               session = sock_info->session_enabled;
                                if (session) {
                                        sock_info->session_enabled = NULL;
                                        lttng_ust_baddr_statedump(session);
@@ -1489,12 +1457,6 @@ void __attribute__((destructor)) lttng_ust_exit(void)
         * cleanup the threads if there are stalled in a syscall.
         */
        lttng_ust_cleanup(1);
-
-       if (ust_baddr_handle) {
-               int ret = dlclose(ust_baddr_handle);
-               if (ret)
-                       ERR("%s", dlerror());
-       }
 }
 
 /*
This page took 0.023768 seconds and 4 git commands to generate.