Debugging C++ Applications Using HP WDB (766162-001, March 2014)

The display of dynamic type information is supported for C++ class pointers and references. All
other types display static type information. In addition, if the dynamic type of an object cannot be
determined, the debugger defaults to the use of static type information.
To display dynamic type information, the object's static type must have at least one virtual function
defined as a part of its interface (either the virtual function it introduced or the virtual function it
inherited from a base class). If no virtual functions are present for an object, only the static type
information for that object is available for display.
HP WDB provides an option through print command, the set print object command allows
you to control the type information displayed. The default value is OFF, which indicates that the
static type information will be displayed. Setting it to ON, causes the debugger to display dynamic
type information. The output of the print and ptype commands are affected.
Choose whether to display real-time or static types of objects.set print object [on |
off]
Show current status.show print object
HP WDB enables you to view the run-time type information for C++ polymorphic object.
This command displays run-time type information for C++ polymorphic object. The
input to this command is the address of the C++ polymorphic object. HP WDB displays
the demangled type name as output.
NOTE: This command is supported on HP Integrity systems only.
info rtti <address>
The syntax of info rtti command is as shown below.
(gdb) info rtti <address>
RTTI: <run time type/class name>
Example 13 shows a sample program for displaying static and dynamic type information.
22