sessiond: client commands: print command enum as a string
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 22 Oct 2020 15:32:15 +0000 (11:32 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 3 Feb 2021 19:41:08 +0000 (14:41 -0500)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I10ce8911372a6926b7aa234b9d1595a5052d4a0e

src/bin/lttng-sessiond/client.c
src/common/sessiond-comm/sessiond-comm.h
src/lib/lttng-ctl/lttng-ctl.c

index e1552c345659184d7c3973393a656c520a7f85e5..9e4d446aec60359c0311856339ddebb349d17bd5 100644 (file)
@@ -844,7 +844,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
        bool need_domain;
        bool need_consumerd;
 
-       DBG("Processing client command %d", cmd_ctx->lsm.cmd_type);
+       DBG("Processing client command '%s\' (%d)",
+               lttcomm_sessiond_command_str(cmd_ctx->lsm.cmd_type),
+               cmd_ctx->lsm.cmd_type);
 
        assert(!rcu_read_ongoing());
 
index d1a2bd97de18574b82344a6cc52fa169c4ec3a14..d946aa3a3074b8979bdc36478d3a8fe633d713db 100644 (file)
@@ -109,6 +109,99 @@ enum lttcomm_sessiond_command {
        LTTNG_LIST_TRIGGERS                             = 51,
 };
 
+static inline
+const char *lttcomm_sessiond_command_str(enum lttcomm_sessiond_command cmd)
+{
+       switch (cmd) {
+       case LTTNG_ADD_CONTEXT:
+               return "LTTNG_ADD_CONTEXT";
+       case LTTNG_DISABLE_CHANNEL:
+               return "LTTNG_DISABLE_CHANNEL";
+       case LTTNG_DISABLE_EVENT:
+               return "LTTNG_DISABLE_EVENT";
+       case LTTNG_LIST_SYSCALLS:
+               return "LTTNG_LIST_SYSCALLS";
+       case LTTNG_ENABLE_CHANNEL:
+               return "LTTNG_ENABLE_CHANNEL";
+       case LTTNG_ENABLE_EVENT:
+               return "LTTNG_ENABLE_EVENT";
+       case LTTNG_DESTROY_SESSION:
+               return "LTTNG_DESTROY_SESSION";
+       case LTTNG_LIST_CHANNELS:
+               return "LTTNG_LIST_CHANNELS";
+       case LTTNG_LIST_DOMAINS:
+               return "LTTNG_LIST_DOMAINS";
+       case LTTNG_LIST_EVENTS:
+               return "LTTNG_LIST_EVENTS";
+       case LTTNG_LIST_SESSIONS:
+               return "LTTNG_LIST_SESSIONS";
+       case LTTNG_LIST_TRACEPOINTS:
+               return "LTTNG_LIST_TRACEPOINTS";
+       case LTTNG_REGISTER_CONSUMER:
+               return "LTTNG_REGISTER_CONSUMER";
+       case LTTNG_START_TRACE:
+               return "LTTNG_START_TRACE";
+       case LTTNG_STOP_TRACE:
+               return "LTTNG_STOP_TRACE";
+       case LTTNG_LIST_TRACEPOINT_FIELDS:
+               return "LTTNG_LIST_TRACEPOINT_FIELDS";
+       case LTTNG_DISABLE_CONSUMER:
+               return "LTTNG_DISABLE_CONSUMER";
+       case LTTNG_ENABLE_CONSUMER:
+               return "LTTNG_ENABLE_CONSUMER";
+       case LTTNG_SET_CONSUMER_URI:
+               return "LTTNG_SET_CONSUMER_URI";
+       case LTTNG_DATA_PENDING:
+               return "LTTNG_DATA_PENDING";
+       case LTTNG_SNAPSHOT_ADD_OUTPUT:
+               return "LTTNG_SNAPSHOT_ADD_OUTPUT";
+       case LTTNG_SNAPSHOT_DEL_OUTPUT:
+               return "LTTNG_SNAPSHOT_DEL_OUTPUT";
+       case LTTNG_SNAPSHOT_LIST_OUTPUT:
+               return "LTTNG_SNAPSHOT_LIST_OUTPUT";
+       case LTTNG_SNAPSHOT_RECORD:
+               return "LTTNG_SNAPSHOT_RECORD";
+       case LTTNG_SAVE_SESSION:
+               return "LTTNG_SAVE_SESSION";
+       case LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE:
+               return "LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE";
+       case LTTNG_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE:
+               return "LTTNG_PROCESS_ATTR_TRACKER_REMOVE_INCLUDE_VALUE";
+       case LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY:
+               return "LTTNG_PROCESS_ATTR_TRACKER_GET_POLICY";
+       case LTTNG_PROCESS_ATTR_TRACKER_SET_POLICY:
+               return "LTTNG_PROCESS_ATTR_TRACKER_SET_POLICY";
+       case LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET:
+               return "LTTNG_PROCESS_ATTR_TRACKER_GET_INCLUSION_SET";
+       case LTTNG_SET_SESSION_SHM_PATH:
+               return "LTTNG_SET_SESSION_SHM_PATH";
+       case LTTNG_REGENERATE_METADATA:
+               return "LTTNG_REGENERATE_METADATA";
+       case LTTNG_REGENERATE_STATEDUMP:
+               return "LTTNG_REGENERATE_STATEDUMP";
+       case LTTNG_REGISTER_TRIGGER:
+               return "LTTNG_REGISTER_TRIGGER";
+       case LTTNG_UNREGISTER_TRIGGER:
+               return "LTTNG_UNREGISTER_TRIGGER";
+       case LTTNG_ROTATE_SESSION:
+               return "LTTNG_ROTATE_SESSION";
+       case LTTNG_ROTATION_GET_INFO:
+               return "LTTNG_ROTATION_GET_INFO";
+       case LTTNG_ROTATION_SET_SCHEDULE:
+               return "LTTNG_ROTATION_SET_SCHEDULE";
+       case LTTNG_SESSION_LIST_ROTATION_SCHEDULES:
+               return "LTTNG_SESSION_LIST_ROTATION_SCHEDULES";
+       case LTTNG_CREATE_SESSION_EXT:
+               return "LTTNG_CREATE_SESSION_EXT";
+       case LTTNG_CLEAR_SESSION:
+               return "LTTNG_CLEAR_SESSION";
+       case LTTNG_LIST_TRIGGERS:
+               return "LTTNG_LIST_TRIGGERS";
+       default:
+               abort();
+       }
+}
+
 enum lttcomm_relayd_command {
        RELAYD_ADD_STREAM                   = 1,
        RELAYD_CREATE_SESSION               = 2,
index 38df4cb7b11c1234c5b33f8b92d1731ea541585f..151ceed64ac3f02f86a043898b08e29de03b3e50 100644 (file)
@@ -116,7 +116,8 @@ static int send_session_msg(struct lttcomm_session_msg *lsm)
                goto end;
        }
 
-       DBG("LSM cmd type : %d", lsm->cmd_type);
+       DBG("LSM cmd type: '%s' (%d)", lttcomm_sessiond_command_str(lsm->cmd_type),
+                       lsm->cmd_type);
 
        ret = lttcomm_send_creds_unix_sock(sessiond_socket, lsm,
                        sizeof(struct lttcomm_session_msg));
This page took 0.027997 seconds and 4 git commands to generate.