Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Completion.html
blobad9b2bb42c82c578a2384cf054e4b83d4ee328ce
1 <html lang="en">
2 <head>
3 <title>Debugging with GDB</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="Debugging with GDB">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Completion">Completion</a>,
13 Next:<a rel="next" accesskey="n" href="Help.html#Help">Help</a>,
14 Previous:<a rel="previous" accesskey="p" href="Command-Syntax.html#Command%20Syntax">Command Syntax</a>,
15 Up:<a rel="up" accesskey="u" href="Commands.html#Commands">Commands</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Command completion</h3>
21 GDB can fill in the rest of a word in a command for you, if there is
22 only one possibility; it can also show you what the valid possibilities
23 are for the next word in a command, at any time. This works for GDB
24 commands, GDB subcommands, and the names of symbols in your program.
26 <p>Press the &lt;TAB&gt; key whenever you want GDB to fill out the rest
27 of a word. If there is only one possibility, GDB fills in the
28 word, and waits for you to finish the command (or press &lt;RET&gt; to
29 enter it). For example, if you type
31 <pre class="example"> (gdb) info bre &lt;TAB&gt;
32 </pre>
34 GDB fills in the rest of the word <code>breakpoints</code>, since that is
35 the only <code>info</code> subcommand beginning with <code>bre</code>:
37 <pre class="example"> (gdb) info breakpoints
38 </pre>
40 <p>You can either press &lt;RET&gt; at this point, to run the <code>info
41 breakpoints</code> command, or backspace and enter something else, if
42 <code>breakpoints</code> does not look like the command you expected. (If you
43 were sure you wanted <code>info breakpoints</code> in the first place, you
44 might as well just type &lt;RET&gt; immediately after <code>info bre</code>,
45 to exploit command abbreviations rather than command completion).
47 <p>If there is more than one possibility for the next word when you press
48 &lt;TAB&gt;, GDB sounds a bell. You can either supply more
49 characters and try again, or just press &lt;TAB&gt; a second time;
50 GDB displays all the possible completions for that word. For
51 example, you might want to set a breakpoint on a subroutine whose name
52 begins with <code>make_</code>, but when you type <kbd>b make_&lt;TAB&gt;</kbd> GDB
53 just sounds the bell. Typing &lt;TAB&gt; again displays all the
54 function names in your program that begin with those characters, for
55 example:
57 <pre class="example"> (gdb) b make_ &lt;TAB&gt;
58 <br>GDB sounds bell; press &lt;TAB&gt; again, to see:<br>
59 make_a_section_from_file make_environ
60 make_abs_section make_function_type
61 make_blockvector make_pointer_type
62 make_cleanup make_reference_type
63 make_command make_symbol_completion_list
64 (gdb) b make_
65 </pre>
67 <p>After displaying the available possibilities, GDB copies your
68 partial input (<code>b make_</code> in the example) so you can finish the
69 command.
71 <p>If you just want to see the list of alternatives in the first place, you
72 can press <kbd>M-?</kbd> rather than pressing &lt;TAB&gt; twice. <kbd>M-?</kbd>
73 means <kbd>&lt;META&gt; ?</kbd>. You can type this either by holding down a
74 key designated as the &lt;META&gt; shift on your keyboard (if there is
75 one) while typing <kbd>?</kbd>, or as &lt;ESC&gt; followed by <kbd>?</kbd>.
77 <p>Sometimes the string you need, while logically a "word", may contain
78 parentheses or other characters that GDB normally excludes from
79 its notion of a word. To permit word completion to work in this
80 situation, you may enclose words in <code>'</code> (single quote marks) in
81 GDB commands.
83 <p>The most likely situation where you might need this is in typing the
84 name of a C<tt>++</tt> function. This is because C<tt>++</tt> allows function
85 overloading (multiple definitions of the same function, distinguished
86 by argument type). For example, when you want to set a breakpoint you
87 may need to distinguish whether you mean the version of <code>name</code>
88 that takes an <code>int</code> parameter, <code>name(int)</code>, or the version
89 that takes a <code>float</code> parameter, <code>name(float)</code>. To use the
90 word-completion facilities in this situation, type a single quote
91 <code>'</code> at the beginning of the function name. This alerts
92 GDB that it may need to consider more information than usual
93 when you press &lt;TAB&gt; or <kbd>M-?</kbd> to request word completion:
95 <pre class="example"> (gdb) b 'bubble( <kbd>M-?</kbd>
96 bubble(double,double) bubble(int,int)
97 (gdb) b 'bubble(
98 </pre>
100 <p>In some cases, GDB can tell that completing a name requires using
101 quotes. When this happens, GDB inserts the quote for you (while
102 completing as much as it can) if you do not type the quote in the first
103 place:
105 <pre class="example"> (gdb) b bub &lt;TAB&gt;
106 <br>GDB alters your input line to the following, and rings a bell:<br>
107 (gdb) b 'bubble(
108 </pre>
110 <p>In general, GDB can tell that a quote is needed (and inserts it) if
111 you have not yet started typing the argument list when you ask for
112 completion on an overloaded symbol.
114 <p>For more information about overloaded functions, see <a href="C-plus-plus-expressions.html#C%20plus%20plus%20expressions">C<tt>++</tt> expressions</a>. You can use the command <code>set
115 overload-resolution off</code> to disable overload resolution;
116 see <a href="Debugging-C-plus-plus.html#Debugging%20C%20plus%20plus">GDB features for C<tt>++</tt></a>.
118 </body></html>