Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
set history save, set history save on Record command history in a file, whose name may be
specified with the set history filename command.
By default, this option is disabled.
set history save off Stop recording command history in a file.
set history size size Set the number of commands which GDB keeps in its history
list. This defaults to the value of the environment variable
HISTSIZE, or to 256 if this variable is not set.
History expansion assigns special meaning to the character !.
Since ! is also the logical not operator in C, history expansion is o by default. If you decide to
enable history expansion with the set history expansion on command, you may sometimes need
to follow ! (when it is used as logical not, in an expression) with a space or a tab to prevent it
from being expanded. The readline history facilities do not attempt substitution on the strings !=
and !(, even when history expansion is enabled.
The commands to control history expansion are:
set history expansion on, set history
expansion
Enable history expansion. History expansion is o by default.
set history expansion off Disable history expansion.
The readline code comes with more complete documentation
of editing and history expansion features. Users unfamiliar
with GNU Emacs or vi may wish to read it.
show history, show history filename,
show history save, show history size,
show history expansion
These commands display the state of the GDB history
parameters. show history by itself displays all four states.
show commands Display the last ten commands in the command history.
show commands n Print ten commands centered on command number n.
show commands + Print ten commands just after the commands last printed.
Setting the GDB Screen Size
Certain commands to GDB may produce large amounts of information output to the screen. To
help you read all of it, GDB pauses and asks you for input at the end of each page of output. Type
RET when you want to continue the output, or q to discard the remaining output. Also, the screen
width setting determines when to wrap lines of output. Depending on what is being printed, GDB
tries to break the line at a readable place, rather than simply letting it over flow onto the following
line.
Normally GDB knows the size of the screen from the terminal driver software. For example, on
Unix, GDB uses the termcap data base together with the value of the TERM environment variable
and the stty rows and stty cols settings. If this is not correct, you can override it with the set
height and set width commands:
set height lpp, show height se,
set width cpl, show width
These set commands specify a screen height of lpp lines and
a screen width of cpl characters. The associated show
commands display the current settings.
If you specify a height of zero lines, GDB does not pause during
output no matter how long the output is. This is useful if output
is to a file or to an editor buffer.
Likewise, you can specify set width 0 to prevent GDB from
wrapping its output.
set pagination on/off, show
pagination
Turn the output pagination on or off; the default is on. You can
also turn off pagination to set height 0.
Setting the GDB Screen Size 217