Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
Range checking, if turned on, is done on mathematical operations. Array indices are
not checked, since they are often used to index a pointer that is not itself an array.
9.4.1.6 GDB and C
The set print union and show print union commands apply to the union
type. When set to 'on', any union that is inside a struct or class is also printed.
Otherwise, it appears as '{...}'.
The @ operator aids in the debugging of dynamic arrays, formed with pointers and a
memory allocation function. See “Expressions” (page 76).
9.4.1.7 GDB features for C++
Some GDB commands are particularly useful with C++, and some are designed
specifically for use with C++. Here is a summary:
breakpoint menus When you want a breakpoint in a function whose
name is overloaded, GDB breakpoint menus help
you specify which function definition you want.
See “Breakpoint menus” (page 58).
rbreak regex Setting breakpoints using regular expressions is
helpful for setting breakpoints on overloaded
functions that are not members of any special
classes. See “Setting breakpoints” (page 47).
catch throw, catch catch Debug C++ exception handling using these
commands. See “Setting catchpoints” (page 51).
ptype typename Print inheritance relationships as well as other
information for type. typename. See Chapter 10
(page 108).
set print demangle, show
print demangle, set print
Control whether C++ symbols display in their
source form, both when displaying code as C++
source and when displaying disassemblies. See
“Print settings” (page 83).
asm-demangle, show print
asm-demangle
set print object, show print
object
Choose whether to print derived (actual) or
declared types of objects. See “Print settings
(page 83).
set print vtbl, show print
vtbl
Control the format for printing virtual function
tables. See “Print settings” (page 83). (The vtbl
commands do not work on programs compiled
with the HP ANSI C++ compiler (aCC).)
set overload-resolution on Enable overload resolution for C++ expression
evaluation. The default is on. For overloaded
functions, GDB evaluates the arguments and
104 Using GDB with Different Languages