From 4d1d8a77a74dd00cb480c98432bb2649eafb0272 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Tue, 10 Dec 2024 19:08:06 +0100 Subject: [PATCH] scripts: west_commands: runners: openocd: Fix debugging with TUI Prevent server output when running gdb with --tui to prevent garbled console output. Signed-off-by: Pieter De Gendt --- scripts/west_commands/runners/openocd.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/west_commands/runners/openocd.py b/scripts/west_commands/runners/openocd.py index 9b39791e1ee..d97cec1fe1e 100644 --- a/scripts/west_commands/runners/openocd.py +++ b/scripts/west_commands/runners/openocd.py @@ -396,7 +396,12 @@ class OpenOcdBinaryRunner(ZephyrBinaryRunner): self.print_gdbserver_message() if command in ('attach', 'debug'): - self.run_server_and_client(server_cmd, gdb_cmd) + server_proc = self.popen_ignore_int(server_cmd, stderr=subprocess.DEVNULL) + try: + self.run_client(gdb_cmd) + finally: + server_proc.terminate() + server_proc.wait() elif command == 'rtt': self.print_rttserver_message() server_proc = self.popen_ignore_int(server_cmd)