gdb can keep track of the commands you type during your debugging sessions, so that you can be certain of precisely what happened. Use these commands to manage the gdb command history facility.
gdb uses the gnu History library, a part of the Readline package, to provide the history facility. See Using History Interactively, for the detailed description of the History library.
To issue a command to gdb without affecting certain aspects of the state which is seen by users, prefix it with ‘server ’ (see Server Prefix). This means that this command will not affect the command history, nor will it affect gdb's notion of which command to repeat if <RET> is pressed on a line by itself.
The server prefix does not affect the recording of values into the value
history; to print a value without recording it into the value history,
output command instead of the
Here is the description of gdb commands related to command history.
set history filenamefname
GDBHISTFILE, or to ./.gdb_history (./_gdb_history on MS-DOS) if this variable is not set.
set history save
set history save on
set history filenamecommand. By default, this option is disabled.
set history save off
set history sizesize
set history size unlimited
unlimitedor if GDBHISTSIZE is either a negative number or the empty string, then the number of commands gdb keeps in the history list is unlimited.
set history remove-duplicatescount
set history remove-duplicates unlimited
unlimitedthen this lookbehind is unbounded. If count is 0, then removal of duplicate history entries is disabled.
Only history entries added during the current session are considered for removal. This option is set to 0 by default.
History expansion assigns special meaning to the character !. See Event Designators, for more details.
Since ! is also the logical not operator in C, history expansion
is off 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
set history expansion off
show history filename
show history save
show history size
show history expansion
show historyby itself displays all four states.
show commands +