|
|
HP/DDE Debugger User's Guide: HP 9000 Series 700/800 Computers > Chapter 7 Identifying Program Objects Understanding Blocks and Environments |
|
A block is a program unit, such as a module, a main program, a subroutine, or a function. What constitutes a block depends on the language in which the program is written. Use the list blocks command to display the blocks in the program you are debugging. A block defines and encloses a scope, the region of source code over which a name's declaration is active. The debugger also defines blocks called `declared (for user-declared symbols), `predefined (for data types for supported languages) and `image (for the program images). The debugger defines two environments:
The current environment is identical to the run environment, except when you explicitly change it to another block (by using the environment command, for example). The source file display shows an arrow at the current point of execution. When the current environment is set to some other block, a horizontal bar appears within the block where the current environment is set. In addition, the block containing the current point of execution is displayed after the PC Location label above the source display. The current environment block is displayed after the Current Location label. Each time execution of the target program stops, the debugger sets the current environment to the run environment. The debugger starts its search for objects within the block that corresponds to the current environment. If the debugger cannot find the object in the current environment, it extends its search into outer encompassing blocks. The debugger bases its search of outer blocks on the scope and visibility rules described in “Applying Scope and Visibility Rules”. For multi-threaded applications (implemented using HP DCE threads), the debugger also includes a thread component in its concept of environment. See “Debugging Multi-Threaded Applications” for more information on debugging multi-threaded applications. Commonly, you may need to change environment because you cannot access a variable or expression from the current point of execution. For example, setting a watchpoint on a variable fails and a not found in current environment message is displayed. To change the environment, use one of the following methods:
The debugger uses the source language of the current environment when evaluating expressions. You can use the property language command to change the language of evaluation, or you can use the print -language command to override the default language used to evaluate a single expression. For example, when the current environment is using the C language manager, you can use FORTRAN as the language of evaluation for a command:
Now, although C is the language that corresponds to the current environment, you can evaluate a FORTRAN expression:
These commands are fully described in the online command reference. |
|