Next: , Previous: Nested Procedures, Up: Program Structure


2.7 Block Structure

The program's block structure is represented by the N_LBRAC (left brace) and the N_RBRAC (right brace) stab types. The variables defined inside a block precede the N_LBRAC symbol for most compilers, including GCC. Other compilers, such as the Convex, Acorn RISC machine, and Sun acc compilers, put the variables after the N_LBRAC symbol. The values of the N_LBRAC and N_RBRAC symbols are the start and end addresses of the code of the block, respectively. For most machines, they are relative to the starting address of this source file. For the Gould NP1, they are absolute. For stabs in sections (see Stab Sections), they are relative to the function in which they occur.

The N_LBRAC and N_RBRAC stabs that describe the block scope of a procedure are located after the N_FUN stab that represents the procedure itself.

Sun documents the desc field of N_LBRAC and N_RBRAC symbols as containing the nesting level of the block. However, dbx seems to not care, and GCC always sets desc to zero.

For XCOFF, block scope is indicated with C_BLOCK symbols. If the name of the symbol is ‘.bb’, then it is the beginning of the block; if the name of the symbol is ‘.be’; it is the end of the block.