Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)

((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_
After displaying the available possibilities, GDB copies your partial input ('b make_' in the
example) so you can finish the command.
If you just want to see the list of alternatives in the first place, you can press M-? rather than pressing
TAB twice. M-? means META?. You can type this either by holding down a key designated as the
META shift on your keyboard (if there is one) while typing
?
, or as ESC followed by
?
.
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 or
M-?
to request word completion:
((gdb)) b 'bubble( M-?
bubble(double,double) bubble(int,int)
((gdb)) b 'bubble(
In some cases, GDB can tell that completing a name requires using quotes. When this happens,
GDB inserts the quote for you (while completing as much as it can) if you do not type the quote in
the first place:
((gdb)) b bub TAB
GDB alters your input line to the following, and rings a bell:
((gdb)) b 'bubble(
In general, GDB 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.
For more information about overloaded functions, see “C++ expressions” (page 77). You can use
the command set overload-resolution off to disable overload resolution; see “GDB
features for C++” (page 78).
Getting help
You can always ask GDB itself for information on its commands, using the command help.
help, h You can use help (abbreviated h) with no arguments to display a short list
of named classes of commands:
((gdb)) help
List of classes 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
Getting help 25