?? intro.nroff
字號:
The value of a variable whenever it changes; and theline at which it changes..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti -3n-\h'2n'\cThe execution of all source lines..in -\n(Inn.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.hIt should be noted that the last two kinds of informationare expensive to obtain and will cause your program to runmuch more slowly than normal.They should be used sparingly..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nThese forms of tracing can be combined and there is nolimit to the number of things you can trace at any given time..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nTo trace the execution of a particular source line,type.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBtrace\fP \fIline-number\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiThe next time the \fBrun\fP command is given\fIpdx\fP will execute the program, printing the specified lineeach time it is about to be executed..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nTo trace every call to a procedure,type.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBtrace\fP \fIprocedure-name\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiFor each call to the named procedure during execution,\fIpdx\fP will print the name of the procedure, the procedureand line it was called from, and what parameters (if any) it was called with..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nTo see the value of an expression at a particular line,type.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBtrace\fP \fIexpression\fP \fBat\fP \fIsource-line-number\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiTo see whenever the value of a variable is changed,we type.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBtrace\fP \fIvariable\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fi.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nFinally, to have each source line printedas it's about to be executed, we simply say.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5\fBtrace\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiAfter issuing a trace command, \fIpdx\fPdisplays all currently active traces.Each command is identified with a number in parentheses.To turn off a trace,give the command.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBdelete\fP \fIcommand-number\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiTracing information will be printed every time the program is run untilit is explicitly turned off by giving the \fBdelete\fP command..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nTo display the information that you are currently tracing, say.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBstatus\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fi.br.nr wg 2v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 6\fBStopping and Continuing\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti +5nSometimes, when debugging, we want to stop our program,look at some data, and then continue execution.The \fBstop\fP command allows the suspension of execution.To continue execution from where it was suspended,the \fBcont\fP command is used.There are four ways to describe when execution should be stopped:.in +5n.if n .nr In 5.if t .nr In 8.in +\n(Inn.ta \n(Inn.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti -\n(Inn\&\fBstop\fP \fBif\fP \fIcondition\fP.br\cExecution is stopped if the specified condition becomes true.The condition can be any Pascal boolean expression..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti -\n(Inn\&\fBstop\fP \fBat\fP \fIsource-line-number\fP.br\cExecution is stopped when the \fIline\fP is about to executed..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti -\n(Inn\&\fBstop\fP \fBin\fP \fIprocedure\fP.br\cExecution is stopped when the \fIprocedure\fP is called..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti -\n(Inn\&\fBstop\fP \fIvariable\fP.br\cExecution is stopped when the \fIvariable\fP is about to be changed..in -\n(Inn.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -5nExecution is also stopped by an interrupt, i.e.by typing the RUB or DEL key..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nExecution can be momentarily continued by the commands \fBnext\fPand \fBstep\fP.The \fBnext\fP command stops after one source line has been executed.The \fBstep\fP command stops at the next source line to be executed.These are only different when the current source linecontains a call to a procedure or function.\fBStep\fP will stop at the beginning of the subprogram, \fBnext\fP will not.As in tracing, stops are set until explicitly unsetwith the \fBdelete\fP command..br.nr wg 2v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 6\fBSource Program Manipulation\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti +5n\fIPdx\fP allows you to view your program during debugging.For example, to print lines 10 to 20 from ``prog.p'', you would type.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBlist\fP 10,20.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiIf you actually wish to change your program, or look at itin a more sophisticated manner, the command.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBedit\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiwill invoke the editor on your program.You can also say.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBedit\fP \fIprocedure\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiand \fIpdx\fP will invoke the editor on your programand position the current line on the first line ofthe \fIprocedure\fP..br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 3.ti +5nIf you change your program and wish to start debugging thenew version, you should give the command.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBpi\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fiThis command runs \fIpi\fP on your program, and automaticallyreads in the new information that \fIpdx\fP needs from the new \fIobj\fP file..br.nr wg 2v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 6\fBCommand Aliasing\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti +5nThe \fBalias\fP command is used to create a new name for a command.This is especially useful for saving typing by definingabbreviations as aliases.For example, if you gave the command.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in +8n.nf.ne 5> \fBalias\fP r run.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.in -8n.fithen you could use ``r'' to run your program..br.nr wg 2v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 6\fBWhere to go from here\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti +5nIf you feel comfortable what we've discussed here,you're ready to read the \fIpdx\fP manual page.It contains a complete, but brief, description of thecommands discussed here along with some other commands that youmight find useful..br.nr wg 2v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ne 6\fBReferences\fP.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti +5n.ti -5n.if n .nr In 5.if t .nr In 8.in +\n(Inn.ta \n(Inn.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h.ti -\n(Inn\&[Joy, Graham and Haley 80].br\cJoy, W., Graham, S., and Haley, C.,``Berkeley Pascal User's Manual'',version 2.0, EECS Dept., Univ. of Calif. at Berkeley, October 1980..in -\n(Inn.br.nr wg 1v.ie \n(.h=\n(vk .nr wg -\n(vhu.el .nr vh 0.if \n(wg>0 \{\.sp \n(wgu.nr vh +\n(wgu \}.nr vk \n(.h
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -