If you use Prism on programs that have been compiled with optimization options, you should expect different behavior from Prism commands and changes in the visibility of variables in the optimized programs.
When the control flow is inside a routine that has been compiled with both -g and an optimization option (a debuggable optimized routine), the next and step commands change their behavior:
next steps out of the current routine and stops in the next debuggable routine that differs from the original routine.
step stops in the next debuggable routine (including recursive calls of the original routine).
You can set breakpoints using the stop at command inside debuggable optimized routines only at the first line of such a routine. If the routine name is foo and the first instruction in foo is ADDR_INSTR then the breakpoint is set as if you had used stop in foo or stopi at ADDR_INSTR.
Note that the following (related) commands are unaffected:
nexti
stepi
stopi
When the control flow returns to a debuggable optimized routine, as a result of one of the following commands:
return
stepout
then Prism assumes that the current position is at the first line of the current routine. Prism makes the same assumption when the source file position (at the command line or in the GUI) is updated as a result of up or down commands ending in a debuggable optimized routine.
Due to the effects of optimization on variable location in executable programs that have been compiled with optimization, not all variables can be accessed by Prism at all times.
The accessibility of variables can be defined by whether the variables can be used in expressions that require the right value of the variable (such as print X, or call foo(X)) or the left value of the variable (such as assign X=1).
The limits of accessibility can be described by the flow of control in an optimized program. When the flow of control is in a routine compiled with both -g and an optimization flag:
If the control flow is at the first machine instruction of the routine (which has not yet been executed), then all global variables and the routine's arguments are accessible. No other local variable is accessible.
If the first machine instruction of the current routine has already been executed, then only the global variables are accessible. No local variable is accessible.
The following commands can use only accessible variables:
where - The where stack will display values only for accessible arguments, and `???' for all the others.
The where command reports all active stack frames which have a stack pointer. The where command does not report routines that have no frame pointer and routines that have been inlined.