From c343112fb6cb937fdf5a3a279e5fc1cf41bd1b8f Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Tue, 2 May 2023 12:56:32 -0400 Subject: rts: Don't force debug output to stderr Previously `+RTS -Dw -l` would emit debug output to the eventlog while `+RTS -l -Dw` would emit it to stderr. This was because the parser for `-D` would unconditionally override the debug output target. Now we instead only do so if no it is currently `TRACE_NONE`. --- rts/RtsFlags.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 5f1e8d6403..be87917737 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -2201,13 +2201,14 @@ static void read_debug_flags(const char* arg) } // -Dx also turns on -v. Use -l to direct trace // events to the .eventlog file instead. - RtsFlags.TraceFlags.tracing = TRACE_STDERR; - - // sanity implies zero_on_gc - if(RtsFlags.DebugFlags.sanity){ - RtsFlags.DebugFlags.zero_on_gc = true; - } + if (RtsFlags.TraceFlags.tracing == TRACE_NONE) { + RtsFlags.TraceFlags.tracing = TRACE_STDERR; + } + // sanity implies zero_on_gc + if(RtsFlags.DebugFlags.sanity){ + RtsFlags.DebugFlags.zero_on_gc = true; + } } #endif -- cgit v1.2.1