📄 wfdebug.gml
字号:
BLANKS= null
STATUS= unknown
ACCESS= sequential
FORM= formatted
REC= 1
IOSTAT= 0
.exam end
.do end
.if '&machsys' = 'DOS' .do begin
.exam begin
DEBUG>unit
1 C:\CUSTOM.REC
6 CON
5 CON
.exam break
DEBUG>u 1
NAME= C:\CUSTOM.REC
ACCESS= sequential
ACTION= readwrite
BLANK= null
BLOCKSIZE= 16384
CARRIAGECONTROL= no
FORM= formatted
IOSTAT= 0
NEXTREC= 1
RECL= 256
RECORDTYPE= default
STATUS= unknown
.exam end
.do end
.if '&machsys' = 'QNX' .do begin
.exam begin
DEBUG>unit
1 2:/custom.rec
6 [33]$tty0
5 [33]$tty0
.exam break
DEBUG>u 1
FILE= 2:/custom.rec
RECL= 80
BLANKS= null
STATUS= unknown
ACCESS= sequential
FORM= formatted
REC= 1
IOSTAT= 0
.exam end
.do end
.*
.section The Where Command
.*
.ix 'debugger commands' where
.mbox begin
Where
.mbox end
.np
This command provides a program execution traceback and displays the
next line to be executed.
.millust begin
DEBUG>w
- Executing in SUB2, statement 7 in file hello.for
- Called from SUB1, statement 4 in file hello.for
- Called from MAIN PROGRAM, statement 1 in file hello.for
7 print *, 'hello world'
.millust end
.*
.section Executing System Commands
.*
.ix 'debugger commands' !
.mbox begin
! [<command>]
.mbox end
.np
The
.us !
command allows operating system commands, or other programs to be
executed from the debugger.
.np
If
.mono <command>
is specified, an attempt to execute the command is made.
Control will then immediately return to the debugger.
.if '&machsys' = 'VM/SP CMS' .do begin
.exam begin
DEBUG>! type demo listing
.exam end
.do end
.if '&machsys' = 'DOS' .do begin
.exam begin
DEBUG>! type demo.for
DEBUG>! cd examples
.exam end
.do end
.if '&machsys' = 'QNX' .do begin
.exam begin
DEBUG>! p demo.for
DEBUG>! cd examples
DEBUG>! chattr myprog p=+r
.exam end
.do end
.if '&machsys' = 'VMS' .do begin
.exam begin
DEBUG>! set def [-.examples]
%SYSTEM-S-NORMAL, normal successful completion
DEBUG>
.exam end
.do end
.np
.if '&machsys' = 'VM/SP CMS' .do begin
If
.mono <command>
is omitted then you will be placed at the system level so that more
than one command can be executed.
.exam begin
DEBUG>sys
type demo listing
erase demo temp
return
.exam end
.pc
Note, in the last example, that the CMS "RETURN" command must be used
to return to the debugger.
.do end
.if '&machsys' = 'DOS' .do begin
If
.mono <command>
is omitted, a new command processor (or shell) will be started.
Commands may be entered until an "EXIT" command is entered.
The "EXIT" command terminates the current command processor and
returns control to the debugger.
.np
If you are running on a DOS-hosted system:
.tinyexam begin
DEBUG>!
Microsoft(R) MS-DOS(R) Version 5.00
(C)Copyright Microsoft Corp 1981-1991.
C>type demo.for
C>erase demo.tmp
C>exit
DEBUG>
.tinyexam end
.np
If you are running on an OS/2-hosted system:
.tinyexam begin
DEBUG>!
Operating System/2 Command Interpreter Version 2.0
[C:\]type demo.for
[C:\]erase demo.tmp
[C:\]exit
DEBUG>
.tinyexam end
.do end
.if '&machsys' = 'QNX' .do begin
If
.mono <command>
is omitted, another QNX shell is invoked.
Commands may be entered until a CTRL/D key sequence is entered.
CTRL/D terminates the shell and returns control to the debugger.
.exam begin
DEBUG>sys
% p demo.for
% frel demo.tmp
% <CTRL/D>
DEBUG>
.exam end
.autonote Notes:
.note
There must be enough unused memory in the computer to run the QNX
shell and specified program.
.note
Entering a CTRL/Z sequence will also invoke another QNX shell.
.endnote
.do end
.if '&machsys' = 'VMS' .do begin
If
.mono <command>
is omitted, a process is spawned.
Commands may be entered until "logoff" is entered.
This terminates the process and returns control to the debugger.
.exam begin
DEBUG>sys
$ set def [-.examples]
$ logoff
%SYSTEM-S-NORMAL, normal successful completion
DEBUG>
.exam end
.do end
.*
.section Modifying Data
.*
.ix 'debugger commands' /
.mbox begin
/ <item> <value>
.mbox end
.np
The
.us /
command assigns the storage units identified by
.mono <item>
with
.mono <value>.
.mono <value>
can be any input string that can be specified in list-directed input.
See the section entitled "List-Directed Formatting" in the chapter
entitled "Format" in the Language Reference manual.
.mono <value>
and
.mono <item>
must follow the rules of list-directed input.
See the section entitled "List-Directed Input" in the same chapter.
.exam begin
DEBUG>/ X 1.5
DEBUG>/ A 3.1415926,2*4.243,7*65.12654
DEBUG>/ a 3.1415926
4.243, -4.243
7*65.12654
DEBUG>/ a(5) 73.33
DEBUG>/ L .TRUE.
DEBUG>/ C 'abc'
DEBUG>/ c(4:6) 'def'
DEBUG>/ D(2)(4:5) 'gh'
.exam end
.pc
In the above examples,
.id X
is a real variable,
.id A
is a real array containing 10 elements,
.id L
is a logical variable,
.id C
is a character variable, and
.id D
is a character array.
One example above illustrates that the elements of an array may be
entered on several lines of input.
Prompting continues until enough values have been read to fill the
.if '&machsys' = 'VM/SP CMS' .do begin
array or a terminal "end-of-file" is encountered.
A terminal end-of-file is generated by pressing the line-entering key
without typing anything (including spaces).
.do end
.if '&machsys' = 'DOS' .do begin
array or a console end-of-file (Ctrl/Z followed by the line-entering
key) is encountered.
.do end
.if '&machsys' = 'VMS' .do begin
array or a terminal end-of-file (Ctrl/Z followed by the line-entering
key) is encountered.
.do end
.if '&machsys' = 'QNX' .do begin
array or a terminal end-of-file (CTRL/D)
is encountered.
.do end
.*
.section Display Variable Information
.*
.ix '? command'
.ix 'debugger commands' '?'
.mbox begin
? [<format>] [<item>][,<item>...]
.mbox end
.np
The "?" command may be used to display the contents of one or more
variables, array elements, character substrings, or arrays.
If
.mono <item>
is a variable, array element or character substring, the contents of
the storage location it occupies are displayed.
If
.mono <item>
is an array, each array element is displayed.
If
.mono <item>
is omitted, all names of variables and arrays in the program unit are
displayed followed by their contents.
In this case, the contents of arrays are not displayed; only dimension
information is provided.
.np
The
.mono <format>
specification is optional.
By default, variables are displayed using the rules for list-directed
output.
Under some circumstances it may be desirable to display the values of
variables using a different format.
Two alternate formats are allowed.
They are
.begpoint
.note (Z)
which displays the value(s) in hexadecimal format, or
.note (A)
which displays the value(s) in
.if '&machsys' = 'VM/SP CMS' .do begin
EBCDIC format, the character set of the IBM 370 computer.
.do end
.if '&machsys' = 'DOS' .do begin
ASCII format, the character set of the IBM Personal Computer.
.do end
.if '&machsys' = 'VMS' .do begin
ASCII format, the character set of the VAX computer.
.do end
.if '&machsys' = 'QNX' .do begin
ASCII format, the character set of the Unisys ICON computer.
.do end
.endnote
.pc
The parentheses must be specified.
Specifying "(Z)" or "(z)" is similar to using the "Z" format edit
descriptor in FORTRAN output statements.
Specifying "(A)" or "(a)" is similar to using the "A" format edit
descriptor in FORTRAN output statements.
.exam begin
DEBUG>?
A(4500)
I = 16
DEBUG>?(Z) B
00000010
.exam end
.np
The display of variable and array contents can be halted by
.if '&machsys' = 'VM/SP CMS' .do begin
pressing the line-entering key.
.do end
.if '&machsys' = 'QNX' .do begin
.ix 'Ctrl/Rubout'
entering a CTRL/RUBOUT sequence at the keyboard.
.do end
.if '&machsys' = 'DOS' .do begin
.ix 'Ctrl/Break'
entering a Ctrl/Break sequence at the keyboard.
.do end
.if '&machsys' = 'VMS' .do begin
.ix 'Ctrl/X'
entering a Ctrl/X sequence at the keyboard.
.do end
.*
.endlevel
.*
.section Debugging Example
.*
.np
.ix debugger 'example'
Let us debug the following "DEMO" program.
.millust begin
INTEGER I, J, SQR
DO I = 0, 2
J = SQR( I )
PRINT *, I, J
ENDDO
END
INTEGER FUNCTION SQR( N )
SQR = N * N
END
.if '&machsys' = 'VM/SP CMS' .do begin
&cmpcmd. demo (debug noext
.do end
.if '&machsys' = 'DOS' .do begin
C>&cmpcmd./debug/noext demo
.do end
.if '&machsys' = 'VMS' .do begin
$ &cmpcmd./debug/noext demo
.do end
.if '&machsys' = 'QNX' .do begin
% &cmpcmd. +debug -ext demo
.do end
.millust end
In the following debug session, we will use the "Trace" command.
After each statement is displayed, we press the "I" key so that we
trace execution into subprogram calls.
.code begin
Debugger entered at MAIN PROGRAM
2 DO I = 0, 2
DEBUG>t
Into["I" key] Over[space bar] Next["N" key] Exit["Enter" key]
2 DO I = 0, 2
3 J = SQR( I )
Debugger entered at SQR
7 INTEGER FUNCTION SQR( N )
8 SQR = N * N
9 END
Returned from SQR
4 PRINT *, I, J
0 0
5 ENDDO
3 J = SQR( I )
Debugger entered at SQR
7 INTEGER FUNCTION SQR( N )
8 SQR = N * N
9 END
Returned from SQR
4 PRINT *, I, J
1 1
5 ENDDO
3 J = SQR( I )
Debugger entered at SQR
7 INTEGER FUNCTION SQR( N )
8 SQR = N * N
9 END
Returned from SQR
4 PRINT *, I, J
2 4
5 ENDDO
6 END
Returned from MAIN PROGRAM
.code end
.np
In the above example, we simply traced the execution of all statements
in the program.
.np
.ix 'interrupting execution'
.ix debugger 'interrupting execution'
While the program is executing, it may be halted by
.if '&machsys' = 'VM/SP CMS' .do begin
pressing the line-entering key.
.do end
.if '&machsys' = 'DOS' .do begin
.ix 'Ctrl/Break'
entering a Ctrl/Break sequence at the keyboard.
.do end
.if '&machsys' = 'VMS' .do begin
.ix 'Ctrl/X'
entering a Ctrl/X sequence at the keyboard.
.do end
.if '&machsys' = 'QNX' .do begin
.ix 'Ctrl/Rubout'
entering a CTRL/RUBOUT sequence at the keyboard.
.do end
An error message will appear indicating that the program was
interrupted followed by the debugger prompt.
You will now be able to enter any debugger command.
.if '&machsys' = 'VM/SP CMS' .do begin
Alternatively, you may type a debugger command and then press the
line-entering key.
Again, an error message will appear indicating that the program was
interrupted.
The debugger will execute the command that was entered and then prompt
for another.
.do end
.np
If, during the course of execution, an error develops (e.g., an
undefined variable), the debugger will be entered.
The user may attempt to correct the error and resume execution.
If the error is a result of some limit being exceeded (e.g., time
limit exhausted, statement limit exhausted), the limit is reset and
execution may be resumed.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -