Debug Manual

Table Of Contents
Debug Manual421921-003
F-1
F Sample Debug Sessions
This section of the manual provides step-by-step demonstrations of using Debug
commands for debugging TNS, accelerated, and native programs. For more
information on TNS programs, accelerated programs, and native programs, see
Section 2, Using Debug on TNS/R Processors in this manual.
We provide the source listing (Example F-1 on page F-2), which can be compiled with
either a TAL or pTAL compiler. We also provide TNS and native program listings.
When going through the examples, you should refer to the compiled listings; otherwise,
the examples will not make much sense to you.
Overview of Example Program
The first few lines of the source code listing show declarations of various procedures.
For more information about these procedures, see the Guardian Procedure Calls
Reference Manual. Following the procedure declarations, there are three global
variables, INT MY_TERMNUM, INT array PROCESS_HANDLE, and an extended
STRING pointer SP that is initialized to starting address of 2000000 (octal).
Following the global variables, there is the EXAMPLE_INIT procedure, which has a set
of local variables and some code that uses some of the procedure declared at the
beginning of the program. The code manipulates both local and global variables. Note
that the EXAMPLE_INIT procedure opens a terminal file. We will write data to and read
data from this file to demonstrate the use of various Debug commands.
The EXAMPLE_FILL_ARRAY procedure takes a single parameter. This procedure
also has some local variables and code. The code manipulates global and local
variables. This procedure reads and writes the terminal opened by the EXAMPLE_INIT
procedure.
Finally, we have the EXAMPLE_MAIN procedure, which is declared as the MAIN of the
program. This procedure calls the EXAMPLE_INIT procedure, allocates memory
segments, then calls the EXAMPLE_FILL_ARRAY procedure several times, passing in
a different memory segment number on each call.
Example Program Page
TNS Program Example
F-3
Accelerated Program Example F-23
Native Program Example F-28
Privileged Commands F-49