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 90). 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

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

Enable command line editing (enabled by default).

on

 

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:

17.1 Setting the GDB Prompt 281

Page 281
Image 281
HP gnu source-level debugger 5992-4701 Controlling GDB, Setting the GDB Prompt, Setting Command Editing Options in GDB