Debugging with GDB (February 2008)

Table Of Contents
Chapter 14: HP-UX Configuration-Specific Information 183
14.23.2 Support for Fortran array slices
HP WDB prints Fortran array slices if you specify a range of elements by the Fortran
90 array section syntax. For instance, for an array X declared by REAL, DIMENSION(-
1:1, 2:10) :: X, you could print all five even-numbered elements of the row with the
first dimension equal to 0 by typing the WDB command print X(0,2:10:2).
14.23.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.23.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.23.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