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">
12 Node:
<a name=
"Debugging%20C%20plus%20plus">Debugging C plus plus
</a>,
13 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Debugging-C.html#Debugging%20C">Debugging C
</a>,
14 Up:
<a rel=
"up" accesskey=
"u" href=
"C.html#C">C
</a>
18 <h5 class=
"subsubsection">GDB features for C
<tt>++
</tt></h5>
20 <p>Some GDB commands are particularly useful with C
<tt>++
</tt>, and some are
21 designed specifically for use with C
<tt>++
</tt>. Here is a summary:
24 <dt><code></code>breakpoint menus
<code></code>
25 <dd>When you want a breakpoint in a function whose name is overloaded,
26 GDB breakpoint menus help you specify which function definition
27 you want. See
<a href=
"Breakpoint-Menus.html#Breakpoint%20Menus">Breakpoint menus
</a>.
29 <br><dt><code>rbreak
</code><var>regex
</var><code></code>
30 <dd>Setting breakpoints using regular expressions is helpful for setting
31 breakpoints on overloaded functions that are not members of any special
33 See
<a href=
"Set-Breaks.html#Set%20Breaks">Setting breakpoints
</a>.
35 <br><dt><code>catch throw
</code>
36 <dd><dt><code>catch catch
</code>
37 <dd>Debug C
<tt>++
</tt> exception handling using these commands. See
<a href=
"Set-Catchpoints.html#Set%20Catchpoints">Setting catchpoints
</a>.
39 <br><dt><code>ptype
</code><var>typename
</var><code></code>
40 <dd>Print inheritance relationships as well as other information for type
42 See
<a href=
"Symbols.html#Symbols">Examining the Symbol Table
</a>.
44 <br><dt><code>set print demangle
</code>
45 <dd><dt><code>show print demangle
</code>
46 <dd><dt><code>set print asm-demangle
</code>
47 <dd><dt><code>show print asm-demangle
</code>
48 <dd>Control whether C
<tt>++
</tt> symbols display in their source form, both when
49 displaying code as C
<tt>++
</tt> source and when displaying disassemblies.
50 See
<a href=
"Print-Settings.html#Print%20Settings">Print settings
</a>.
52 <br><dt><code>set print object
</code>
53 <dd><dt><code>show print object
</code>
54 <dd>Choose whether to print derived (actual) or declared types of objects.
55 See
<a href=
"Print-Settings.html#Print%20Settings">Print settings
</a>.
57 <br><dt><code>set print vtbl
</code>
58 <dd><dt><code>show print vtbl
</code>
59 <dd>Control the format for printing virtual function tables.
60 See
<a href=
"Print-Settings.html#Print%20Settings">Print settings
</a>.
61 (The
<code>vtbl
</code> commands do not work on programs compiled with the HP
62 ANSI C
<tt>++
</tt> compiler (
<code>aCC
</code>).)
64 <br><dt><code>set overload-resolution on
</code>
65 <dd>Enable overload resolution for C
<tt>++
</tt> expression evaluation. The default
66 is on. For overloaded functions, GDB evaluates the arguments
67 and searches for a function whose signature matches the argument types,
68 using the standard C
<tt>++
</tt> conversion rules (see
<a href=
"C-plus-plus-expressions.html#C%20plus%20plus%20expressions">C
<tt>++
</tt> expressions
</a>, for details). If it cannot find a match, it emits a
71 <br><dt><code>set overload-resolution off
</code>
72 <dd>Disable overload resolution for C
<tt>++
</tt> expression evaluation. For
73 overloaded functions that are not class member functions, GDB
74 chooses the first function of the specified name that it finds in the
75 symbol table, whether or not its arguments are of the correct type. For
76 overloaded functions that are class member functions, GDB
77 searches for a function whose signature
<em>exactly
</em> matches the
80 <br><dt><code></code>Overloaded symbol names
<code></code>
81 <dd>You can specify a particular definition of an overloaded symbol, using
82 the same notation that is used to declare such symbols in C
<tt>++
</tt>: type
83 <code></code><var>symbol
</var><code>(
</code><var>types
</var><code>)
</code> rather than just
<var>symbol
</var>. You can
84 also use the GDB command-line word completion facilities to list the
85 available choices, or to finish the type list for you.
86 See
<a href=
"Completion.html#Completion">Command completion
</a>, for details on how to do this.