Previous | Contents | Index |
This chapter is an introduction to using the OpenVMS Debugger with Compaq Fortran programs. This chapter provides the following information:
A debugger is a tool that helps you locate run-time errors quickly. It is used with a program that has already been compiled and linked successfully, but does not run correctly. For example, the output may be obviously wrong, or the program goes into an infinite loop or terminates prematurely. The debugger enables you to observe and manipulate the program's execution interactively so you can locate the point at which the program stopped working correctly.
The OpenVMS Debugger is a symbolic debugger, which means that you can refer to program locations by the symbols (names) you used for those locations in your program---the names of variables, subroutines, labels, and so on. You do not need to use virtual addresses to refer to memory locations.
By issuing debugger commands at your terminal, you can perform the following operations:
Such techniques allow you to isolate an error in your code much more quickly than you could without the debugger.
Once you have found the error in the program, you can then edit the
source code and compile, link, and run the corrected version.
4.2 Getting Started with the Debugger
This section explains how to use the debugger with Compaq Fortran programs. The section focuses on basic debugger functions, to get you started quickly. It also provides any debugger information that is specific to Compaq Fortran.
Before you can use the debugger, you must compile and link your program. The following example shows how to compile and link a Compaq Fortran program (consisting of a single compilation unit in the file INVENTORY.F90) prior to using the debugger.
$ FORTRAN/DEBUG/NOOPTIMIZE INVENTORY $ LINK/DEBUG INVENTORY |
The /DEBUG qualifier on the FORTRAN command line causes the compiler to write the debug symbol records associated with INVENTORY.F90 into the object module INVENTORY.OBJ. These records allow you to use the names of variables and other symbols declared in INVENTORY.F90 in debugger commands. (If your program has several compilation units, each of the program units that you want to debug must be compiled with the /DEBUG qualifier.)
Use the /NOOPTIMIZE qualifier when you compile a program in preparation for debugging. Otherwise, the object code is optimized (to reduce the size of the program and make it run faster), so that the symbolic evaluation of some program locations may be inconsistent with what you might expect from viewing the source code. For example, a variable in an optimized program may not be available. (After debugging the program, recompile it without the /NOOPTIMIZE qualifier.) For a description of the various optimizations performed by the compiler, see Chapter 5.
The /DEBUG qualifier on the LINK command line causes the linker to include all symbol information that is contained in INVENTORY.OBJ in the executable image. This qualifier also causes the OpenVMS image activator to start the debugger at run time. (If your program has several object modules, you may need to specify the other modules on the LINK command line.)
On the effects of specifying the /DEBUG qualifier on the FORTRAN, LINK,
and RUN command lines, see Section 2.3.14 and Section 3.3.
4.2.2 Establishing the Debugging Configuration and Interface
Before invoking the debugger, check that the debugging configuration is appropriate for the kind of program you want to debug.
The configuration depends on the current value of the logical name DBG$PROCESS. Before invoking the debugger, issue the DCL command SHOW LOGICAL DBG$PROCESS to determine the current definition of DBG$PROCESS.
The default configuration is appropriate for almost all programs. To request the default debugging configuration. the logical name DBG$PROCESS is undefined or has the value DEFAULT. For example, the following command shows when DBG$PROCESS is undefined:
$ SHOW LOGICAL DBG$PROCESS %SHOW-S-NOTRAN, no translation for logical name DBG$PROCESS |
To define DBG$PROCESS to have a value of DEFAULT, type:
$ DEFINE DBG$PROCESS DEFAULT |
To remove (deassign) a logical name definition, use the DEASSIGN command.
If the DECwindowstm Motif product is installed and running on your workstation, by default the OpenVMS Debugger uses the DECwindows Motif interface. To use the character cell interface on a DECwindows system, define the logical:
$ DEFINE/PROCESS DBG$DECW$DISPLAY " " |
To define this logical name for multiple users, use other logical name tables.
To enable use of the DECwindows interface, deassign the logical:
$ DEASSIGN/PROCESS DBG$DECW$DISPLAY |
The DECwindows interface provides a main window in which portions are updated as the program executes, including the source code, typed commands, and debugger messages. This interface provides pull-down menus and uses the kept debugger (equivalent of DEBUG/KEEP).
The examples in this chapter show the command line (character cell) interface to the OpenVMS debugger.
The character cell interface to the OpenVMS debugger provides the following debugging interfaces:
Screen mode is activated by pressed PF3 on the keypad (or type the command SET MODE SCREEN). Screen mode allows the debugger character cell interface to simultaneously display separate groups of data similar to the DECwindows interface. For example, your screen might show the source code (SRC), debugger output (OUT), and debugger command input (PROMPT) displays.
While in screen mode, use the SHOW DISPLAY command to view the predefined displays and the DISPLAY command to define a new display. To view the keypad definitions in screen mode, press PF2 on the keypad.
To leave screen mode and resume line-oriented mode, press PF1 PF3 (or type the command SET SCREEN NOSCREEN).
On the DECwindows Motif debugger interface (including a source browser)
and screen mode, see the OpenVMS Debugger Manual.
4.2.3 Invoking the Debugger
After you compile and link your program and establish the appropriate debugging configuration, you can then invoke the debugger. To do so, enter the DCL command RUN, specifying the executable image of your program as the parameter. For example, enter the following command to debug the program INVENTORY:
$ RUN INVENTORY OpenVMS Alpha DEBUG Version x.x-xxx %DEBUG-I-INITIAL, language is FORTRAN, module set to INVENTORY DBG> GO %DEBUG-I-EXITSTATUS, is '%SYSTEM-S-NORMAL, normal successful completion' DBG> EXAMINE N INVENTORY\N: 4 DBG> EXIT $ |
The diagnostic message that is displayed at the debugger startup indicates that this debugging session is initialized for a Compaq Fortran program and that the name of the main program unit is INVENTORY. In the initial "%DEBUG-I-INITIAL" message, the OpenVMS Debugger term "module" is equivalent to a Compaq Fortran "procedure".
When some qualifiers are used to compile (/WARNINGS=ALIGNMENT or most /CHECK keywords), the debugger does not start up in the main program. When this happens, type GO once to get to the beginning of the main program.
The DBG> prompt indicates that you can now type debugger commands. At this point, if you type the GO command, program execution begins and continues until it is forced to pause or stop (for example, if the program prompts you for input or an error occurs).
You can specify the DEBUG command /KEEP qualifier to use the kept debugger. The kept debugger allows you to run one (or more) programs with the RUN command, rerun the last program run with a RERUN command, and connect and disconnect to a running process. For example:
$ DEBUG /KEEP OpenVMS Alpha DEBUG Version x.x-xxx DBG> RUN SQUARES %DEBUG-I-INITIAL, language is FORTRAN, module set to SQUARES DBG> GO %DEBUG-I-EXITSTATUS, is '%SYSTEM-S-NORMAL, normal successful completion' DBG> RERUN DBG> STEP stepped to SQUARES\%LINE 4 4: OPEN(UNIT=8, FILE='DATAFILE.DAT', STATUS='OLD') DBG> EXAMINE N DEBUGEX$MAIN\N: 0 DBG> GO %DEBUG-I-EXITSTATUS, is '%SYSTEM-S-NORMAL, normal successful completion' DBG> EX N DEBUGEX$MAIN\N: 4 DBG> EXIT |
For more information on using the debugger and invoking the debugger
for other display modes, see the OpenVMS Debugger Manual.
4.2.4 Debugger Commands Used Often
You can use the following debugger commands when debugging any program:
DBG> SPAWN MAIL |
The OpenVMS Debugger supports breakpoints, tracepoints, and watchpoints to help you find out what happens at critical points in your program.
Set a breakpoint if you want the debugger to stop program execution at a certain point in your program (routine, line number, and so on). After you set a breakpoint and begin program execution, execution stops at the breakpoint, allowing you to look at the contents of program variables to see if they contain the correct values.
Use the following commands to control breakpoints:
Set a tracepoint to request that the debugger display messages when certain parts of your program execute. You can also specify an action for the tracepoint, such as displaying the value of a variable. Unlike breakpoints, execution continues past the tracepoint. For example, a tracepoint lets you see how many times a routine gets called.
Use the following commands to control tracepoints:
Set a watchpoint to request that the debugger stop execution when the values of certain variables (or memory locations) change. A breakpoint stops execution when a certain part of program is reached. In contrast, a watchpoint stops execution when a certain value changes.
The following commands are usually used to control watchpoints:
Before you set a breakpoint, tracepoint, or watchpoint, you can define
the scope to be used (by using the SET SCOPE or SET MODULE command, for
instance) or you can add a pathname prefix before a symbol name.
4.2.6 Ending a Debugging Session
To end a debugging session and return to the DCL level, type EXIT or press Ctrl/Z:
DBG> EXIT $ |
The following message, displayed during a debugging session, indicates that your program has completed normally:
%DEBUG-I-EXITSTATUS, is '%SYSTEM-S-NORMAL, normal successful completion' DBG> |
To continue debugging after seeing this message, type EXIT and start a new debugging session with the DCL RUN command.
If you specified the DEBUG command with the /KEEP qualifier when you
invoked the debugger, you can run the same program again from within
the debugging session (RERUN) and perform other functions.
4.2.7 Notes on Debugger Support for Compaq Fortran
In general, the debugger supports the data types and operators of Compaq Fortran and the other debugger-supported languages. However, the following are language-specific limitations and differences:
Example 4-1 shows a program called SQUARES that requires debugging. The program was compiled and linked without diagnostic messages from either the compiler or the linker. Compiler-assigned line numbers have been added in the example so that you can identify the source lines referenced in the explanatory text.
Example 4-1 Sample Program SQUARES |
---|
1 PROGRAM SQUARES 2 INTEGER (KIND=4) :: INARR(20), OUTARR(20) 3 ! Read the input array from the data file. 4 OPEN(UNIT=8, FILE='datafile.dat', STATUS='OLD') 5 READ(8,*,END=5) N, (INARR(I), I=1,N) 6 5 CLOSE (UNIT=8) 7 ! Square all nonzero elements and store in OUTARR. 8 K = 0 9 DO I = 1, N 10 IF (INARR(I) .NE. 0) THEN 11 OUTARR(K) = INARR(I)**2 12 ENDIF 13 END DO 14 15 ! Print the squared output values. Then stop. 16 PRINT 20, K 17 20 FORMAT (' Number of nonzero elements is',I4) 18 DO I = 1, K 19 PRINT 30, I, OUTARR(I) 20 30 FORMAT(' Element',I4,' has value',I6) 21 END DO 22 END PROGRAM SQUARES |
The program SQUARES performs the following functions:
When you run SQUARES, it produces the following output, regardless of the number of nonzero elements in the data file:
$ RUN SQUARES Number of nonzero elements is 0 |
The error occurs because variable K, which keeps track of the current index into OUTARR, is not incremented in the loop on lines 9 through 13. The statement K = K + 1 should be inserted just before line 11.
Example 4-2 shows how to start the debugging session and use the debugger to find the error in the program in Example 4-1. Comments keyed to the callouts follow the example.
Example 4-2 Sample Debugging Session Using Program SQUARES |
---|
$ FORTRAN/DEBUG/NOOPTIMIZE SQUARES (1) $ LINK/DEBUG SQUARES (2) $ SHOW LOGICAL DBG$PROCESS (3) %SHOW-S-NOTRAN, no translation for logical name DBG$PROCESS $ RUN SQUARES (4) OpenVMS Alpha DEBUG Version x.x-xxx %DEBUG-I-INITIAL, language is FORTRAN, module set to SQUARES DBG> STEP 5 (5) stepped to SQUARES\%LINE 9 9: DO 10 I = 1, N DBG> EXAMINE N,K (6) SQUARES\N: 4 SQUARES\K: 0 DBG> STEP 2 (7) stepped to SQUARES\%LINE 11 11: OUTARR(K) = INARR(I)**2 DBG> EXAMINE I,K (8) SQUARES\I: 1 SQUARES\K: 0 DBG> DEPOSIT K = 1 (9) DBG> SET TRACE/SILENT %LINE 11 DO (DEPOSIT K = K + 1) (10) DBG> GO (11) Number of nonzero elements is 4 Element 1 has value 9 Element 2 has value 4 Element 3 has value 25 Element 4 has value 4 %DEBUG-I-EXITSTATUS, is 'SYSTEM-S-NORMAL, normal successful completion' DBG> EXIT (12) $ EDIT SQUARES.FOR (13) . . . 10: IF(INARR(I) .NE. 0) THEN 11: K = K + 1 12: OUTARR(K) = INARR(I)**2 13: ENDIF . . . $ FORTRAN/DEBUG/NOOPTIMIZE SQUARES (14) $ LINK/DEBUG SQUARES $ RUN SQUARES (15) OpenVMS Alpha DEBUG Version x.x-xxx %DEBUG-I-INITIAL, language is FORTRAN, module set to SQUARES DBG> SET BREAK %LINE 12 DO (EXAMINE I,K) (16) DBG> SHOW BREAK breakpoint at SQUARES\%LINE 12 do (EXAMINE I,K) DBG> TYPE 7:14 module SQUARES 7: C ! Square all nonzero elements and store in OUTARR. 8: K = 0 9: DO I = 1, N 10: IF (INARR(I) .NE. 0) THEN 11: K = K + 1 12: OUTARR(K) = INARR(I)**2 13: ENDIF 14: END DO DBG> GO (17) break at SQUARES\%LINE 12 12: OUTARR(K) = INARR(I)**2 SQUARES\I: 1 SQUARES\K: 1 DBG> GO break at SQUARES\%LINE 12 12: OUTARR(K) = INARR(I)**2 SQUARES\I: 2 SQUARES\K: 2 DBG> GO break at SQUARES\%LINE 12 12: OUTARR(K) = INARR(I)**2 SQUARES\I: 3 SQUARES\K: 3 DBG> GO break at SQUARES\%LINE 12 12: OUTARR(K) = INARR(I)**2 SQUARES\I: 4 SQUARES\K: 4 DBG> GO Number of nonzero elements is 4 Element 1 has value 9 Element 2 has value 4 Element 3 has value 25 Element 4 has value 4 %DEBUG-I-EXITSTATUS, is '%SYSTEM-S-NORMAL, normal successful completion' DBG> EXIT (18) $ |
You usually display the values of variables by using the debugger
EXAMINE command, which accepts numerous qualifiers.
4.4.1 Accessing Compaq Fortran Common Block Variables
To display common block variables, type the EXAMINE command followed by the variable names that make up the common block. For example:
DBG> TYPE 1:8 1: 2: PROGRAM TEST 3: INTEGER*4 INT4 4: CHARACTER(LEN=1) CHR 5: COMMON /COM_STRA/ INT4, CHR 6: CHR = 'L' 7: INT4 = 0 8: END PROGRAM TEST DBG> STEP 3 stepped to TEST\%LINE 8 8: END PROGRAM TEST DBG> EXAMINE CHR, INT4 TEST\CHR: 'L' TEST\INT4: 0 |
To display derived-type structure variables, type the EXAMINE command followed by the derived-type variable name, a period (.) (or a %), and the member name. For example:
DBG> TYPE 1:6 1: PROGRAM TEST 2: 3: TYPE X 4: INTEGER A(5) 5: END TYPE X 6: TYPE (X) Z 7: 8: Z%A = 1 DBG> STEP 2 stepped to TEST\%LINE 10 10: END PROGRAM TEST DBG> EXAMINE Z.A TEST\Z.A(1:5) (1): 1 (2): 1 (3): 1 (4): 1 (5): 1 |
To display a field in a record structure, type the EXAMINE command followed by the record name, a period (.), and the field name. To display the entire record structure, type EXAMINE command followed by the record name. For example:
DBG> TYPE 1:9 module TEST 1: PROGRAM TEST 2: STRUCTURE /STRA/ 3: INTEGER*4 INT4 4: CHARACTER(LEN=1) CHR 5: END STRUCTURE 6: RECORD /STRA/ REC 7: 8: REC.CHR = 'L' 9: END PROGRAM TEST DBG> STEP 2 stepped to TEST\%LINE 11 11: END PROGRAM TEST DBG> EXAMINE REC.CHR TEST\REC.CHR: 'L' DBG> EXAMINE REC.INT4 TEST\REC.INT4: 0 DBG> EXAMINE REC TEST\REC INT4: 0 CHR: 'L' |
To display one or more array elements, type the EXAMINE command followed by the array name and subscripts in parentheses, as in Fortran source statements. To display the entire array, type EXAMINE following by the array name. For example:
DBG> TYPE 1:5 module ARRAY1 1: PROGRAM ARRAY1 2: INTEGER (KIND=4) ARRAY1(6) 3: ARRAY1 = 0 4: ARRAY1(1) = 1 5: ARRAY1(2) = 2 DBG> STEP 5 stepped to ARRAY1\%LINE 8 DBG> EXAMINE ARRAY1(1:2) ARRAY\ARRAY1(1): 1 ARRAY\ARRAY1(2): 2 DBG> EXAMINE ARRAY1 ARRAY\ARRAY1(1:6) (1): 1 (2): 2 (3): 0 (4): 0 (5): 0 (6): 0 |
To display a variable defined in a module, type a SET MODULE command before examining module variables. For example, with a variable named PINTA defined in a module named MOD1, enter the following EXAMINE command to display its value:
DBG> SET MODULE MOD1 DBG> TYPE 1:6 1: PROGRAM USEMODULE 2: USE MOD1 3: INT4=0 4: INT4(1)=1 5: PINTA = 4 6: END PROGRAM USEMODULE DBG> STEP 4 stepped to USEMODULE\%LINE 6 6: END PROGRAM USEMODULE DBG> EXAMINE PINTA USEMODULE\PINTA: 4 |
The following sections list all the debugger commands and any related DCL commands in functional groupings, along with brief descriptions. See the debugger's online help for complete details on commands.
During a debugging session, you can get online HELP on any command and its qualifiers by typing the HELP command followed by the name of the command in question. The HELP command has the following form:
HELP command |
4.5.1 Starting and Terminating a Debugging Session
$ RUN | Invokes the debugger if LINK/DEBUG was used. |
$ RUN/[NO]DEBUG | Controls whether the debugger is invoked when the program is executed. |
DBG> Ctrl/Z or EXIT | Ends a debugging session, executing all exit handlers. |
DBG> QUIT | Ends a debugging session without executing any exit handlers declared in the program. |
DBG> Ctrl/C | Aborts program execution or a debugger command without interrupting the debugging session. |
|
Assigns the default Ctrl/C abort function to another Ctrl-key sequence or identifies the Ctrl-key sequence currently defined for the abort function. |
$ Ctrl/Y DEBUG | The sequence Ctrl/Y DEBUG interrupts a program that is running without debugger control and invokes the debugger. |
DBG> ATTACH | Passes control of your terminal from the current process to another process (similar to the DCL command ATTACH). |
DBG> SPAWN | Creates a subprocess; lets you issue DCL commands without interrupting your debugging context (similar to the DCL command SPAWN). |
$ DEBUG/KEEP | Invokes the kept debugger, which allows certain additional commands to be used, including RUN and RERUN. |
DBG> RUN image-name | When using the kept debugger, runs the specified program. |
DBG> RERUN | When using the kept debugger, runs the last program executed again. |
GO | Starts or resumes program execution. |
STEP | Executes the program up to the next line, instruction, or specified instruction. |
|
Establishes or displays the default qualifiers for the STEP command. |
|
Sets, displays, cancels, activates, or deactivates breakpoints. |
|
Sets, displays, cancels, activates, or deactivates tracepoints. |
|
Sets, displays, cancels, activates, or deactivates watchpoints. |
SHOW CALLS | Identifies the currently active subroutine calls. |
SHOW STACK | Gives additional information about the currently active subroutine calls. |
CALL | Calls a subroutine. |
EXAMINE | Displays the value of a variable or the contents of a program location |
SET MODE [NO]OPERANDS | Controls whether the address and contents of the instruction operands are displayed when you examine an instruction. |
DEPOSIT | Changes the value of a variable or the contents of a program location. |
EVALUATE | Evaluates a language or address expression. |
|
Establishes the radix for data entry and display, displays the radix, or restores the radix. |
|
Establishes the type for program locations that are not associated with a compiler generated type, displays the type, or restores the type. |
SET MODE [NO]G_FLOAT |
Controls whether double-precision floating-point constants are
interpreted as G_FLOAT or D_FLOAT.
You can also use SET TYPE or EXAMINE commands to define untyped program locations, such as SET TYPE S_FLOAT, EXAMINE/T_FLOAT, or EXAMINE/X_FLOAT. |
TYPE | Displays lines of source code. |
EXAMINE/SOURCE | Displays the source code at the location specified by the address expression. |
|
Creates, displays, or cancels a source directory search list. |
SEARCH | Searches the source code for the specified string. |
|
Establishes or displays the default qualifiers for the SEARCH command. |
SET STEP [NO]SOURCE | Enables or disables the display of source code after a STEP command has been executed or at a breakpoint, tracepoint, or watchpoint. |
|
Establishes or displays the maximum number of source files that may be kept open at one time. |
|
Establishes or displays the left and right margin settings for displaying source code. |
SET MODE [NO]SCREEN | Enables or disables screen mode. |
SET MODE [NO]SCROLL | Controls whether an output display is updated line by line or once per command. |
DISPLAY | Modifies an existing display. |
|
Creates, identifies, or deletes a display. |
|
Creates, identifies, or deletes a window definition. |
SELECT | Selects a display for a display attribute. |
SHOW SELECT | Identifies the displays selected for each of the display attributes. |
SCROLL | Scrolls a display. |
SAVE | Saves the current contents of a display and writes it to another display. |
EXTRACT | Saves a display or the current screen state and writes it to a file. |
EXPAND | Expands or contracts a display. |
MOVE | Moves a display across the screen. |
|
Establishes or displays the height and width of the screen. |
|
Refreshes the screen. |
EDIT | Invokes an editor during a debugging session. |
|
Establishes or identifies the editor invoked by the EDIT command. |
DEFINE | Defines a symbol as an address, command, value, or process group. |
DELETE | Deletes symbol definitions. |
|
Establishes or displays the default qualifier for the DEFINE command. |
SHOW SYMBOL/DEFINED | Identifies symbols that have been defined. |
SET MODE [NO]KEYPAD | Enables or disables keypad mode. |
DEFINE/KEY | Creates key definitions. |
DELETE/KEY | Deletes key definitions. |
SET KEY | Establishes the key definition state. |
SHOW KEY | Displays key definitions. |
DECLARE | Defines parameters to be passed to command procedures. |
|
Specifies or identifies the debugger log file. |
SET OUTPUT [NO]LOG | Controls whether a debugging session is logged. |
SET OUTPUT [NO]SCREEN_LOG | Controls whether, in screen mode, the screen contents are logged as the screen is updated. |
SET OUTPUT [NO]VERIFY | Controls whether debugger commands are displayed as a command procedure is executed. |
SHOW OUTPUT | Displays the current output options established by the SET OUTPUT command. |
|
Establishes or displays the default file specification that the debugger uses to search for command procedures. |
@file-spec | Executes a command procedure. |
IF | Executes a list of commands conditionally. |
FOR | Executes a list of commands repetitively. |
REPEAT | Executes a list of commands repetitively. |
WHILE | Executes a list of commands conditionally, possibly multiple times. |
EXITLOOP | Exits an enclosing WHILE, REPEAT, or FOR loop. |
SET PROMPT | Specifies the debugger prompt. |
SET OUTPUT [NO]TERMINAL | Controls whether debugger output is displayed or suppressed, except for diagnostic messages. |
|
Establishes or displays the current language. |
|
Establishes or identifies the current run-time facility for language-specific events. |
SHOW EXIT_HANDLERS | Identifies the exit handlers declared in the program. |
|
Modifies the tasking environment or displays task information. |
|
Disables the delivery of ASTs in the program, enables the delivery of ASTs, or identifies whether delivery is enabled or disabled. |
SET MODE [NO]SEPARATE | Controls whether a separate window is created on a workstation for debugger input and output (this command has no effect on VT-series terminals). |
The OpenVMS Debugger supports the SET BREAK/EXCEPTION and SET TRACE/EXCEPTION commands to set a breakpoint or tracepoint when an exception occurs. To allow precise reporting of the exception, compile the program using:
If you use the FORTRAN command qualifier /FLOAT=IEEE_FLOAT to specify IEEE floating-point (S_float and T_float) data, you can also use the /IEEE_MODE qualifier to indicate how exceptions should be handled.
For example, you might use the following commands to create the executable program:
$ FORTRAN/DEBUG/NOOPTIMIZE/FLOAT=IEEE_FLOAT/SYNCHRONOUS_EXC/CHECK=ALL TEST (1) $ LINK/DEBUG TEST $ RUN TEST OpenVMS Alpha DEBUG Version x.x-xxx %DEBUG-I-INITIAL, language is FORTRAN, module set to SQUARES %DEBUG-I-NOTATMAIN, type GO to get to start of main program DBG> GO (2) break at routine TEST$MAIN 1: REAL (KIND=4) :: A,B DBG> SET BREAK/EXCEPTION DO (SHOW CALLS) (3) DBG> GO (4) %SYSTEM-F-HPARITH, high performance arithmetic trap, Imask=00000000, Fmask=00000002, summary=08, PC=00020050, PS=0000001B (5) -SYSTEM-F-FLTOVF, arithmetic trap,floating overflow at PC=00020050,PS=0000001B break on exception preceding TEST$MAIN\%LINE 3+20 3: B=A*A module name routine name line rel PC abs PC *TEST$MAIN TEST$MAIN 3 00000050 00020050 00000130 00020130 SHARE$DEC$FORRTL 00000000 000B0A30 00000130 00020130 00000000 84F4BAD8 DBG> TYPE 1:3 (6) 1: REAL (KIND=4) :: A,B 2: A=2.5138E20 3: B=A*A DBG> EXIT $ |
The OpenVMS Debugger supports the SET BREAK/UNALIGNED command to set a breakpoint when unaligned data is accessed. To allow precise reporting of the source code accessing the unaligned data, compile the program using the FORTRAN command qualifier /SYNCHRONOUS_EXCEPTIONS.
For example, you might use the following commands to create the executable program:
$ FORTRAN/DEBUG/NOOPTIMIZE/SYNCHRONOUS_EXCEPT INV_ALIGN (1) $ LINK/DEBUG INV_ALIGN $ RUN INV_ALIGN OpenVMS Alpha DEBUG Version x.x-xxx %DEBUG-I-INITIAL, language is FORTRAN, module set to INV_ALIGN DBG> SET BREAK/UNALIGNED (2) DBG> GO Unaligned data access: virtual address = 0003000A, PC = 000200A0 (3) break on unaligned data trap preceding INV_ALIGN\OOPS\%LINE 10 10: end DBG> TYPE 7:9 7: subroutine oops(i4) 8: integer*4 i4 9: i4 = 1 DBG> EXIT $ |
Previous | Next | Contents | Index |