Text User Interface

We do not cover it in detail, but you might find the text user interface useful. Here we show a few screen captures of this in action, with the command details provided in later chapters. You can enable it with the command tui enable (tui disable disables the text user interface), after which you will see something like:

A gdb session with the text user interface. The top of the terminal window has a program listing, below which is some information about the program, currently blank because the program is not yet running. At the bottom of the window is the interactive command prompt, which does not show any commands. 

We can set a breakpoint and run the program as normal:

Similar to the previous image, but we have set a breakpoint with “break f” and typed “run” without hitting return. 

We now run the program, hitting the breakpoint at the start of the function f:

The program is now running, and in the list view at the top we can see that line 4, which reads “void F of int A” has a B plus at the start, indicating a breakpoint. This is followed by a greater-than, indicating that this is the program’s execution point, and the corresponding C code is highlighted. The program information now includes, among other things, “In F” to indicate the current function, “L4” to indicate the line of code about to be executed, and “PC:” followed by a hexadecimal address indicating the instruction pointer or program counter. 

If we run info frame, we can confirm that the information displayed matches what we would expect:

Similar to the previous image, but with part of the output of “info frame” displayed, showing that the T U I information matches what we see from the interactive command. 

If we run next, we can execute the current line and see the next one to be executed. The information displayed by the T U I is updated automatically:

The greater-than has moved to line 6, and the corresponding code defining char C is highlighted. The line number and P C have been updated below the program listing.

There are other views that you can enable in the text user interface, and much more that it can do.