[PATCH 3/8] [gdb/dap] Flush after printing in log_stack

Tom de Vries tdevries@suse.de
Mon Feb 19 08:23:36 GMT 2024


I noticed that function log flushes the dap log file after printing, but
that function log_stack doesn't.

Fix this by also flushing the dap log file in log_stack.

Tested on aarch64-linux.
---
 gdb/python/lib/gdb/dap/startup.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/python/lib/gdb/dap/startup.py b/gdb/python/lib/gdb/dap/startup.py
index e68c5ba344e..edffc00902b 100644
--- a/gdb/python/lib/gdb/dap/startup.py
+++ b/gdb/python/lib/gdb/dap/startup.py
@@ -185,6 +185,7 @@ def log_stack(level=LogLevel.DEFAULT):
     """Log a stack trace to the log file, if logging is enabled."""
     if dap_log.log_file is not None and level <= _log_level.value:
         traceback.print_exc(file=dap_log.log_file)
+        dap_log.log_file.flush()
 
 
 @in_gdb_thread
-- 
2.35.3



More information about the Gdb-patches mailing list