xref: /csrg-svn/usr.bin/pascal/pdx/pdx.1 (revision 50511)
143083Scael.\" Copyright (c) 1983, 1990 The Regents of the University of California.
243083Scael.\" All rights reserved.
319734Smckusick.\"
4*50511Scael.\" %sccs.include.redist.roff%
519734Smckusick.\"
6*50511Scael.\"	@(#)pdx.1	6.4 (Berkeley) 07/24/91
743083Scael.\"
843083Scael.Dd
943083Scael.Dt PDX 1
1043083Scael.Os BSD 4.2
1143083Scael.Sh NAME
1243083Scael.Nm pdx
1343083Scael.Nd pascal debugger
1443083Scael.Sh SYNOPSIS
1543083Scael.Nm pdx
1643083Scael.Op Fl r
1743083Scael.Op Ar objfile
1843083Scael.Sh DESCRIPTION
1943083Scael.Nm Pdx
2043083Scaelis a tool for source level debugging and execution of
2119734SmckusickPascal programs.
2243083ScaelThe
2343083Scael.Ar objfile
2443083Scaelis an object file produced by the Pascal translator
2543083Scael.Xr pi 1 .
2643083ScaelIf no
2743083Scael.Ar objfile
2843083Scaelis specified,
2943083Scael.Nm pdx
3043083Scaellooks
3119734Smckusickfor a file named ``obj'' in the current directory.
3219734SmckusickThe object file contains a symbol table which includes the name of the
3343083Scaelall the source files translated by
3443083Scael.Xr pi 1
3543083Scaelto create it.
3619734SmckusickThese files are available for perusal while using the debugger.
3743083Scael.Pp
3843083ScaelIf the file
3943083Scael.Dq Pa .pdxinit
4043083Scaelexists in the current directory, then the
4119734Smckusickdebugger commands in it are executed.
4243083Scael.Pp
43*50511Scael.Bl -tag -width flag r
44*50511Scael.It Fl r
4543083ScaelThe
4643083Scael.Fl r
4743083Scaeloption causes the
4843083Scael.Ar objfile
4943083Scaelto be executed immediately;
5043083Scaelif it terminates successfully
5143083Scael.Nm pdx
5243083Scaelexits.
5319734SmckusickOtherwise it reports the reason for termination
5419734Smckusickand offers the user the option of entering the debugger
5543083Scaelor simply letting
5643083Scael.Xr px
5743083Scaelcontinue with a traceback.
5843083ScaelIf
5943083Scael.Fl r
6043083Scaelis not specified,
6143083Scael.Nm pdx
6243083Scaeljust prompts and waits for a command.
63*50511Scael.El
6443083Scael.Pp
6519734SmckusickThe commands are:
66*50511Scael.Pp
67*50511Scael.Bl -tag -width flag -compact
68*50511Scael.It Xo
69*50511Scael.Ic run
7043083Scael.Op Ar args
7143083Scael.Op Ic \&< Ar filename
7243083Scael.Op Ic \&> Ar filename
73*50511Scael.Xc
7443083ScaelStart executing
7543083Scael.Ar objfile  ,
7643083Scaelpassing
7743083Scael.Ar args
7843083Scaelas command line arguments;
7943083Scael.Ic \&<
8043083Scaelor
8143083Scael.Ic \&>
8243083Scaelcan be used to redirect input or output in the usual manner.
8343083Scael.Pp
84*50511Scael.It Xo
85*50511Scael.Ic trace
8643083Scael.Op Ic in Ar procedure/function
87*50511Scael.Op Ic if Ar condition
88*50511Scael.Xc
89*50511Scael.It Xo
90*50511Scael.Ic trace
9143083Scael.Ar source-line-number
9243083Scael.Op Ic if Ar condition
93*50511Scael.Xc
94*50511Scael.It Xo
95*50511Scael.Ic trace
9643083Scael.Ar procedure/function
9743083Scael.Op Ic in Ar procedure/function
98*50511Scael.Op Ic if Ar condition
99*50511Scael.Xc
100*50511Scael.It Xo
101*50511Scael.Ic trace
102*50511Scael.Ar expression Ic at Ar source-line-number
103*50511Scael.Op Ic if Ar condition
104*50511Scael.Xc
105*50511Scael.It Xo
106*50511Scael.Ic trace
10743083Scael.Ar variable
10843083Scael.Op Ic in Ar procedure/function
109*50511Scael.Op Ic if Ar condition
110*50511Scael.Xc
11119734SmckusickHave tracing information printed when the program is executed.
11219734SmckusickA number is associated with the command that is used
11343083Scaelto turn the tracing off (see the
11443083Scael.Ic delete
11543083Scaelcommand).
11643083Scael.Pp
11719734SmckusickThe first argument describes what is to be traced.
11843083ScaelIf it is a
11943083Scael.Ar source-line-number  ,
12043083Scaelthen the line is printed
12119734Smckusickimmediately prior to being executed.
12219734SmckusickSource line numbers in a file other than the current one
12319734Smckusickmust be preceded by the name of the file and a colon, e.g.
12419734Smckusick``mumble.p:17''.
12543083Scael.Pp
12619734SmckusickIf the argument is a procedure or function name then
12719734Smckusickevery time it is called, information is printed telling
12819734Smckusickwhat routine called it, from what source line it was called,
12919734Smckusickand what parameters were passed to it.
13019734SmckusickIn addition, its return is noted, and if it's a function
13119734Smckusickthen the value it is returning is also printed.
13243083Scael.Pp
13343083ScaelIf the argument is an
13443083Scael.Ar expression
13543083Scaelwith an
13643083Scael.Ic at
13743083Scaelclause
13819734Smckusickthen the value of the expression is printed whenever the
13919734Smckusickidentified source line is reached.
14043083Scael.Pp
14119734SmckusickIf the argument is a variable then the name and value of the variable
14219734Smckusickis printed whenever it changes.
14319734SmckusickExecution is substantially slower during this form of tracing.
14443083Scael.Pp
14519734SmckusickIf no argument is specified then all source lines are printed
14619734Smckusickbefore they are executed.
14719734SmckusickExecution is substantially slower during this form of tracing.
14843083Scael.Pp
14943083ScaelThe clause
150*50511Scael.Dq Ic in Ar procedure/function
15143083Scaelrestricts tracing information
15219734Smckusickto be printed only while executing inside the given procedure
15319734Smckusickor function.
15443083Scael.Pp
15543083Scael.Ar Condition
15643083Scaelis a Pascal boolean expression and is
15719734Smckusickevaluated prior to printing the tracing information;
15819734Smckusickif it is false then the information is not printed.
15943083Scael.Pp
16019734SmckusickThere is no restriction on the amount of information
16119734Smckusickthat can be traced.
16243083Scael.Pp
16319734Smckusick.ne 10
164*50511Scael.It Ic stop if Ar condition
165*50511Scael.It Xo
166*50511Scael.Ic stop at Ar source-line-number
167*50511Scael.Op Ic if Ar condition
168*50511Scael.Xc
169*50511Scael.It Xo
170*50511Scael.Ic stop in Ar procedure/function
171*50511Scael.Op Ic if Ar condition
172*50511Scael.Xc
173*50511Scael.It Xo
174*50511Scael.Ic stop Ar variable
175*50511Scael.Op Ic if Ar condition
176*50511Scael.Xc
17719734SmckusickStop execution when the given line is reached, procedure or function
17819734Smckusickcalled, variable changed, or condition true.
17943083Scael.Pp
180*50511Scael.It Ic delete Ar command-number
18119734SmckusickThe trace or stop corresponding to the given number is removed.
18219734SmckusickThe numbers associated with traces and stops are printed by
18343083Scaelthe
18443083Scael.Ic status
18543083Scaelcommand.
18643083Scael.Pp
187*50511Scael.It Ic status Op Ic \&> Ar filename
18819734SmckusickPrint out
18943083Scaelthe currently active
19043083Scael.Ic trace
19143083Scaeland
19243083Scael.Ic stop
19343083Scaelcommands.
19443083Scael.Pp
195*50511Scael.It Ic cont
19619734SmckusickContinue execution from where it stopped.
19719734SmckusickThis can only be
19819734Smckusickdone when the program was stopped by an interrupt
19943083Scaelor through use of the
20043083Scael.Ic stop
20143083Scaelcommand.
20243083Scael.Pp
203*50511Scael.It Ic step
20419734SmckusickExecute one source line.
20543083Scael.Pp
206*50511Scael.It Ic next
20719734SmckusickExecute up to the next source line.
20843083ScaelThe difference between this and
20943083Scael.Ic step
21043083Scaelis that
21119734Smckusickif the line contains a call to a procedure or function
21243083Scaelthe
21343083Scael.Ic step
21443083Scaelcommand will stop at the beginning of that
21543083Scaelblock, while the
21643083Scael.Ic next
21743083Scaelcommand will not.
21843083Scael.Pp
219*50511Scael.It Xo
220*50511Scael.Ic print Ar expression
221*50511Scael.Op Ic \&, Ar expression ...
222*50511Scael.Xc
22319734SmckusickPrint out the values of the Pascal expressions.
22419734SmckusickVariables declared in an outer block but having
22519734Smckusickthe same identifier as one in the current block may be
22643083Scaelreferenced as
22743083Scael.Dq Ar block-name \&. variable
22843083Scael.Pp
229*50511Scael.It Ic whatis Ar identifier
23019734SmckusickPrint the declaration of the given identifier.
23143083Scael.Pp
232*50511Scael.It Ic which Ar identifier
23319734SmckusickPrint the full qualification of the given identifer, i.e.
23419734Smckusickthe outer blocks that the identifier is associated with.
23543083Scael.Pp
236*50511Scael.It Ic assign Ar variable Ar expression
23719734SmckusickAssign the value of the expression to the variable.
23843083Scael.Pp
239*50511Scael.It Ic call Ar procedure Ns (parameters)
24019734SmckusickExecute the object code associated with the named procedure or function.
24143083Scael.Pp
242*50511Scael.It Ic help
24343083ScaelPrint out a synopsis of
24443083Scael.Nm pdx
24543083Scaelcommands.
24643083Scael.Pp
247*50511Scael.It Ic gripe
24843083ScaelInvokes a mail program to send a message to the person in charge of
24943083Scael.Nm pdx  .
25043083Scael.Pp
251*50511Scael.It Ic where
25219734SmckusickPrint out
25319734Smckusicka list of the active procedures and functions and the respective source
25419734Smckusickline where they are called.
25543083Scael.Pp
256*50511Scael.It Ic source Ar filename
25743083ScaelRead
25843083Scael.Nm pdx
25943083Scaelcommands from the given
26043083Scael.Ar filename  .
26143083ScaelEspecially useful when the
26243083Scael.Ar filename
26343083Scaelhas been created by redirecting
26443083Scaela
26543083Scael.Ic status
26643083Scaelcommand from an earlier debugging session.
26743083Scael.Pp
268*50511Scael.It Ic dump Op Ic \&> Ar filename
26919734SmckusickPrint the names and values of all active
27019734Smckusickdata.
27143083Scael.Pp
272*50511Scael.It Xo
273*50511Scael.Ic list
274*50511Scael.Oo Ar source-line-number
275*50511Scael.Op \&, Ar source-line-number Oc
276*50511Scael.Xc
277*50511Scael.It Ic list Ar procedure/function
27819734SmckusickList the lines in the current source file from the first line number to
27919734Smckusickthe second inclusive.
28019734SmckusickAs in the editor
28119734Smckusick``$'' can be used to refer to the last line.
28219734SmckusickIf no lines are specified, the entire file is listed.
28319734SmckusickIf the name of a procedure or function is given
28443083Scaellines
28543083Scael.Ar n-k
28643083Scaelto
28743083Scael.Ar n+k
28843083Scaelare listed where
28943083Scael.Ar n
29043083Scaelis the first statement
29143083Scaelin the procedure or function and
29243083Scael.Ar k
29343083Scaelis small.
29443083Scael.Pp
295*50511Scael.It Ic file Op Ar filename
29643083ScaelChange the current source file name to
29743083Scael.Ar filename  .
29819734SmckusickIf none is specified then the current source file name is printed.
29943083Scael.Pp
300*50511Scael.It Ic edit Op Ar filename
301*50511Scael.It Ic edit Ar procedure Ns / Ns Ar function-name
30243083ScaelInvoke an editor on
30343083Scael.Ar filename
30443083Scaelor the current source file if none
30519734Smckusickis specified.
30643083ScaelIf a
30743083Scael.Ar procedure
30843083Scaelor
30943083Scael.Ar function
31043083Scaelname is specified,
31119734Smckusickthe editor is invoked on the file that contains it.
31219734SmckusickWhich editor is invoked by default depends on the installation.
31319734SmckusickThe default can be overridden by setting the environment variable
314*50511Scael.Ev EDITOR
315*50511Scaelto the name of the desired editor.
31643083Scael.Pp
317*50511Scael.It Ic pi
31819734SmckusickRecompile the program and read in the new symbol table information.
31943083Scael.Pp
320*50511Scael.It Ic sh Ar command-line
32119734SmckusickPass the command line to the shell for execution.
32219734SmckusickThe SHELL environment variable determines which shell is used.
32343083Scael.Pp
324*50511Scael.It Ic alias Ar new-command-name Ar old-command-name
32543083ScaelThis command makes
32643083Scael.Nm pdx
32743083Scaelrespond to
32843083Scael.Ar new-command-name
32943083Scaelthe way it used to respond to
33043083Scael.Ar old-command-name  .
33143083Scael.Pp
332*50511Scael.It Ic quit
33343083ScaelExit
33443083Scael.Nm pdx  .
335*50511Scael.El
33643083Scael.Pp
33743083ScaelThe following commands deal with the program at the
33843083Scael.Ar px
33943083Scaelinstruction
34019734Smckusicklevel rather than source level.
34119734SmckusickThey are not intended for general use.
342*50511Scael.Pp
343*50511Scael.Bl -tag -width Fl -compact
344*50511Scael.It Xo
345*50511Scael.Ic tracei
34643083Scael.Op Ar address
347*50511Scael.Op Ic if Ar cond
348*50511Scael.Xc
349*50511Scael.It Xo
350*50511Scael.Ic tracei
35143083Scael.Op Ar variable
35243083Scael.Op Ic at Ar address
353*50511Scael.Op Ic if Ar cond
354*50511Scael.Xc
355*50511Scael.It Xo
356*50511Scael.Ic stopi
35743083Scael.Op Ar address
358*50511Scael.Op Ic if Ar cond
359*50511Scael.Xc
360*50511Scael.It Xo
361*50511Scael.Ic stopi
36243083Scael.Op Ic at
36343083Scael.Op Ar address
364*50511Scael.Op Ic if Ar cond
365*50511Scael.Xc
36643083ScaelTurn on tracing or set a stop using a
36743083Scael.Ic px
36843083Scaelmachine
36919734Smckusickinstruction addresses.
37043083Scael.Pp
371*50511Scael.It Xo
372*50511Scael.Ic xi Ar address
373*50511Scael.Op Ic \&, Ar address
374*50511Scael.Xc
37543083ScaelPrint the instructions starting at the first
37643083Scael.Ar address  .
37719734SmckusickInstructions up to
37843083Scaelthe second
37943083Scael.Ar address
38043083Scaelare printed.
38143083Scael.Pp
382*50511Scael.It Xo
383*50511Scael.Ic xd Ar address
384*50511Scael.Op Ic \&, Ar address
385*50511Scael.Xc
38619734SmckusickPrint in octal the specified data location(s).
387*50511Scael.El
38843083Scael.Sh ENVIRONMENT
389*50511Scael.Bl -tag -width Ar
390*50511Scael.It Ev EDITOR
39143083ScaelThe
39243083Scael.Ic edit
39343083Scaelfunction uses the
39443083Scael.Ev EDITOR
39543083Scaelenvironment variable to see what editor to use.
396*50511Scael.It Ev SHELL
39743083ScaelThe function
39843083Scael.Ic sh
39943083Scaelchecks the
40043083Scael.Ev SHELL
40143083Scaelvariable to see which shell to
40243083Scaelexecute.
403*50511Scael.El
40443083Scael.Sh FILES
405*50511Scael.Bl -tag -width .pdxinit -compact
406*50511Scael.It Pa obj
40719734SmckusickPascal object file
408*50511Scael.It Pa .pdxinit
40943083Scael.Nm Pdx
41043083Scaelinitialization file
411*50511Scael.El
41243083Scael.Sh SEE ALSO
41343083Scael.Xr pi 1 ,
41443083Scael.Xr px 1
415*50511Scael.Rs
416*50511Scael.%T "An Introduction to Pdx"
417*50511Scael.Re
41843083Scael.Sh HISTORY
41943083Scael.Nm Pdx
420*50511Scaelappeared in
421*50511Scael.Bx 4.2 .
42243083Scael.Sh BUGS
42343083Scael.Nm Pdx
42443083Scaeldoes not understand sets,
42519734Smckusickand provides no information about files.
42643083Scael.Pp
42743083ScaelThe
42843083Scael.Ic whatis
42943083Scaelcommand doesn't quite work for variant records.
43043083Scael.Pp
43119734SmckusickBad things will happen if a procedure invoked with
43243083Scaelthe
43343083Scael.Ic call
43443083Scaelcommand does a non-local goto.
43543083Scael.Pp
43643083ScaelThe commands
43743083Scael.Ic step
43843083Scaeland
43943083Scael.Ic next
44043083Scaelshould be able to take a
44143083Scael.Ar count
44219734Smckusickthat specifies how many lines to execute.
44343083Scael.Pp
44443083ScaelThere should be commands
44543083Scael.Ic stepi
44643083Scaeland
44743083Scael.Ic nexti
44843083Scaelthat correspond
44943083Scaelto
45043083Scael.Ic step
45143083Scaeland
45243083Scael.Ic next
45343083Scaelbut work at the instruction level.
45443083Scael.Pp
45519734SmckusickThere should be a way to get an address associated with
45619734Smckusicka line number, procedure or function, and variable.
45743083Scael.Pp
45819734SmckusickMost of the command names are too long.
45943083Scael.Pp
46019734SmckusickThe alias facility is quite weak.
46143083Scael.Pp
46243083ScaelA
463*50511Scael.Xr csh 1 Ns \-like
464*50511Scaelhistory capability would improve the situation.
465