Siyuan Ren
Siyuan Ren

Reputation: 7844

GDB in TUI mode: how to deal with stderr's interaction with the ui

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:

normal

when there is output on stderr

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

Upvotes: 10

Views: 3315

Answers (2)

builder-7000
builder-7000

Reputation: 7627

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

Upvotes: 5

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

Upvotes: 1

Related Questions