Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)

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.
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
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());
Debug foo(), use the finish command to exit from the first top-level call, (foo()), execute
the steplast command to step into the next top-level call, (bar()). The following example
illustrates the use of steplast command:
(gdb)10 foo( bar() ) + bar( foo() ) (gdb) sl Use the steplast (sl) command to step
Getting information from a non-debug executable
You can get some information about the arguments passed to the functions displayed in the stack
trace in a non-debug, optimized executable.
Getting information from a non-debug executable 171