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
refresh
end
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
refresh
end
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.html
and https://sourceware.org/gdb/current/onlinedocs/gdb/Hooks.html#Hooks
You can add as many hooks/defines as you want.