beautypg.com

6 gdb and c, 7 gdb features for c, 6 gdb and c 9.4.1.7 gdb features for c – HP gnu source-level debugger 5992-4701 User Manual

Page 111

background image

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 83)

.

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 62)

.

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 52)

.

catch throw

, catch catch

Debug C++ exception handling using these
commands. See

“Setting catchpoints” (page 56)

.

ptype typename

Print inheritance relationships as well as other
information for type. typename. See

Chapter 10

(page 115)

.

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 90)

.

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 90)

.

set print vtbl

, show print

vtbl

Control the format for printing virtual function
tables. See

“Print settings” (page 90)

. (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

9.4 Supported languages

111