manpagez: man pages & more
info gdb
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Command Completion

No value for GDBN 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 No value for GDBN commands, No value for GDBN subcommands, and the names of symbols in your program.

Press the <TAB> key whenever you want No value for GDBN to fill out the rest of a word. If there is only one possibility, No value for GDBN fills in the word, and waits for you to finish the command (or press <RET> to enter it). For example, if you type

 
(No value for GDBP) info bre <TAB>

No value for GDBN fills in the rest of the word ‘breakpoints’, since that is the only info subcommand beginning with ‘bre’:

 
(No value for GDBP) 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>, No value for GDBN sounds a bell. You can either supply more characters and try again, or just press <TAB> a second time; No value for GDBN 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> No value for GDBN just sounds the bell. Typing <TAB> again displays all the function names in your program that begin with those characters, for example:

 
(No value for GDBP) b make_ <TAB>
No value for GDBN 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
(No value for GDBP) b make_

After displaying the available possibilities, No value for GDBN 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 No value for GDBN 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 No value for GDBN 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 No value for GDBN that it may need to consider more information than usual when you press <TAB> or M-? to request word completion:

 
(No value for GDBP) b 'bubble( M-?
bubble(double,double)    bubble(int,int)
(No value for GDBP) b 'bubble(

In some cases, No value for GDBN can tell that completing a name requires using quotes. When this happens, No value for GDBN inserts the quote for you (while completing as much as it can) if you do not type the quote in the first place:

 
(No value for GDBP) b bub <TAB>
No value for GDBN alters your input line to the following, and rings a bell:
(No value for GDBP) b 'bubble(

In general, No value for GDBN 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 set overload-resolution off to disable overload resolution; see No value for GDBN Features for C++.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.