GDB in TUI mode: how to deal with stderr's int

2019-07-20 10:35发布

问题:

I am trying to use gdb to debug caffe. I prefer to use the tui mode because it allows me to see the whole source code rather than just a single line. But there is a problem: whenever the program caffe outputs something on stderr, the output distorts the tui interface. See the below snapshot for an illustration:

Is this an inherent limitation of gdb tui or is there any way to solve this problem?

回答1:

I never found a solution to such TUI annoyances, and eventually gave up and moved to more reliable methods that:

  • use the GDB Python API to get GDB data
  • output some pre-configured views to stdout after every stop instead of putting the terminal in a magic ncurses mode

GDB Dashboard is one such solution, and I have described it at: gdb split view with code



回答2:

As suggested by @ks1322 you can press Ctrl-L to refresh the screen. Or define a hook in .gdbinit to refresh after every next command:

define hook-next
    refresh
end