How to automatically refresh gdb in tui mode? How to automatically refresh gdb in tui mode? python python

How to automatically refresh gdb in tui mode?


Had the exact same problem.Have you tried GDB user-defined hooks or commands ?

In your ~/.gdbinit or in your session, you can do:

define hook-next  refreshend

This will call the refresh command each time you enter the next command or one of its aliases.

Or you can define:

define mynext  next  refreshend

and call mynext instead of next.

Hooks are automatically called whenever a command C is entered and a hook-C exists, that's so cool, I've just discovered that in the docs.

See https://sourceware.org/gdb/current/onlinedocs/gdb/Define.htmland https://sourceware.org/gdb/current/onlinedocs/gdb/Hooks.html#Hooks

You can add as many hooks/defines as you want.


Partially related: I put this in my ~/.gdbinit and it successfully refreshes the TUI after I use c and n, which were the commands usually causing TUI cruft in my case.

define c   continue  refreshenddefine n  next  refreshend