Entering Commands
In the debugger console, you can interact with the command interface of the inferior debugger. Enter commands at the debugger prompt--that is, (gdb)
for GDB, (dbx)
for DBX, (ladebug)
for Ladebug, >
for XDB, >
and Illegal HTML tag removed : thread[
Illegal HTML tag removed : depth]
for JDB, or (Pydb)
for PYDB, or DB<>
for Perl, or bashdb<>
for Bash. You can use arbitrary debugger commands; use the <Return> key to enter them.
- Command Completion: Using the <TAB> key.
- Command History: Repeating previous commands.
- Typing in the Source Window:
Node:Command Completion, Next:Command History, Up:Entering Commands
Command Completion
When using GDB or Perl, you can use the <TAB> key for completing commands and arguments. This works in the debugger console as well as in all other text windows.
GDB can fill in the rest of a word in a command for you, if there is only one possibility; it can also show you what the valid possibilities are for the next word in a command, at any time. This works for GDB commands, GDB subcommands, and the names of symbols in your program.
Press the <TAB> key whenever you want GDB to fill out the rest of a word. If there is only one possibility, GDB fills in the word, and waits for you to finish the command (or press <RET> to enter it). For example, if you type
(gdb) **Illegal HTML tag removed :** info bre_<TAB>
GDB fills in the rest of the word breakpoints
, since that is the only info
subcommand beginning with bre
:
(gdb) **Illegal HTML tag removed :** info breakpoints
You can either press <RET> at this point, to run the info breakpoints
command, or backspace and enter something else, if breakpoints
does not look like the command you expected. (If you were sure you wanted info breakpoints
in the first place, you might as well just type <RET> immediately after info bre
, to exploit command abbreviations rather than command completion).
If there is more than one possibility for the next word when you press <TAB>, DDD sounds a bell. You can either supply more characters and try again, or just press <TAB> a second time; GDB displays all the possible completions for that word. For example, you might want to set a breakpoint on a subroutine whose name begins with make_
, but when you type Illegal HTML tag removed : b make_<TAB>, DDD just sounds the bell. Typing <TAB> again displays all the function names in your program that begin with those characters. If you type <TAB> again, you cycle through the list of completions, for example:
(gdb) **Illegal HTML tag removed :** b make _ <TAB> DDD sounds bell; press <TAB> again, to see: make_a_section_from_file make_environ make_abs_section make_function_type make_blockvector make_pointer_type make_cleanup make_reference_type make_command make_symbol_completion_list (gdb) **Illegal HTML tag removed :** b make _ <TAB> DDD presents one expansion after the other: (gdb) b make_a_section_from_file <TAB> (gdb) b make_abs_section <TAB> (gdb) b make_blockvector <TAB>
After displaying the available possibilities, GDB copies your partial input (b make_
in the example) so you can finish the command--by pressing <TAB> again, or by entering the remainder manually.
Sometimes the string you need, while logically a "word", may contain parentheses or other characters that GDB normally excludes from its notion of a word. To permit word completion to work in this situation, you may enclose words in '
(single quote marks) in GDB commands.
The most likely situation where you might need this is in typing the name of a C++ function. This is because C++ allows function overloading (multiple definitions of the same function, distinguished by argument type). For example, when you want to set a breakpoint you may need to distinguish whether you mean the version of name
that takes an int
parameter, name(int)
, or the version that takes a float
parameter, name(float)
. To use the word-completion facilities in this situation, type a single quote '
at the beginning of the function name. This alerts GDB that it may need to consider more information than usual when you press <TAB> to request word completion:
(gdb) **Illegal HTML tag removed :** b 'bubble( _<TAB> bubble(double,double) bubble(int,int) (gdb) **Illegal HTML tag removed :** b 'bubble( _
In some cases, DDD can tell that completing a name requires using quotes. When this happens, DDD inserts the quote for you (while completing as much as it can) if you do not type the quote in the first place:
(gdb) **Illegal HTML tag removed :** b bub _<TAB> DDD alters your input line to the following, and rings a bell: (gdb) **Illegal HTML tag removed :** b 'bubble( _
In general, DDD can tell that a quote is needed (and inserts it) if you have not yet started typing the argument list when you ask for completion on an overloaded symbol.
If you prefer to use the <TAB> key for switching between items, unset Edit => Preferences => General => TAB Key completes in All Windows
. This is useful if you have pointer-driven keyboard focus (see below) and no special usage for the <TAB> key. If the option is set, the <TAB> key completes in the debugger console only.
This option is tied to the following resource:
globalTabCompletion(class GlobalTabCompletion) | Resource |
---|---|
If this is on (default), the <TAB> key completes arguments in all windows. If this is off , the <TAB> key completes arguments in the debugger console only. |
---|
Node:Command History, Next:Typing in the Source Window, Previous:Command Completion, Up:Entering Commands
Command History
You can repeat previous and next commands by pressing the <Up> and <Down> arrow keys, respectively. This presents you previous and later commands on the command line; use <Return> to apply the current command.
If you enter an empty line (just use <Return> at the debugger prompt), the last command is repeated as well.
Commands => Command History
shows the command history.
You can search for previous commands by pressing <Ctrl+B>. This invokes incremental search mode, where you can enter a string to be searched in previous commands. Press <Ctrl+B> again to repeat the search, or <Ctrl+F> to search in the reverse direction. To return to normal mode, press <ESC>, or use any cursor command.
The command history is automatically saved when exiting DDD. You can turn off this feature by setting the following resource to off
:
saveHistoryOnExit(class SaveOnExit) | Resource |
---|---|
If on (default), the command history is automatically saved when DDD exits. |
---|
Node:Typing in the Source Window, Previous:Command History, Up:Entering Commands
Typing in the Source Window
As a special convenience, anything you type into the source window is automatically forwarded to the debugger console. Thus, you don't have to change the keyboard focus explicitly in order to enter commands.
You can change this behaviour using the following resource:
consoleHasFocus(class ConsoleHasFocus) | Resource |
---|---|
If on (default), all keyboard events in the source window are automatically forwarded to the debugger console. If off , keyboard events are not forwarded. If auto , keyboard events forwarded only if the debugger console is open. |
---|
Node:TTY mode, Next:Integrating DDD, Previous:Entering Commands, Up:Commands</small>