Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)
17 Controlling GDB
You can alter the way GDB interacts with you by using the set command. For commands controlling
how GDB displays data, see “Print settings” (page 68). Other settings are described here.
17.1 Setting the GDB Prompt
GDB indicates its readiness to read a command by printing a string called the prompt. This string
is normally `((gdb))'. You can change the prompt string with the set prompt command. For instance,
when debugging GDB with GDB, it is useful to change the prompt in one of the GDB sessions so
that you can always tell which one you are talking to.
NOTE: set prompt does not add a space for you after the prompt you set. This allows you to set
a prompt which ends in a space or a prompt that does not.
set prompt newprompt Directs GDB to use newprompt as its prompt string
henceforth.
show prompt Prints a line of the form: “Gdb's prompt is: your-prompt”
set prompt-escape-char
integer
Sets the formatting for the escape characters to be done on
the gdb's prompt.
show prompt-escape-char Displays the current prompt used to format the escape
characters.
17.2 Setting Command Editing Options in GDB
GDB reads its input commands via the readline interface. This gnu library provides consistent
behavior for programs which provide a command line interface to the user. Ad- vantages are gnu
Emacs-style or vi-style inline editing of commands, csh-like history substitution, and a storage and
recall of command history across debugging sessions.
You may control the behavior of command line editing in GDB with the command set.
set editing, set editing
on
Enable command line editing (enabled by default).
set editing off Disable command line editing.
show editing Show whether command line editing is enabled.
17.3 Setting Command History Feature in GDB
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.
To make command history understand your vi key bindings you need to create a ~/.inputrc
file with the following contents:
set editing-mode vi The readline interface uses the .inputrc file to control the
settings.
set history filename fname Set the name of the GDB command history file to fname.
This is the file where GDB reads an initial command history
list, and where it writes the command history from this
session when it exits. You can access this list through history
expansion or through the history command editing
characters listed below. This file defaults to the value of the
environment variable GDBHISTFILE, or to ./
17.1 Setting the GDB Prompt 225