Skip to content

Commit 1866e00

Browse files
danieldegrassefabiobaltieri
authored andcommitted
scripts: west_commands: openocd: run gdb in batch mode for RTT
Run GDB in batch mode when using RTT, so that pagination is never enabled. This fixes RTT support when using terminals with a very small row count. Fixes #92417 Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent 9f181b6 commit 1866e00

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scripts/west_commands/runners/openocd.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,12 @@ def do_attach_debug_rtt(self, command, **kwargs):
407407
+ ['-c', f'rtt server start {self.rtt_port} 0']
408408
)
409409

410-
gdb_cmd = (self.gdb_cmd + self.tui_arg +
410+
if command == 'rtt':
411+
# Run GDB in batch mode. This will disable pagination automatically
412+
gdb_args = ['--batch']
413+
else:
414+
gdb_args = []
415+
gdb_cmd = (self.gdb_cmd + gdb_args + self.tui_arg +
411416
['-ex', f'target extended-remote :{self.gdb_client_port}',
412417
self.elf_name])
413418
if command == 'debug':
@@ -421,8 +426,6 @@ def do_attach_debug_rtt(self, command, **kwargs):
421426
if rtt_address is None:
422427
raise ValueError("RTT Control block not found")
423428

424-
# cannot prompt the user to press return for automation purposes
425-
gdb_cmd.extend(['-ex', 'set pagination off'])
426429
# start the internal openocd rtt service via gdb monitor commands
427430
gdb_cmd.extend(
428431
['-ex', f'monitor rtt setup 0x{rtt_address:x} 0x10 "SEGGER RTT"'])

0 commit comments

Comments
 (0)