6

I am doing my first steps with GDB in TUI mode.

During the debug session I see that each line outputted to console occurs in a single line (in the picture you see 222222 highlighted in red). It is like having an output pane of one single line.

On top of that, each \n doesn't cleanup that line so all the strings do overwrite each other making my output very confusing.

Can you help me a bit with this issue or point me to some key command to look for in order to have a clean output?

I also highlighted another area (in the picture 1111111) because the first string is outputted there and then all other on the frame of the source code window.

alt text

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173

1 Answers1

11

You can always refresh tui screeen every time your program outputs something with Ctrl+L key binding. Or you can temporarily swith to normal mode, step and watch program output and switch back to tui mode (Ctrl+X A). See all key bindings here.

ks1322
  • 33,961
  • 14
  • 109
  • 164
  • Thanks a lot! With CTRL+L & out TUI mode looks better. Can I ask you one more question? Do you know a way to create an area in GDB screen similar to the VSStudio OUTPUT PANE? I would like an area of the screen dedicated entirely to the console output and at the same time doing my debug/viewing my code. – Abruzzo Forte e Gentile Oct 26 '10 at 13:30
  • I found this and I hope is gonna help http://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_183.html – Abruzzo Forte e Gentile Oct 26 '10 at 14:04
  • 2
    As far as I know there is no such feature in gdb as OUTPUT PANE. But it is possible to redirect all program output to another terminal with gdb's TTY command: http://sourceware.org/gdb/current/onlinedocs/gdb/Input_002fOutput.html#index-tty-127 – ks1322 Oct 26 '10 at 16:03
  • Hi Ks1322! Thanks a lot! I did some research since I don't have this /dev/ttyb in Ubuntu. #A. I open a new terminal, give "tty" command to return e.g. "/dev/pts/0" #B. In another terminal where I lunch "gdb"and give "tty /dev/pts/0" to see my output in the first terminal: supre cool! Everything seems fine except for this message "warning: GDB: Failed to set controlling terminal: Operation not permitted". It seems not really affecting my debugging session by the way but I am not sure 100%. Do you know what it could be? – Abruzzo Forte e Gentile Oct 27 '10 at 10:16
  • Maby this will help you: http://stackoverflow.com/questions/2346919/warning-gdb-failed-to-set-controlling-terminal-operation-not-permitted ? Maby this warning is Ubuntu specific? I dont observe it on my Fedora 12 system. – ks1322 Oct 27 '10 at 12:31
  • Worth noting that [you can make gdb run `refresh` automatically on every breakpoint hit](https://stackoverflow.com/a/13936744/2550406) – lucidbrot Apr 20 '18 at 17:45