In This Book

You may explicitly refer to user-declared symbol names, created with the declare command, by using a block quali￿ed name of the form `declared\ name. User-declared sym bol names are de￿ned in an outer block named `declared . Since program symbol names visible from the current environment are searched before user-declared symbol names, user-declared symbol names may be hidden by program symbol names.

When the debugger cannot ￿nd a symbol name by following the normal scope rules or by searching the outer language or user-declared blocks, it looks at variables declared to be external (that is, variables declared to be visible everywhere). Similarly, when the debugger cannot ￿nd a block name, it searches for a procedure not enclosed within another procedure.

Frame Block Qualified Names

You can identify dynamically activated symbols within recursive procedures using frame block quali￿ers. Frame block quali￿ers use both a block and a frame to specify the current environment.

Recursive procedures are called multiple times and produce multiple frames (invocations) on the call/return stack. The debugger distinguishes one invocation from another by identifying the current environment as both a block and a frame. The block serves as a naming context, as described in \Block Quali￿ed Names", and helps to determine which variable names are visible and which are not. The frame indicates which invocation of that blo ck the debugger should use to locate local data.

When a recursive procedure produces more than one instance of a block on the call/return stac k, local symbols in that block have more than one instance. The current environment consists of both a frame and a block. The debugger uses the block to determine which variable is intended, and it uses the frame to determine which instance of that variable to use.

If a block has not been in voked, then the bloc k is said to be inactive, and you may only examine its static data objects. If a block has been invoked once, then that instance is used. In the example sho wn in Figure 7-3, use print_answer\COUNTER to refer to the COUNTER variable in frame `main(5) . If a block has been invoked more than once, the most recen t instance is chosen by default; for example, binary_search\HI refers to the HI variable in frame `main(4) by default.

7-10 Identifying Program Objects