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

5

21

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

Parenthood answered 21/1, 2012 at 14:27 Comment(0)
C
10

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

Commodious answered 23/3, 2013 at 6:18 Comment(0)
P
9

~/.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?

Postboy answered 10/6, 2015 at 17:14 Comment(2)
I am using gdb 7.6 (Centos 7) but "tui enable" and "tui disable" commands are not available. Just "tui reg". I tested in gdb 7.11 (Ubuntu 16) and these options are ok. Should I enable anything else in gdb to have these options?Gaze
@Gaze enable and disable were not yet implemented in GDB 7.7 when I wrote this, so I think the only way is to get a newer GDB :-(Postboy
T
1

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!

Tutty answered 31/3, 2013 at 0:28 Comment(0)
A
1

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.

Alta answered 15/7, 2013 at 14:5 Comment(1)
The shortcut is "fs next".Benzvi
L
0

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.

Leptorrhine answered 17/11, 2021 at 22:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.