Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close layout SRC windows in gdb?

Tags:

debugging

gdb

When debugging with GDB, i usually using layout src to check my code. But when i open it, i don't know how to close it. It seems that there are some other layout, and when open a new layout, it will split the window, but i still can not found a command to merge the splitted windows.

like image 339
Frank Cheng Avatar asked Dec 07 '11 02:12

Frank Cheng


People also ask

How do I close a program in gdb?

To stop your program while it is running, type "(ctrl) + c" (hold down the ctrl key and press c). gdb will stop your program at whatever line it has just executed. From here you can examine variables and move through your program. To specify other places where gdb should stop, see the section on breakpoints below.

How do I exit TUI mode?

To disable ​TUI​ mode, you can type ​tui disable​. If the layout of the ​TUI​becomes unreadable, pressing ​Ctrl-l​will reload it. Once you are running TUI mode, there are several commands you can use to change the display. One of them is layout name.

What is TUI window?

The GDB Text User Interface, TUI in short, is a terminal interface which uses the curses library to show the source file, the assembly output, the program registers and GDB commands in separate text windows.

How do I go back in gdb?

The command would be " reverse-step ", or " reverse-next ". If you run into the error: Target child does not support this command. then try adding target record at the beginning of execution, after starting run . Edit: Since GDB 7.6 target record is deprecated, use target record-full instead.


2 Answers

You can always leave or enter TUI at any time durring debug session. For example you can do it with ctrl+x a key binding. 25.2 TUI Key Bindings.

like image 176
ks1322 Avatar answered Oct 17 '22 04:10

ks1322


vi Readline input bug

In GDB 7.7, Ctrl-x + a does not work if you have in your ~/.inputrc:

set editing-mode vi
set keymap vi

If I remove those lines it works.

This seems to be mentioned at in the following bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=15163

I have requested a workaround at https://sourceware.org/ml/gdb/2015-06/msg00009.html and Andrew Burgess replied that he had just submitted a well received patch to add:

tui enable
tui disable

so in future versions we should have commands as an alternative to the shortcuts.

I have later tested this on GDB 8.1 in Ubuntu 18.04 and it worked perfectly.

But then I saw the light and moved from TUI to GDB Dashboard: https://github.com/cyrus-and/gdb-dashboard which is simply more powerful and less buggy.

See also: http://superuser.com/questions/180512/how-to-turn-off-gdb-tui