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 directives 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.25.6 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

14.26 Viewing Wide Character Strings

HP WDB print command can print wide characters and wide-character strings of the type wchar_t. The user must use the /W option of the print command to print wide characters and wide-character strings.

print /W <wide-char-symbol-name>

14.26 Viewing Wide Character Strings 223

Page 223
Image 223
HP gnu source-level debugger 5992-4701 Viewing Wide Character Strings, Command for evaluating the address of an expression