Creating and Accessing Symbol Definitions [ System Debug Reference Manual ] MPE/iX 5.0 Documentation
System Debug Reference Manual
Creating and Accessing Symbol Definitions
Before data structures can be accessed symbolically, their definitions
must be made known to System Debug. This subsection describes how the
symbolic definitions are generated and how they are subsequently made
known to System Debug. The final result is a program file containing
symbolic type information. Such files are referred to as symbolic data
type files or simply symbolic files.
Generate Symbolic Type Information
The generation of symbolic data type definitions begins at compile time
through the use of the $SYMDEBUG 'xdb'$ option in the Pascal compiler.
This option causes symbolic debug records to be emitted into the
relocatable object modules contained in the relocatable library produced
by the compiler. These symbolic debug records fall into two basic
categories: those that define the code being generated and those that
define the data type shapes and sizes. System Debug at present uses only
the data type definitions.
System Debug does not require that the complete program be compiled with
the $SYMDEBUG$ option; instead, only the types and constants need be
compiled. However, even though only types and constants are compiled,
the outer block MUST have at least one statement (for example, x := 1) in
order to generate any debug information, and the types and constants must
be declared at the level of the outer block. Also, note that symbolic
information is currently not emitted when code optimization is performed.
The following example shows a compilation of just a program's types for
the purpose of obtaining, in object file form, the symbolic information
required to use the symbolic formatter.
$SYMDEBUG 'xdb'$
PROGRAM gradtyp;
$include 'tgrades.demo.telesup'; { Include all types/constants }
VAR x : integer;
BEGIN { Outer block must have a stmt }
x := 1;
END.
:COMMENT *** The above program is in the file OGRADTYP.DEMO.TELESUP
:
:PASXL OGRADTYP,YGRADTYP,$NULL
:
:COMMENT *** The above command generates the file "YGRADTYP"
Convert The Relocatable Library Into A Program File
The relocatable object module(s) generated by the Pascal compiler must
now be converted into an executable object module (a program file). This
step is performed by using the LINKEDIT program.
:LINKEDIT.PUB.SYS
HPLinkEditor/XL (HP32650-xx.yy.zz) (c) Hewlett-Packard Co 1986
LinkEd> link from=ygradtyp.demo.telesup;to=gradtyp.demo.telesup
LinkEd> exit
:
Preprocess the Program File with PXDB
The program file produced by LINKEDIT must be run through a utility
called PXDB. This program preprocesses the symbolic debug information for
more efficient access during symbolic debugging.
:PXDB.PUB.SYS gradtyp.demo.telesup
Copying gradetyp.demo.telesup...Done
Procedures: 1
Files: 1
:
Prepare the Program File with SYMPREP
System Debug needs to perform additional preprocessing of the object
module file after PXDB. Quick data type lookup tables are built and
symbols are sorted for fast access. The results of this phase are saved
in the program file so it need only be performed once.
Once this step is completed, the file is in a form usable by System
Debug. Such a file is called a symbolic data type file. This final task
is performed from within DAT or DEBUG by using the SYMPREP command:
:DAT
DAT XL A.00.00 Copyright Hewlett-Packard Co. 1987. All rights reserved.
$1 ($0) $nmdebug > SYMPREP gradtyp
Preprocessing GRADTYP.DEMO.TELESUP
Copying file...
Building Constant lookup table...
Sorting...
Building Type lookup table...
Sorting...
Building lookup table header...
Fixing up SOM directory structure...
GRADTYP.DEMO.TELESUP preprocessed
$2 ($0) $nmdebug >
Open the Symbolic Data Type File with SYMOPEN
The System Debug SYMOPEN command is used to access the symbols in a
preprocessed program file (symbolic data type file). The user may
optionally assign each symbolic file a symbolic name when it is
opened. If no symbolic name is specified, the file name (minus the
.GROUP.ACCOUNT) is used as the symbolic name. In the following example,
the file gradtyp is opened and assigned the default symbolic name
gradtyp.
$nmdat > SYMOPEN GRADTYPE
$nmdat > SYMFILES
GRADTYP GRADTYP.DEMO.TELESUP
$nmdat >
In summary the following steps must be performed before a symbolic data
type file is ready for use by System Debug:
1. Construct a small program which contains all type declarations to
be made available to System Debug. The program must have at least
one executable statement, and the type declarations must all
appear at the level of the outer block.
2. Compile data types with the $SYMDEBUG 'xdb'$ option.
3. Run the relocatable library generated by the compiler through the
Link Editor.
4. Run the program file generated by the Link Editor through PXDB.
5. Prepare the modified program file generated by PXDB with System
Debug SYMPREP command.
6. Open the program file with System Debug SYMOPEN command.
MPE/iX 5.0 Documentation