Using HP Toolset/iX [ HP FORTRAN 77/iX Programmer's Guide ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Programmer's Guide
Using HP Toolset/iX
HP Toolset/iX performs the following:
* Sets breakpoints
* Interactively displays and modifies the values of variables
* Displays subroutines or functions currently called
* Traces each subroutine or function as it executes
* Traces variables as they are modified by the program
Compiling Programs for HP Toolset/iX
To symbolically debug, you must compile your program with the SYMDEBUG
compiler directive, which instructs the compiler to generate additional
information needed by HP Toolset/iX.
The directive
$SYMDEBUG [ON]
or
$SYMDEBUG [TOOLSET]
must be included at the beginning of your source file or passed to the
compiler through the INFO string.
Invoking HP Toolset/iX
To invoke HP Toolset/iX, enter
RUN TOOLSET.PUB.SYS
or
TOOLSET
In the examples in this chapter, underlined items represent user input.
Setting Up for Symbolic Debug
Once you are in HP Toolset/iX, you must set up a workspace as shown
below:
workspace wsname
Create workspace wsname? yes
Default language for wsname? fortran
A screen is displayed after the workspace is set up. The HP Toolset/iX
workspace features described in the HP Toolset/iX Reference Manual are
not available for HP FORTRAN 77/iX. To directly proceed to symbolic
debug, press the f3 key (Set OK). This exits the "Set" screen and
places you at the HP Toolset/iX prompt, ">>".
Refer to the HP Toolset/iX Reference Manual for a detailed description of
HP Toolset/iX.
When to Use HP Toolset/iX
Using the symbolic debugger increases the size of your program (often by
a factor of two or three).
When your program executes correctly and you no longer need the symbolic
debugger, remove the compiler option, recompile the source files, and
relink the object files. Without the debugging information, the program
occupies less space, allowing it to link and execute faster.
You might want to maintain two versions of a program: one with debugging
information for support purposes and one production version that has the
debugging information removed.
Running a Program
The RUN command executes a program that has been compiled with Symbolic
Debug. The RUN command either executes the program that is currently set
up in your workspace (which is useful for non-FORTRAN programs), or
executes a program that you specify (used for FORTRAN programs). The
program must have been compiled with the SYMDEBUG compiler directive.
Refer to the HP Toolset/iX Reference Manual for the complete syntax of
the RUN command and a detailed description of the parameters.
Syntax
RUN progfile
To make a program known to HP Toolset/iX, enter the following:
USE progfile
RUN progfile
Setting Breakpoints
The AT command allows you to set up to 15 active breakpoints in your
program. You can set a breakpoint specifying a subroutine or function
name or you can specify a location with an offset. The breakpoint is
permanent unless the FOR clause is used. There are additional features
of this command, as shown in the syntax below:
Syntax
AT {location} [[EVERY] n [TIMES]] [FOR {n } [TIMES]]
{NEXT } [ {ALL} ]
[DO [command-list]]
[ [BREAK ]]
Examples
The following statement sets a breakpoint at the beginning of the
subroutine named sub1:
AT sub1
The following statement sets a breakpoint at line 20 in the function
named func2:
AT func2#20
NOTE You cannot directly set a breakpoint at FORTRAN entry statements.
However, using the AT NEXT command stops your program from entering
any subroutine. Therefore, the AT NEXT command allows you to stop
at entry statements.
Tracing Names
The CALLS command displays the names of the subroutines and functions
that are currently executing. The trace begins with the most recently
called subroutine or function. The statement following the call is also
displayed.
Syntax
CA[LLS]
NOTE For entry calls, the name of the enclosing subroutine is displayed.
However, the accompanying statement number reflects execution of
the entry statement.
Clearing Breakpoints
The CLEAR command removes breakpoints from your program.
Syntax
{location}
CL[EAR] {next }
{ALL }
Example
The following statement clears the breakpoint at the location sub1:
CL sub1
Displaying Variables
The DISPLAY command causes the current contents of the specified FORTRAN
variable (data item) to be displayed on your terminal in octal, integer,
character, or hexadecimal format. By default, the variables are
displayed in the format most appropriate for the data type.
Syntax
{rec-item } [O[CTAL] ]
DI[SPLAY] {data-item} [I[NTEGER] ] [[FOR] n [ITEMS]]
{"literal"} [C[HARACTER] ]
[H[EXADECIMAL]]
Example
If your program has the declarations
INTEGER*4 long_integer_var
REAL*4 real_var
DOUBLE COMPLEX double_complex_var
LOGICAL*2 short_logical_var
INTEGER*4 array_var(2:5,1:3)
CHARACTER*8 array_char_var(4,4,4)
INTEGER*2 i, j
COMMON /BLKA/i(4), j(6), alpha
CHARACTER*4 alpha
COMMON k,l
The following is output using DISPLAY commands:
>>DISPLAY long_integer_var
--> Stmt #101: Var: LONG_INTEGER_VAR = 1234567890
>>DIS real_var
--> Stmt #101: Var: REAL_VAR = 0.123456E38
>>DIS double_complex_var
--> Stmt #101: Var: DOUBLE_COMPLEX_VAR = (8.2E308,7.1E308)
>>DIS short_logical_var
--> Stmt #101: Var: SHORT_LOGICAL_VAR = .TRUE.
>>DISPLAY array_var
--> Stmt #101: Var ARRAY_VAR
--> Starting with ARRAY_VAR[2:1]
4321 6654 87654321 6789
--> Continuing with ARRAY_VAR[2:2]
65432 121 159753 0
--> Continuing with ARRAY_VAR[2:3]
456 1 369 5
If the value of ARRAY_CHAR_VAR(1,2,3) is abcdefgh, the output is
>>DISPLAY array_char_var(1,2,3)FOR 4 ITEMS
--> Stmt #101: Var ARRAY_CHAR_VAR = 'efgh'
where the final subscript in the command is the start character.
>>DIS blka
--> Stmt #101: COMMON BLOCK: BLKA
I - ARRAY
--> Starting with I(1)
0 4321 54 3
--> Starting with J(1)
1 23 45 67 87 5
ALPHA = 'abcd'
Use the identifier COM' to display an unnamed common block. For example,
>>DIS COM'
--> Stmt #103: COMMON BLOCK: COM'
K=2
L=3
Modifying Variables
The MOVE command transfers the value of a literal, a figurative constant
(such as .TRUE. and .FALSE.), or a variable, to another variable.
Syntax
{literal }
MOV[E] {data-item-1 } TO data-item-2 [[FOR] n [ITEMS]]
{fig-constant}
Example
If your program has the declarations
INTEGER*4 long_integer_var
REAL*4 real_var
REAL*8 long_real_var
DOUBLE COMPLEX double_complex_var
LOGICAL*2 short_logical_var
LOGICAL*4 array_var(25)
CHARACTER*8 array_char_var
the following is output using the MOVE command:
>>MOVE 45 to long_integer_var
--> Stmt#1: Var: LONG_INTEGER_VAR = 45
>>MO 3.14E38 TO real_var
--> Stmt#1: Var: REAL_VAR = 3.14E38
>>MO (13.3E73,14.4E60) TO double_complex_var
--> Stmt#1: Var: DOUBLE_COMPLEX_VAR = (13.3E73,14.4E60)
>>MO .TRUE. TO short_logical_var
--> Stmt#1: Var: SHORT_LOGICAL_VAR = .TRUE.
>>MO 20 TO array_var(1) FOR 5 TIMES
--> Stmt#1: Var: ARRAY_VAR[1]
--> Starting with ARRAY_VAR[1] 20 20 20 20 20
>>MO 'This is nice' TO array_char_var
--> Stmt#1: Var: ARRAY_CHAR_VAR = 'This is nice'
>>MO real_var TO long_real_var
--> Stmt#1: Var: long_real_var = 3.14E38
Redoing a Command
The REDO command allows you to correct and re-execute the last command or
command list. The command editing is performed with EDITOR program
operators.
Syntax
RED[O]
Example
>>MVE 30 TO long_integer_var
**Undefined TOOLSET/iX command keyword. (101)
>>REDO
MVE 30 TO long_integer_var
iO
MOVE 30 TO long_integer_var
CR
-->Stmt#1: Var: LONG_INTEGER_VAR = 30
Restarting Your Program
The RESUME command starts or restarts the execution of your program at
the location at which it was halted.
Syntax
RES[UME]
Displaying Breakpoints
The SHOW DEBUG command displays the breakpoints and the names of any data
item traced in the current program.
Syntax
SHO[W] D[EBUG]
Using the Trace Facilities
The TRACE command displays each subroutine or function name as it is
executed. An identifying message is displayed at the start and end of
each subroutine or function.
Syntax
T[RACE] [OFF]
The DATATRACE command monitors the value of a data item. If the value
changes, a message containing the location and the new value is
displayed.
Syntax
DA[TATRACE] data-item [DO command-list [NOMESSAGE]]
[OFF ]
The RETRACE command lists the last n subroutines or functions that have
executed, ending with the most recent subroutine or function.
Syntax
RET[RACE] [PROCEDURES]
Accessing MPE/iX Debug
The SYSDEBUG command allows you to access MPE/iX DEBUG from HP
Toolset/iX.
Syntax
SYS[DEBUG]
Ending Execution of a Program Prematurely
The END RUN command ends execution of your program prematurely. This
command immediately terminates your program and returns control to HP
Toolset/iX.
Syntax
EN[D] RU[N]
Exiting HP Toolset/iX
The EXIT command exits HP Toolset/iX and returns control to the MPE/iX
operating system.
Syntax
EX[IT]
Example
>>EXIT
END OF PROGRAM
MPE/iX 5.0 Documentation