HPlogo System Debug Reference Manual > Chapter 2 User Interface

Procedure Name: Symbols

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Symbolic procedure names, which represent logical code addresses of the type class LCPTR, may be used as operands in expressions. Thus, to determine the virtual address of the procedure FOPEN, the WL command may be used as follows:

   $nmdebug > wl FOPEN
   SYS $a.345498
   $nmdebug >

In the above example, since no System Debug variable named FOPEN was found, the expression evaluator searched for the symbol in the currently loaded program file and libraries, finding it in NL.PUB.SYS.

Procedure name symbols stand for slightly different locations depending on the mode of System Debug. In CM, they stand for the starting address of the code bodies that they name. In NM, they stand for the entry address. Since compilers may emit constants before executable instructions in System Object Modules, breakpoints should always be set at entry addresses. To find the entry address of a CM procedure, the procedure symbol name should be prefixed by the question mark (?), as explained below.

When searching program files and libraries for procedure symbols, System Debug behaves differently depending on its mode. In NM, procedure names are case sensitive, and the program file and libraries are searched in the following order:
  • NM search order: first... PROG, GRP, PUB, USERs, SYS ...last

In CM, procedure names are case insensitive, and the following search order is used:
  • CM search order: first... PROG, GRP, PUB, LGRP, LPUB, SYS ...last

Each of the above search orders, which visit all currently loaded files, is known as a full search path. Note that this order is the same as that used by the CM and NM loaders in satisfying external references in program files and libraries, as specified in the LIB= and LIBLIST= parameters of the RUN command.

Variations of certain commands, such as BREAK, DISPLAY, MODIFY, TRANSLATE, FREEZE, and UNFREEZE, restrict the search path for procedure name symbols in their parameters to a single loaded code file. In addition, certain coercion functions (PROG, GRP, PUB, LGRP, LPUB, SYS) also restrict the search path for procedure name symbols in their parameters to a single loaded code file. This allows references to procedure symbols in a particular library, that would otherwise be inaccessible if they were redefined in preceding libraries on the full search path.

Two symbol tables are present in NM executable libraries and program files. The first symbol table is called the Loader Symbol Table (LST) and is utilized by the native mode loader. It contains only exported level 1 procedure names, which are hashed to support fast symbol name lookups.

The second symbol table is called the System Object Module (SOM) symbol table. This symbol table contains all compiler-generated symbols (procedure, data, internal labels, try/recover, and so on), which are maintained in no particular order. Any lookup attempt must be made sequentially through the symbols.

If the SOM symbols are being searched and an ambiguous name is entered, the first symbol that matches the name found during the sequential search of the symbol table is used.

The symbol table used by the expression evaluator for symbol lookups is based on the environment variable LOOKUP_ID. The variable may take on any of the following values. (The default setting is LSTPROC.)
UNIVERSAL

Search exported procedures in the SOM symbols.

LOCAL

Search nonexported procedures in the SOM symbols.

NESTED

Search nested procedures in the SOM symbols.

PROCEDURES

Search local or exported procedures in the SOM symbols.

ALLPROC

Search local/exported/nested procedures in the SOM symbols.

EXPORTSTUB

Search export stubs in the SOM symbols.

DATAANY

Search exported or local data SOM symbols.

DATAUNIV

Search exported data SOM symbols.

DATALOCAL

Search local data SOM symbols.

LSTPROC

Search exported level 1 procedures in the LST.

LSTEXPORTSTUB

Search export stubs in the LST.

ANY

Search for any type of symbol in the SOM symbols.


NOTE: Using the SOM symbol table is noticeably slower than using the LST.

!procedure_name

Just as System Debug variable names composed of only the letters "A" through "F" may conflict with hex constants, so may procedure name symbols. Preceding such name symbols with an exclamation point makes the expression scanner see the name as a symbol instead of a hex constant. However, System Debug variable names take precedence over procedure name symbols, so the variable name ADD makes a procedure of that name invisible in expressions. In this case, the functions CMADDR and NMADDR can be used to locate the procedure names.

?procedure_name

Sometimes the address that a procedure name symbol represents is not appropriate for a particular use. By preceding a procedure name symbol with a question mark, a different address is returned, depending on the mode of System Debug.

In CM, ?procedure_name returns the entry point address for the named procedure instead of its start address. This is the address of interest when setting CM breakpoints. In NM, the question mark prefix returns the export stub address of the procedure. This is the entry location used by callers from external modules. Please refer to the Procedure Calling Conventions Reference Manual for a detailed discussion of export stubs and native mode procedure organization.




Macros


Operand Lookup Precedence