It turns out, like GDB, that lldb has a TUI mode too, but it’s really simplistic. You enter with
at which point you get a full screen of code or assembly, and options for register exploration, thread and stack exploration, and a variable view. The startup screen looks like:
If you tab over to the Threads window, you can space select the process, and drill into the stack traces for any of the running threads
You can also expand the regsiters by register class:
I’d like to know how to resize the various windows. If you resize the terminal, the size of the stack view pane seems to remain fixed, so the symbol names always end up truncated.
Apparently this code hasn’t been maintained or developed since it was added. Because there is no console pane, you have to set all desired breakpoints and continue, then pop into the GUI to look at stuff, and then <F1> to get back to the console prompt. It’s nice that it gives you a larger view of the code, but given that lldb already displays context around each line, the lldb TUI isn’t that much of a value add in that respect.
This “GUI” would actually be fairly usable if it just had a console pane.
I recently watched Greg Law’s “I’ll change your opinion on GDB” talk from CPPCON 2015, where he gave a nice example of how to use the gdb TUI (text user interface) mode. I’d recently encountered the gdb –tui option, but thought that you had to have the foresight to remember to invoke gdb with –tui (which I usually didn’t, but also didn’t always want to since it’s redraw was flaky in a putty terminal session).
It turns out that there are command line keystrokes to enable TUI dynamically when you want it (or turn it off when you don’t). That makes this TUI a much nicer feature!
The main key commands of interest are:
– C-x a, turn on (or off) TUI mode.
– C-x 2. Use two windows, or cycle to the next layout.
– C-x o. Change active window.
– C-L. Redraw screen.
– C-x p. command history (since up and down move the cursor)
Here’s an example how things look after turning on TUI (C-x a):
After turning on two window mode (C-X 2):
This has a source view, an assembly view, and the output of ‘info registers’. You can actually get a register window by cycling through the window layouts once (C-x 2 again) :
Some of the previous times that I’d tried ‘gdb –tui’ explicitly, I’d found it hit redraw issues, but didn’t really want to detach and reattach the debugger just to change the TUI mode. It sounds like such issues can be dealt with either by turning off TUI mode (C-x a), or using redraw (C-L).