xref: /csrg-svn/usr.bin/pascal/pdx/pdx.1 (revision 62143)
1*62143Sbostic.\" Copyright (c) 1983, 1990, 1993
2*62143Sbostic.\"	The Regents of the University of California.  All rights reserved.
319734Smckusick.\"
450511Scael.\" %sccs.include.redist.roff%
519734Smckusick.\"
6*62143Sbostic.\"	@(#)pdx.1	8.1 (Berkeley) 06/06/93
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
4350511Scael.Bl -tag -width flag r
4450511Scael.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.
6350511Scael.El
6443083Scael.Pp
6519734SmckusickThe commands are:
6650511Scael.Pp
6750511Scael.Bl -tag -width flag -compact
6850511Scael.It Xo
6950511Scael.Ic run
7043083Scael.Op Ar args
7143083Scael.Op Ic \&< Ar filename
7243083Scael.Op Ic \&> Ar filename
7350511Scael.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
8450511Scael.It Xo
8550511Scael.Ic trace
8643083Scael.Op Ic in Ar procedure/function
8750511Scael.Op Ic if Ar condition
8850511Scael.Xc
8950511Scael.It Xo
9050511Scael.Ic trace
9143083Scael.Ar source-line-number
9243083Scael.Op Ic if Ar condition
9350511Scael.Xc
9450511Scael.It Xo
9550511Scael.Ic trace
9643083Scael.Ar procedure/function
9743083Scael.Op Ic in Ar procedure/function
9850511Scael.Op Ic if Ar condition
9950511Scael.Xc
10050511Scael.It Xo
10150511Scael.Ic trace
10250511Scael.Ar expression Ic at Ar source-line-number
10350511Scael.Op Ic if Ar condition
10450511Scael.Xc
10550511Scael.It Xo
10650511Scael.Ic trace
10743083Scael.Ar variable
10843083Scael.Op Ic in Ar procedure/function
10950511Scael.Op Ic if Ar condition
11050511Scael.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
15050511Scael.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
16450511Scael.It Ic stop if Ar condition
16550511Scael.It Xo
16650511Scael.Ic stop at Ar source-line-number
16750511Scael.Op Ic if Ar condition
16850511Scael.Xc
16950511Scael.It Xo
17050511Scael.Ic stop in Ar procedure/function
17150511Scael.Op Ic if Ar condition
17250511Scael.Xc
17350511Scael.It Xo
17450511Scael.Ic stop Ar variable
17550511Scael.Op Ic if Ar condition
17650511Scael.Xc
17719734SmckusickStop execution when the given line is reached, procedure or function
17819734Smckusickcalled, variable changed, or condition true.
17943083Scael.Pp
18050511Scael.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
18750511Scael.It Ic status Op Ic \&> Ar filename
18819734SmckusickPrint out
18943083Scaelthe currently active
19043083Scael.Ic trace
19143083Scaeland
19243083Scael.Ic stop
19343083Scaelcommands.
19443083Scael.Pp
19550511Scael.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
20350511Scael.It Ic step
20419734SmckusickExecute one source line.
20543083Scael.Pp
20650511Scael.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
21950511Scael.It Xo
22050511Scael.Ic print Ar expression
22150511Scael.Op Ic \&, Ar expression ...
22250511Scael.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
22950511Scael.It Ic whatis Ar identifier
23019734SmckusickPrint the declaration of the given identifier.
23143083Scael.Pp
23250511Scael.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
23650511Scael.It Ic assign Ar variable Ar expression
23719734SmckusickAssign the value of the expression to the variable.
23843083Scael.Pp
23950511Scael.It Ic call Ar procedure Ns (parameters)
24019734SmckusickExecute the object code associated with the named procedure or function.
24143083Scael.Pp
24250511Scael.It Ic help
24343083ScaelPrint out a synopsis of
24443083Scael.Nm pdx
24543083Scaelcommands.
24643083Scael.Pp
24750511Scael.It Ic gripe
24843083ScaelInvokes a mail program to send a message to the person in charge of
24943083Scael.Nm pdx  .
25043083Scael.Pp
25150511Scael.It Ic where
25219734SmckusickPrint out
25319734Smckusicka list of the active procedures and functions and the respective source
25419734Smckusickline where they are called.
25543083Scael.Pp
25650511Scael.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
26850511Scael.It Ic dump Op Ic \&> Ar filename
26919734SmckusickPrint the names and values of all active
27019734Smckusickdata.
27143083Scael.Pp
27250511Scael.It Xo
27350511Scael.Ic list
27450511Scael.Oo Ar source-line-number
27550511Scael.Op \&, Ar source-line-number Oc
27650511Scael.Xc
27750511Scael.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
29550511Scael.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
30050511Scael.It Ic edit Op Ar filename
30150511Scael.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
31450511Scael.Ev EDITOR
31550511Scaelto the name of the desired editor.
31643083Scael.Pp
31750511Scael.It Ic pi
31819734SmckusickRecompile the program and read in the new symbol table information.
31943083Scael.Pp
32050511Scael.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
32450511Scael.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
33250511Scael.It Ic quit
33343083ScaelExit
33443083Scael.Nm pdx  .
33550511Scael.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.
34250511Scael.Pp
34350511Scael.Bl -tag -width Fl -compact
34450511Scael.It Xo
34550511Scael.Ic tracei
34643083Scael.Op Ar address
34750511Scael.Op Ic if Ar cond
34850511Scael.Xc
34950511Scael.It Xo
35050511Scael.Ic tracei
35143083Scael.Op Ar variable
35243083Scael.Op Ic at Ar address
35350511Scael.Op Ic if Ar cond
35450511Scael.Xc
35550511Scael.It Xo
35650511Scael.Ic stopi
35743083Scael.Op Ar address
35850511Scael.Op Ic if Ar cond
35950511Scael.Xc
36050511Scael.It Xo
36150511Scael.Ic stopi
36243083Scael.Op Ic at
36343083Scael.Op Ar address
36450511Scael.Op Ic if Ar cond
36550511Scael.Xc
36643083ScaelTurn on tracing or set a stop using a
36743083Scael.Ic px
36843083Scaelmachine
36919734Smckusickinstruction addresses.
37043083Scael.Pp
37150511Scael.It Xo
37250511Scael.Ic xi Ar address
37350511Scael.Op Ic \&, Ar address
37450511Scael.Xc
37543083ScaelPrint the instructions starting at the first
37643083Scael.Ar address  .
37719734SmckusickInstructions up to
37843083Scaelthe second
37943083Scael.Ar address
38043083Scaelare printed.
38143083Scael.Pp
38250511Scael.It Xo
38350511Scael.Ic xd Ar address
38450511Scael.Op Ic \&, Ar address
38550511Scael.Xc
38619734SmckusickPrint in octal the specified data location(s).
38750511Scael.El
38843083Scael.Sh ENVIRONMENT
38950511Scael.Bl -tag -width Ar
39050511Scael.It Ev EDITOR
39143083ScaelThe
39243083Scael.Ic edit
39343083Scaelfunction uses the
39443083Scael.Ev EDITOR
39543083Scaelenvironment variable to see what editor to use.
39650511Scael.It Ev SHELL
39743083ScaelThe function
39843083Scael.Ic sh
39943083Scaelchecks the
40043083Scael.Ev SHELL
40143083Scaelvariable to see which shell to
40243083Scaelexecute.
40350511Scael.El
40443083Scael.Sh FILES
40550511Scael.Bl -tag -width .pdxinit -compact
40650511Scael.It Pa obj
40719734SmckusickPascal object file
40850511Scael.It Pa .pdxinit
40943083Scael.Nm Pdx
41043083Scaelinitialization file
41150511Scael.El
41243083Scael.Sh SEE ALSO
41343083Scael.Xr pi 1 ,
41443083Scael.Xr px 1
41550511Scael.Rs
41650511Scael.%T "An Introduction to Pdx"
41750511Scael.Re
41843083Scael.Sh HISTORY
41943083Scael.Nm Pdx
42050511Scaelappeared in
42150511Scael.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
46350511Scael.Xr csh 1 Ns \-like
46450511Scaelhistory capability would improve the situation.
465