Add procname to lttng_ust_statedump information
[lttng-ust.git] / liblttng-ust / lttng-ust-statedump.c
index efa8a55aa675771c50ac57031c985f1787c70e21..040223d58409bd93b2ceedb9d8d8979e463beac1 100644 (file)
@@ -35,6 +35,7 @@
 #include "lttng-ust-statedump.h"
 #include "jhash.h"
 #include "getenv.h"
+#include "compat.h"
 
 #define TRACEPOINT_DEFINE
 #include "ust_lib.h"                           /* Only define. */
@@ -246,6 +247,13 @@ void trace_debug_link_cb(struct lttng_session *session, void *priv)
                bin_data->dbg_file, bin_data->crc);
 }
 
+static
+void procname_cb(struct lttng_session *session, void *priv)
+{
+       char *procname = (char *) priv;
+       tracepoint(lttng_ust_statedump, procname, session, procname);
+}
+
 static
 void trace_start_cb(struct lttng_session *session, void *priv)
 {
@@ -414,6 +422,8 @@ void iter_end(struct dl_iterate_data *data, void *ip)
 {
        unsigned int i;
 
+       if (data->cancel)
+               goto end;
        /*
         * Iterate on hash table.
         * For each marked, traced, do nothing.
@@ -441,6 +451,7 @@ void iter_end(struct dl_iterate_data *data, void *ip)
                        }
                }
        }
+end:
        ust_unlock();
 }
 
@@ -590,6 +601,16 @@ int do_baddr_statedump(void *owner)
        return 0;
 }
 
+static
+int do_procname_statedump(void *owner)
+{
+       if (lttng_getenv("LTTNG_UST_WITHOUT_PROCNAME_STATEDUMP"))
+               return 0;
+
+       trace_statedump_event(procname_cb, owner, lttng_ust_sockinfo_get_procname(owner));
+       return 0;
+}
+
 /*
  * Generate a statedump of a given traced application. A statedump is
  * delimited by start and end events. For a given (process, session)
@@ -608,6 +629,7 @@ int do_lttng_ust_statedump(void *owner)
        trace_statedump_start(owner);
        ust_unlock();
 
+       do_procname_statedump(owner);
        do_baddr_statedump(owner);
 
        ust_lock_nocheck();
This page took 0.024164 seconds and 4 git commands to generate.