Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)

14.28.3 Displaying enumerators
You can display the union of several enumeration elements by specifying a value if the elements
of the enumeration type are the powers of 2 and the given value is a sum of any given combination
of the enumeration elements.
For example, assume you have an enumerated type named color in the program, with these
elements: RED=0, ORANGE=1, YELLOW=2, GREEN=8, and BLUE=16. If you use the command
printf 3, the debugger displays ORANGE|YELLOW, the elements corresponding to 1 and 2. If
you print 5, you will get the value, 5, because it does not form the sum of any combination in the
set. However, if you wanted to print 25, you will get Orange|Green|Blue.
Values that do not form the sum of any combination of the elements will be displayed as integers
while the values that form the sum of any combination of the elements will be printed as unions.
14.28.4 Support for debugging typedefs
When you have a typedef class as a template parameter, you can set a breakpoint on a member
function by using the command:
break Class<typedef_classB>::memfunc
14.28.5 Support for steplast command for C and C++
Typically, if a function call has arguments that make further function calls, executing a simple step
command in GDB steps into the argument evaluation call. HP WDB includes the steplast
command, which helps to step into a function, and not into the calls for evaluating the arguments.
However, the steplast command is not available on Integrity systems. The following example
illustrates how GDB behaves when you execute the steplast command:
(gdb) 16 foo (bar ()); ---> bar() will return 10 (gdb) steplast foo (x=10) at
foo.c:4 4 int k = 10;
If the steplast command is not meaningful for the current line, GDB displays the following error
message:
"Steplast is not meaningful for the current line."
For example,
(gdb) 4 int k = 10; (gdb) sl ---> alias to "steplast" command error: Steplast
is not meaningful for the current line
To execute the steplast command in C++ compiled applications, you must compile the application
using the HP aC++ version A.03.50 or later with the -g0 option.
In C++, the steplast command is helpful while debugging heavy templated functions, because
it directly steps into the call, thus skipping the constructor calls, if any. This behavior is unlike the
step command that steps into the constructor itself.
Consider the following example:
void call_me ( string s ) ... (gdb)
10
call_me ( "hello" );
(gdb) steplast call_me (s=static npos = 4294967295,
static nullref = ref_hdr = mutex_= dummy1 = 0x7f4f79e0, dummy2 = 2136325568,
refs_ = 2136327612,
capacity_ = 2136327468, nchars_ = 2136327464, eos_char = 64 '@',
alloc_ = <No data fields>,
value_allocator = alloc_ = 0x7f7f133c,
data_ = 0x40003a64 "hello") at str.C:55
printf ("Will just print the value of \n");
If there are multiple top-level calls, the steplast command enables you to step into each top-level
call. For example, for the following line, the steplast command takes you to the first top-level
call, (foo()):
foo(bar()) + bar(foo());
178 HP-UX Configuration-Specific Information