How clear gdb command screen?
Asked Answered
H

4

64

Is it possible to clear the command window of gdb? I mean, is there a command in gdb that do the same (for the command windows) as the clear command in a bash terminal?

Huron answered 17/10, 2012 at 15:41 Comment(0)
S
82

Hit Control + L. Works for me in Linux and Mac OS X as well with recent versions of GDB.

Scevor answered 17/10, 2012 at 15:42 Comment(6)
Actually, this works in a terminal as well. Moreover, it works in a Cygwin terminal, which doesn't have a clear command. Hence, a good habit to get into. ;-)Margarettmargaretta
@Huron you must be using some insane environment.Scevor
@H2CO3 also doesn't work under OSX/xterm, fairly vanilla setupFirstling
@H2CO3: I assumed you know that. I just thought I'd mention this for other readers.Margarettmargaretta
@JohnTortugo: Using Ctrl-L to clear the screen is a feature of the shell, not of the terminal emulator. (The shell has to know what control sequence to use; that's what terminfo is for.)Marginal
Control L doesn't clear the screen. It shifts the screen up so that the last line is at the top. The answer from pd2q that has "shell clear" actually clears the screen.Lota
F
62

Depending on the environment you can try this key combination: Ctrl+L. That is: hold down the Control key, and type the L key.

But this may not work in all environments. You can also try the following: in gdb you can execute shell commands using shell: use this to call out to the shell to clear the terminal:

shell clear
Firstling answered 17/10, 2012 at 15:43 Comment(10)
this returns 'XTERM': unknown terminal type.Huron
@Huron are you running gdb in an xterm or e.g. through ssh?Firstling
@Huron I can't test that, but it sounds like you need to tweak your TERM settingFirstling
@Huron play around w/ TERM settings under gnome-term and you should be able to use it there as well.Firstling
I'm using debian squeeze.Gdb 7.01Huron
shell reset if your terminal is really hosed.Solanaceous
You are right this one always works for me. Ctrl + L may fail some times. e.g. clearing TUI outputs.Perfume
@Firstling I'm using gbd in Windows 7 cmd (via MinGW). ctrl+ L is not clearing the screen. Any idea how I should to it on windows ?Barbur
@JasonKrs, shell cls will do the job. On MinGW gdb seems to have cmd.exe as shell.Norrie
Can I do it in such a way that my registers and assembly TUI layouts are still visible? I only need to clear the cmd part of gdb. Ah, found it, leaving this comment here as the question might assume my use case as well (when looking at the title). #42283455Anticlockwise
P
0

If you downloaded gdb from MingW your cmd.exe seems to be known as shell, therefore to clear the command screen you need to use this command instead

shell cls
Paraguay answered 1/4, 2023 at 1:53 Comment(0)
S
0

Worked for me, I am using Ubuntu linux

shell clear
Steel answered 10/6 at 6:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.