aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hmp-commands.hx1
-rw-r--r--hmp.h1
-rw-r--r--monitor.c20
3 files changed, 22 insertions, 0 deletions
diff --git a/hmp-commands.hx b/hmp-commands.hx
index c61468e703..d6e81e4df3 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -271,6 +271,7 @@ ETEXI
.params = "name on|off",
.help = "changes status of a specific trace event",
.mhandler.cmd = hmp_trace_event,
+ .command_completion = trace_event_completion,
},
STEXI
diff --git a/hmp.h b/hmp.h
index 0cf4f2a3d1..b8f5d33642 100644
--- a/hmp.h
+++ b/hmp.h
@@ -113,6 +113,7 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str);
void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str);
void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str);
void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str);
+void trace_event_completion(ReadLineState *rs, int nb_args, const char *str);
void watchdog_action_completion(ReadLineState *rs, int nb_args,
const char *str);
void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
diff --git a/monitor.c b/monitor.c
index 451af6ff89..b1f2a29793 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4442,6 +4442,26 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str)
}
}
+void trace_event_completion(ReadLineState *rs, int nb_args, const char *str)
+{
+ size_t len;
+
+ len = strlen(str);
+ readline_set_completion_index(rs, len);
+ if (nb_args == 2) {
+ TraceEventID id;
+ for (id = 0; id < trace_event_count(); id++) {
+ const char *event_name = trace_event_get_name(trace_event_id(id));
+ if (!strncmp(str, event_name, len)) {
+ readline_add_completion(rs, event_name);
+ }
+ }
+ } else if (nb_args == 3) {
+ add_completion_option(rs, str, "on");
+ add_completion_option(rs, str, "off");
+ }
+}
+
void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
{
int i;