Cannot leave tui mode with Ctrl-X A nor see program output in tui mode

9.3k views Asked by At

Problem A:

  1. I start gdb in command line with "gdb test"
  2. I press ctrl-x,ctrl-a before I do anything else
  3. Then I set break point using "b main"
  4. Then I start running the program using "r"

Till this point, if I press the Up arrow key the src window will not scroll. Instead, something will appear in my command window - "^[0A". If I try to refresh the screen with ctrl-l, "^L" is what appears in the command window.

I don't think this is supposed to happen. Under this situation I can't even quit tui mode with c-x,c-a ("^X^A" will appear instead). Am I doing something wrong? I realize this problem occurs so long as I use the "run" command inside the TUI interface. I can, however, use the run command in TUI if I start gdb with "gdb -tui"

Problem B

I can't see the output of my program in TUI mode. GDB's own output can be seen, but not that of the program being debugged. This occurs both when I enter TUI using ctrl-x,ctrl-a and when using -tui command-line option.

Is there any way to fix this?

I've read some TUI articles on the net and some people seem to use TUI "exclusively". I suppose TUI can work properly, it's just there's a set of rules that must be carefully followed?

EDIT: I use gnome-terminal in ubuntu 11.04

5

There are 5 answers

2
Ciro Santilli OurBigBook.com On

~/.inputrc was the culprit in GDB 7.7 because of:

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.

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: How to highlight and color gdb output during interactive debugging?

1
tallen On

I think you are looking for, "focus next." it switches you among (there can be more than two) the windows. I'm sure there is a short-cut for this too. Please note, this is almost the same answer as user1888039, so if you agree you should up-vote that answer.

0
dwto On

Problem A: Use Ctrl+X then press a to enter or exit TUI mode. Or as you mentioned run gdb -tui

Problem B: Note that your program print could be ran over by the (gdb) prompt. In other words, it is possible that your program prints but the " (gdb)" is printed over it after. To easily check if this is indeed the case, try to print either a line longer than 6 characters or multiple lines each time. You should see part of your print.

0
user2201636 On

Run gdb with -tui option instead (https://bbs.archlinux.org/viewtopic.php?id=112660)

0
vexe On

Change your terminal to get rid of your first problem. I used to use gnome-terminal my self, but then changed to terminator. Some terminals don't support keys like Alt sometimes (used to experience this in vim with some Alt+something maps)

You can change forcus to another window by 'focus winName', in your case, use 'focus src' got this from here

Not sure about your 2nd problem. Good luck!