Debugging with GDB (February 2008)

Table Of Contents
Chapter 14: HP-UX Configuration-Specific Information 187
local variables may be examined, except for unused variables (which may be elimi-
nated). New values may be assigned to a global and a local variable (set <var> =
<expression>) when stepping by line (step/next/break <line>). However, while
stepping by instruction (stepi/nexti) at optimization level +O1, assign a value to a
variable only if stopped at the very first instruction. This is a must as local optimiza-
tions are performed within a statement.
Backtrace commands (backtrace) may be used to display the current nest of function
calls, including for calls that are inlined. Note that even at +O1, C++ methods that
are defined within a class and Fortran arithmetic statement functions are implicitly
inlinable and are inlined. Other functions are not inlined, regardless of the inline
pragmas or keywords.
14.25.1.2 +O2/+O3/+O4/-ipo
Stepping by line number (step/next) and running to a breakpoint(break) moves the
state of a program forward. However, the program execution does not necessarily stop
at the given line.
You can set breakpoints (break) at the entry to a routine that is not inlined and
examine the values of parameters when the program execution stops at the entry of a
routine. The local variables can be examined within a function. However, the values of
the local variables may not be available at all code locations in the function. Assignment
of new values to formal parameters or local variables is NOT supported in code compiled
with optimization above +O1.
Optimization of code results in the reordering of the instructions and the source line-
numbers. Hence, the value of the variable, which is printed by the debugger may not
correspond to the reported source code location. The debugger may print the value of
the variable at a source code location either before or after the reported source code
location.(If the printed value is not current with respect to the current source line,
the printed value will be the immediately previous or immediately later value for the
variable.)
Backtrace commands (backtrace) can be used to display the current nest of function
calls, including calls that are inlined. When stopped within the code for an inlined
call, the parameters and the local variables of the inlined routine are not reported
or available. The disassem command does not work for functions that have no code
(because all calls to these functions are inlined or these functions are not called at all).
HP WDB 5.7 and later versions provide support to prevent the debugged program
from stopping at instructions that are predicated false. The program execution can be
stopped by a software breakpoint, a hardware breakpoint, or an asynchronous signal. In
the case of optimizations such as if-conversion, the predicated false instructions indicate
that an alternate source path is executed. Hence, stopping the program at a predicated
false instruction results in the misleading conclusion that the path corresponding to
the predicated false instruction is executed. To prevent this ambiguity, HP WDB does
not stop at predicated false instructions.
The predicated false instructions are equated to NOPs (No OPeration), because these
instructions do not modify the processor state. The exception to this rule is the use