From d1d818892dcc719a4517d8e131162399b786ad48 Mon Sep 17 00:00:00 2001 From: Balazs Scheidler Date: Sun, 13 Oct 2024 08:30:23 +0200 Subject: [PATCH] debugger: add step and follow commands Signed-off-by: Balazs Scheidler --- lib/debugger/debugger.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/debugger/debugger.c b/lib/debugger/debugger.c index d305bb694..1f3e40405 100644 --- a/lib/debugger/debugger.c +++ b/lib/debugger/debugger.c @@ -162,6 +162,8 @@ _cmd_help(Debugger *self, gint argc, gchar *argv[]) printf("syslog-ng interactive console, the following commands are available\n\n" " help, h, or ? Display this help\n" " continue or c Continue until the next breakpoint\n" + " step or s Single step\n" + " follow or f Follow this message, ignoring any other breakpoints\n" " trace or t Trace this message along the configuration\n" " info Display information about the current execution state\n" " list or l Display source code at the current location\n" @@ -294,6 +296,13 @@ _cmd_continue(Debugger *self, gint argc, gchar *argv[]) return FALSE; } +static gboolean +_cmd_step(Debugger *self, gint argc, gchar *argv[]) +{ + _set_mode(self, DBG_WAITING_FOR_STEP, FALSE); + return FALSE; +} + static gboolean _cmd_trace(Debugger *self, gint argc, gchar *argv[]) { @@ -302,6 +311,13 @@ _cmd_trace(Debugger *self, gint argc, gchar *argv[]) return FALSE; } +static gboolean +_cmd_follow(Debugger *self, gint argc, gchar *argv[]) +{ + _set_mode(self, DBG_FOLLOW_AND_BREAK, TRUE); + return FALSE; +} + static gboolean _cmd_quit(Debugger *self, gint argc, gchar *argv[]) { @@ -326,6 +342,10 @@ struct { "?", _cmd_help }, { "continue", _cmd_continue }, { "c", _cmd_continue }, + { "step", _cmd_step }, + { "s", _cmd_step }, + { "follow", _cmd_follow, .requires_breakpoint_site = TRUE }, + { "f", _cmd_follow, .requires_breakpoint_site = TRUE }, { "print", _cmd_print, .requires_breakpoint_site = TRUE }, { "p", _cmd_print, .requires_breakpoint_site = TRUE }, { "list", _cmd_list, },