[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
You can abbreviate a GDB command to the first few letters of the command name, if that abbreviation is unambiguous; and you can repeat certain GDB commands by typing just RET. You can also use the TAB key to get GDB to fill out the rest of a word in a command (or to show you the alternatives available, if there is more than one possibility).
3.1 Command Syntax How to give commands to GDB 3.2 Command Completion Command completion 3.3 Getting Help How to ask GDB for help
[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
A GDB command is a single line of input. There is no limit on
how long it can be. It starts with a command name, which is followed by
arguments whose meaning depends on the command name. For example, the
command step
accepts an argument which is the number of times to
step, as in `step 5'. You can also use the step
command
with no arguments. Some commands do not allow any arguments.
GDB command names may always be truncated if that abbreviation is
unambiguous. Other possible command abbreviations are listed in the
documentation for individual commands. In some cases, even ambiguous
abbreviations are allowed; for example, s
is specially defined as
equivalent to step
even though there are other commands whose
names start with s
. You can test abbreviations by using them as
arguments to the help
command.
A blank line as input to GDB (typing just RET) means to
repeat the previous command. Certain commands (for example, run
)
will not repeat this way; these are commands whose unintentional
repetition might cause trouble and which you are unlikely to want to
repeat. User-defined commands can disable this feature; see
dont-repeat.
The list
and x
commands, when you repeat them with
RET, construct new arguments rather than repeating
exactly as typed. This permits easy scanning of source or memory.
GDB can also use RET in another way: to partition lengthy
output, in a way similar to the common utility more
(see section Screen Size). Since it is easy to press one
RET too many in this situation, GDB disables command
repetition after any command that generates this sort of display.
Any text from a # to the end of the line is a comment; it does nothing. This is useful mainly in command files (see section Command Files).
The Ctrl-o binding is useful for repeating a complex sequence of commands. This command accepts the current line, like RET, and then fetches the next line relative to the current line from the history for editing.
[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
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) info bre TAB |
(gdb) info breakpoints |
(gdb) b make_ TAB GDB 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) b make_ |
(gdb) b 'bubble( M-? bubble(double,double) bubble(int,int) (gdb) b 'bubble( |
(gdb) b bub TAB GDB alters your input line to the following, and rings a bell: (gdb) b 'bubble( |
[ <] | [ >] | [ <<] | [ Up] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
You can always ask GDB itself for information on its commands,
using the command help
.
help
h
help
(abbreviated h
) with no arguments to
display a short list of named subjects of commands:
(gdb) help List of subjects of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without stopping the program user-defined -- User-defined commands Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) |
(gdb) help status Status inquiries. List of commands: info -- Generic command for showing things about the program being debugged show -- Generic command for showing things about the debugger Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) |
apropos reload |
set symbol-reloading -- Set dynamic symbol table reloading multiple times in one run show symbol-reloading -- Show dynamic symbol table reloading multiple times in one run |
complete i |
if ignore info inspect |
[ <<] | [ >>] | [Top] | [Contents] | [Index] | [ ?] |
Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.
These pages are maintained by the GDB developers.
Copyright Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
This document was generated by GDB Administrator on March, 27 2008 using texi2html