How can I scroll back in GDB's command window in the TUI mode?

nodakai picture nodakai · Feb 13, 2012 · Viewed 21.1k times · Source

Suppose that

(gdb) print *this

resulted in 20 lines of output. Yes, there would be Type <return> to continue, or q <return> to quit, but I'd like to scroll back to the top after I got to the bottom of the output.

I don't think http://sourceware.org/gdb/onlinedocs/gdb/TUI-Keys.html answers my question. It states

<PgUp>
Scroll the active window one page up.

but when the focus is on the command window, PgUp rewinds the command history, instead of scrolling back in the command window. Is it only me who suffers from this behavior?

I'm using PuTTY in order to SSH to Red Hat Linux (if this makes any difference).

Answer

Lupus picture Lupus · Aug 30, 2012

I found an answer here: http://beej.us/guide/bggdb/

Note that when the SRC window has focus, the arrow keys will move the source code, but when the CMD window has focus, the arrow keys will select the previous and next commands in the command history. (For the record, the commands to move the SRC window single lines and single pages are +, -, <, and >.)

There's also an example session illustrating this:

(gdb) info win
        SRC     (36 lines)  <has focus>
        CMD     (18 lines)
(gdb) fs next
Focus set to CMD window.
(gdb) info win
        SRC     (36 lines)
        CMD     (18 lines)  <has focus>
(gdb) fs SRC
Focus set to SRC window.
(gdb)