20
Chapter 5. gdb Commands
(gdb) 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], gdb 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
b make_[TAB]
gdb just sounds
the bell. Typing [TAB] again displays all the function names in your program that begin with those
characters, for example:
(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(
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......