Whole document tree
3.2 Command completionGDB 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 fills in the rest of the word `breakpoints', since that is
the only
You can either press RET at this point, to run the 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:
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
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
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:
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. You can use the command
This document was generated by root on January, 30 2002 using texi2html |