Debugging with GDB (September 2007)

Chapter 14: HP-UX Configuration-Sp e cific Information 177
another imaginary number. You can take a normal number and add it to an imaginary
numb e r to get a complex number.
Complex numbers cannot be used in arithmetic expressions in the debugger.
For more information of _Complex type , refer to the HP C/ANSI C documentation.
14.21.8 Support for debugging namespaces
This release of HP WDB provides full support for debugging namespaces.
You do not need to use fully qualified names to access symbols within a namespace.
The debugger can compile a list of namespaces active in the scope that you are in and,
when possible, choose an appropriate symbol.
The debugger recognizes using declarations, using directives, namespace aliases, nested
namespaces, and unqualified lookup within a namespace. It also recognizes using di-
rectives and aliases, and using declarations within namespaces.
When the debugger has a list of possible resolutions for a given symbol, it displays a
menu that shows all names fully qualified whenever namespaces are involved. You can
choose the appropriate symbol from the list.
For example, if you stop the debugger in a function that contains an int i using
directive for a namespace such as:
using namespace A::AB::ABC::ABCD
You can use the command print i and if the only possible resolution for i is
A::AB::ABC::ABCD::i the debugger prints out the name of the symbol and its value.
If, however, a global i exists, the debugger displays a menu from which to choose:
(1) i
(2) A::AB::ABC::ABCD::i
>
Setting breakpoints on functions works in the same way.
The debugger also allows semi-qualified names. For example, if you stop in a function
in namespace B, which is nested in namespace A, and namespace A has an int i, you
can use print B::i to display the value of A::B::i.
To disable namespace support, use the command:
(gdb) set namespaces-enabled off
14.21.9 Command for evaluating the address of an expression
The watch_target command takes an expression as an argument, evaluates it to an
address, and watches the target of that address.
For example:
(gdb) watch_target current_frame
This is equivalent to executing:
(gdb) print current_frame $1 = (struct frame_info *) 0x7fdf78 (gdb) watch
*(struct frame_info *) 0x7fdf78