BSD 4_3 release
[unix-history] / usr / man / man1 / pdx.1
CommitLineData
ed68ddb1
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
95f51977 5.\" @(#)pdx.1 6.1 (Berkeley) 4/29/85
ed68ddb1 6.\"
95f51977 7.TH PDX 1 "April 29, 1985"
ed68ddb1
KM
8.UC 5
9.SH NAME
10pdx \- pascal debugger
11.SH SYNOPSIS
12pdx [\fB\-r\fP] [\fIobjfile\fP]
13.SH DESCRIPTION
14\fIPdx\fP is a tool for source level debugging and execution of
15Pascal programs.
16The \fIobjfile\fP is an object file produced by the Pascal translator
17\fIpi\fP(1). If no \fIobjfile\fP is specified, \fIpdx\fP looks
18for a file named ``obj'' in the current directory.
19The object file contains a symbol table which includes the name of the
20all the source files translated by \fIpi\fP to create it.
21These files are available for perusal while using the debugger.
22.PP
23If the file ``.pdxinit'' exists in the current directory, then the
24debugger commands in it are executed.
25.PP
26The \fB\-r\fP option causes the \fIobjfile\fP to be executed immediately;
27if it terminates successfully \fIpdx\fP exits.
28Otherwise it reports the reason for termination
29and offers the user the option of entering the debugger
30or simply letting \fIpx\fP continue with a traceback.
31If \fB\-r\fP is not specified, \fIpdx\fP just prompts and waits for a command.
32.PP
33The commands are:
34.TP
35\fBrun\fP [\fIargs\fP] [\fB<\fP \fIfilename\fP] [\fB>\fP \fIfilename\fP]
36Start executing \fIobjfile\fP, passing \fIargs\fP as command line arguments;
37\fB<\fP or \fB>\fP can be used to redirect input or output in the usual manner.
38.TP
39\fBtrace\fP [\fBin\fP \fIprocedure/function\fP] [\fBif\fP \fIcondition\fP]
40.ns
41.TP
42\fBtrace\fP \fIsource-line-number\fP [\fBif\fP \fIcondition\fP]
43.ns
44.TP
45\fBtrace\fP \fIprocedure/function\fP [\fBin\fP \fIprocedure/function\fP] [\fBif\fP \fIcondition\fP]
46.ns
47.TP
48\fBtrace\fP \fIexpression\fP \fBat\fP \fIsource-line-number\fP [\fBif\fP \fIcondition\fP]
49.ns
50.TP
51\fBtrace\fP \fIvariable\fP [\fBin\fP \fIprocedure/function\fP] [\fBif\fP \fIcondition\fP]
52Have tracing information printed when the program is executed.
53A number is associated with the command that is used
54to turn the tracing off (see the \fBdelete\fP command).
55.sp 1
56The first argument describes what is to be traced.
57If it is a \fIsource-line-number\fP, then the line is printed
58immediately prior to being executed.
59Source line numbers in a file other than the current one
60must be preceded by the name of the file and a colon, e.g.
61``mumble.p:17''.
62.sp 1
63If the argument is a procedure or function name then
64every time it is called, information is printed telling
65what routine called it, from what source line it was called,
66and what parameters were passed to it.
67In addition, its return is noted, and if it's a function
68then the value it is returning is also printed.
69.sp 1
70If the argument is an \fIexpression\fP with an \fBat\fP clause
71then the value of the expression is printed whenever the
72identified source line is reached.
73.sp 1
74If the argument is a variable then the name and value of the variable
75is printed whenever it changes.
76Execution is substantially slower during this form of tracing.
77.sp 1
78If no argument is specified then all source lines are printed
79before they are executed.
80Execution is substantially slower during this form of tracing.
81.sp 1
82The clause ``\fBin\fP \fIprocedure/function\fP'' restricts tracing information
83to be printed only while executing inside the given procedure
84or function.
85.sp 1
86\fICondition\fP is a Pascal boolean expression and is
87evaluated prior to printing the tracing information;
88if it is false then the information is not printed.
89.sp 1
90There is no restriction on the amount of information
91that can be traced.
92.br
93.ne 10
94.IP "\fBstop\fP \fBif\fP \fIcondition\fP"
95.ns
96.IP "\fBstop\fP \fBat\fP \fIsource-line-number\fP [\fBif\fP \fIcondition\fP]"
97.ns
98.IP "\fBstop\fP \fBin\fP \fIprocedure/function\fP [\fBif\fP \fIcondition\fP]"
99.ns
100.IP "\fBstop\fP \fIvariable\fP [\fBif\fP \fIcondition\fP]"
101Stop execution when the given line is reached, procedure or function
102called, variable changed, or condition true.
103.IP "\fBdelete\fP \fIcommand-number\fP"
104The trace or stop corresponding to the given number is removed.
105The numbers associated with traces and stops are printed by
106the \fBstatus\fP command.
107.IP "\fBstatus\fP [\fB>\fP \fIfilename\fP]"
108Print out
109the currently active \fBtrace\fP and \fBstop\fP commands.
110.IP \fBcont\fP
111Continue execution from where it stopped.
112This can only be
113done when the program was stopped by an interrupt
114or through use of the \fBstop\fP command.
115.IP \fBstep\fP
116Execute one source line.
117.IP \fBnext\fP
118Execute up to the next source line.
119The difference between this and \fBstep\fP is that
120if the line contains a call to a procedure or function
121the \fBstep\fP command will stop at the beginning of that
122block, while the \fBnext\fP command will not.
123.IP "\fBprint\fP \fIexpression\fP [\fB,\fP \fIexpression\fP ...]"
124Print out the values of the Pascal expressions.
125Variables declared in an outer block but having
126the same identifier as one in the current block may be
127referenced as ``\fIblock-name\fP\ \fB.\fP\ \fIvariable\fP''.
128.IP "\fBwhatis\fP \fIidentifier\fP"
129Print the declaration of the given identifier.
130.IP "\fBwhich\fP \fIidentifier\fP"
131Print the full qualification of the given identifer, i.e.
132the outer blocks that the identifier is associated with.
133.IP "\fBassign\fP \fIvariable\fP \fIexpression\fP"
134Assign the value of the expression to the variable.
135.IP "\fBcall\fP \fIprocedure(parameters)\fP"
136Execute the object code associated with the named procedure or function.
137.IP \fBhelp\fP
138Print out a synopsis of \fIpdx\fP commands.
139.IP \fBgripe\fP
140Invokes a mail program to send a message to the person in charge of \fIpdx\fP.
141.IP \fBwhere\fP
142Print out
143a list of the active procedures and functions and the respective source
144line where they are called.
145.TP
146\fBsource\fP \fIfilename\fP
147Read \fIpdx\fP commands from the given \fIfilename\fP.
148Especially useful when the \fIfilename\fP has been created by redirecting
149a \fBstatus\fP command from an earlier debugging session.
150.IP "\fBdump\fP [\fB>\fP \fIfilename\fP]"
151Print the names and values of all active
152data.
153.IP "\fBlist\fP [\fIsource-line-number\fP [\fB,\fP \fIsource-line-number\fP]]"
154.ns
155.IP "\fBlist\fP \fIprocedure/function\fP"
156List the lines in the current source file from the first line number to
157the second inclusive.
158As in the editor
159``$'' can be used to refer to the last line.
160If no lines are specified, the entire file is listed.
161If the name of a procedure or function is given
162lines \fIn-k\fP to \fIn+k\fP are listed where \fIn\fP is the first statement
163in the procedure or function and \fIk\fP is small.
164.IP "\fBfile\fP [\fIfilename\fP]"
165Change the current source file name to \fIfilename\fP.
166If none is specified then the current source file name is printed.
167.IP "\fBedit\fP [\fIfilename\fP]"
168.ns
169.IP "\fBedit\fP \fIprocedure/function-name\fP"
170Invoke an editor on \fIfilename\fP or the current source file if none
171is specified.
172If a \fIprocedure\fP or \fIfunction\fP name is specified,
173the editor is invoked on the file that contains it.
174Which editor is invoked by default depends on the installation.
175The default can be overridden by setting the environment variable
176EDITOR to the name of the desired editor.
177.IP \fBpi\fP
178Recompile the program and read in the new symbol table information.
179.IP "\fBsh\fP \fIcommand-line\fP"
180Pass the command line to the shell for execution.
181The SHELL environment variable determines which shell is used.
182.IP "\fBalias\fP \fInew-command-name\fP \fIold-command-name\fP"
183This command makes \fIpdx\fP respond to \fInew-command-name\fP
184the way it used to respond to \fIold-command-name\fP.
185.IP "\fBquit\fP"
186Exit \fIpdx\fP.
187.sp 4
188.PP
189The following commands deal with the program at the \fIpx\fP instruction
190level rather than source level.
191They are not intended for general use.
192.TP
193\fBtracei\fP [\fIaddress\fP] [\fBif\fP \fIcond\fP]
194.ns
195.TP
196\fBtracei\fP [\fIvariable\fP] [\fBat\fP \fIaddress\fP] [\fBif\fP \fIcond\fP]
197.ns
198.TP
199\fBstopi\fP [\fIaddress\fP] [\fBif\fP \fIcond\fP]
200.ns
201.TP
202\fBstopi\fP [\fBat\fP] [\fIaddress\fP] [\fBif\fP \fIcond\fP]
203Turn on tracing or set a stop using a \fIpx\fP machine
204instruction addresses.
205.TP
206\fBxi\fP \fIaddress\fP [\fB,\fP \fIaddress\fP]
207Print the instructions starting at the first \fIaddress\fP.
208Instructions up to
209the second \fIaddress\fP are printed.
210.TP
211\fBxd\fP \fIaddress\fP [\fB,\fP \fIaddress\fP]
212Print in octal the specified data location(s).
213.SH FILES
214.nr In 25
215.in +\n(Inn
216.ta \n(Inn
217.br
218.nr wg 1v
219.ie \n(.h=\n(vk .nr wg -\n(vhu
220.el .nr vh 0
221.if \n(wg>0 \{\
222.sp \n(wgu
223.nr vh +\n(wgu \}
224.nr vk \n(.h
225.ti -\n(Inn
226\&obj \c
227Pascal object file
228.br
229.nr wg 0v
230.ie \n(.h=\n(vk .nr wg -\n(vhu
231.el .nr vh 0
232.if \n(wg>0 \{\
233.sp \n(wgu
234.nr vh +\n(wgu \}
235.nr vk \n(.h
236.ti -\n(Inn
237\&\&.pdxinit \c
238\fIPdx\fP initialization file
239.in -\n(Inn
240.br
241.nr wg 1v
242.ie \n(.h=\n(vk .nr wg -\n(vhu
243.el .nr vh 0
244.if \n(wg>0 \{\
245.sp \n(wgu
246.nr vh +\n(wgu \}
247.nr vk \n(.h
248.SH SEE ALSO
249pi(1), px(1)
250.br
251\fIAn Introduction to Pdx\fP
252.SH BUGS
253\fIPdx\fP does not understand sets,
254and provides no information about files.
255.sp 1
256The \fIwhatis\fP command doesn't quite work for variant records.
257.sp 1
258Bad things will happen if a procedure invoked with
259the \fBcall\fP command does a non-local goto.
260.sp 1
261The commands \fBstep\fP and \fBnext\fP should be able to take a \fIcount\fP
262that specifies how many lines to execute.
263.sp 1
264There should be commands \fBstepi\fP and \fBnexti\fP that correspond
265to \fBstep\fP and \fBnext\fP but work at the instruction level.
266.sp 1
267There should be a way to get an address associated with
268a line number, procedure or function, and variable.
269.sp 1
270Most of the command names are too long.
271.sp 1
272The alias facility is quite weak.
273.sp 1
274A \fIcsh\fP-like history capability would improve the situation.