From 186334d17a7762be2ea436432db48c78fc6b15ce Mon Sep 17 00:00:00 2001 From: Balazs Scheidler Date: Thu, 24 Oct 2024 19:37:29 +0200 Subject: [PATCH] debugger: add path_options argument to debugger stop/trace entry points Signed-off-by: Balazs Scheidler --- lib/debugger/debugger-main.c | 4 ++-- lib/debugger/debugger.c | 11 +++++++++-- lib/debugger/debugger.h | 6 ++++-- lib/debugger/tracer.h | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/debugger/debugger-main.c b/lib/debugger/debugger-main.c index 275043f65..282e8b663 100644 --- a/lib/debugger/debugger-main.c +++ b/lib/debugger/debugger-main.c @@ -33,9 +33,9 @@ static gboolean _pipe_hook(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options) { if (debugger_is_to_stop(current_debugger, s, msg)) - return debugger_stop_at_breakpoint(current_debugger, s, msg); + return debugger_stop_at_breakpoint(current_debugger, s, msg, path_options); else if (debugger_is_to_trace(current_debugger, s, msg)) - return debugger_perform_tracing(current_debugger, s, msg); + return debugger_perform_tracing(current_debugger, s, msg, path_options); return TRUE; } diff --git a/lib/debugger/debugger.c b/lib/debugger/debugger.c index 36891dea2..8a0d7dc67 100644 --- a/lib/debugger/debugger.c +++ b/lib/debugger/debugger.c @@ -578,7 +578,10 @@ debugger_start_console(Debugger *self) } gboolean -debugger_stop_at_breakpoint(Debugger *self, LogPipe *pipe_, LogMessage *msg) +debugger_stop_at_breakpoint(Debugger *self, + LogPipe *pipe_, + LogMessage *msg, + const LogPathOptions *path_options) { BreakpointSite breakpoint_site = {0}; msg_trace("Debugger: stopping at breakpoint", @@ -586,6 +589,7 @@ debugger_stop_at_breakpoint(Debugger *self, LogPipe *pipe_, LogMessage *msg) breakpoint_site.msg = log_msg_ref(msg); breakpoint_site.pipe = log_pipe_ref(pipe_); + breakpoint_site.path_options = path_options; tracer_stop_on_breakpoint(self->tracer, &breakpoint_site); log_msg_unref(breakpoint_site.msg); log_pipe_unref(breakpoint_site.pipe); @@ -593,7 +597,10 @@ debugger_stop_at_breakpoint(Debugger *self, LogPipe *pipe_, LogMessage *msg) } gboolean -debugger_perform_tracing(Debugger *self, LogPipe *pipe_, LogMessage *msg) +debugger_perform_tracing(Debugger *self, + LogPipe *pipe_, + LogMessage *msg, + const LogPathOptions *path_options) { struct timespec ts, *prev_ts = &self->last_trace_event; gchar buf[1024]; diff --git a/lib/debugger/debugger.h b/lib/debugger/debugger.h index 12506fc8a..f3e481ea8 100644 --- a/lib/debugger/debugger.h +++ b/lib/debugger/debugger.h @@ -53,8 +53,10 @@ gchar *debugger_builtin_fetch_command(void); void debugger_register_command_fetcher(FetchCommandFunc fetcher); void debugger_exit(Debugger *self); void debugger_start_console(Debugger *self); -gboolean debugger_perform_tracing(Debugger *self, LogPipe *pipe, LogMessage *msg); -gboolean debugger_stop_at_breakpoint(Debugger *self, LogPipe *pipe, LogMessage *msg); +gboolean debugger_perform_tracing(Debugger *self, LogPipe *pipe, LogMessage *msg, + const LogPathOptions *path_options); +gboolean debugger_stop_at_breakpoint(Debugger *self, LogPipe *pipe, LogMessage *msg, + const LogPathOptions *path_options); Debugger *debugger_new(MainLoop *main_loop, GlobalConfig *cfg); void debugger_free(Debugger *self); diff --git a/lib/debugger/tracer.h b/lib/debugger/tracer.h index b0b46f8bb..f56be6cec 100644 --- a/lib/debugger/tracer.h +++ b/lib/debugger/tracer.h @@ -25,6 +25,7 @@ #define DEBUGGER_TRACER_H_INCLUDED 1 #include "syslog-ng.h" +#include "logpipe.h" typedef struct _Tracer Tracer; @@ -34,6 +35,7 @@ typedef struct _BreakpointSite gboolean resume_requested; LogMessage *msg; LogPipe *pipe; + const LogPathOptions *path_options; gboolean drop; } BreakpointSite;