pdx(1)

NAME
pdx - pascal debugger

SYNOPSIS
pdx [-r] [objfile]

DESCRIPTION
Pdx is a tool for source level debugging and execution of Pascal programs. The objfile is an object file produced by the Pascal translator pi(1). If no objfile is specified, pdx looks for a file named ``obj'' in the current directory. The object file contains a symbol table which includes the name of the all the source files translated by pi to create it. These files are available for perusal while using the debugger.

If the file ``.pdxinit'' exists in the current directory, then the debugger commands in it are executed.

The -r option causes the objfile to be executed immediately; if it terminates successfully pdx exits. Otherwise it reports the reason for termination and offers the user the option of entering the debugger or simply letting px continue with a traceback. If -r is not specified, pdx just prompts and waits for a command.

The commands are:

run [args] [< filename] [> filename]
    Start executing objfile, passing args as command line arguments; < or > can be used to redirect input or output in the usual manner.

trace [in procedure/function] [if condition]

trace source-line-number [if condition]

trace procedure/function [in procedure/function] [if condition]

trace expression at source-line-number [if condition]

trace variable [in procedure/function] [if condition]
    Have tracing information printed when the program is executed. A number is associated with the command that is used to turn the tracing off (see the delete command).

    The first argument describes what is to be traced. If it is a source-line-number, then the line is printed immediately prior to being executed. Source line numbers in a file other than the current one must be preceded by the name of the file and a colon, e.g. ``mumble.p:17''.

    If the argument is a procedure or function name then every time it is called, information is printed telling what routine called it, from what source line it was called, and what parameters were passed to it. In addition, its return is noted, and if it's a function then the value it is returning is also printed.

    If the argument is an expression with an at clause then the value of the expression is printed whenever the identified source line is reached.

    If the argument is a variable then the name and value of the variable is printed whenever it changes. Execution is substantially slower during this form of tracing.

    If no argument is specified then all source lines are printed before they are executed. Execution is substantially slower during this form of tracing.

    The clause ``in procedure/function'' restricts tracing information to be printed only while executing inside the given procedure or function.

    Condition is a Pascal boolean expression and is evaluated prior to printing the tracing information; if it is false then the information is not printed.

    There is no restriction on the amount of information that can be traced.

stop if condition

stop at source-line-number [if condition]

stop in procedure/function [if condition]

stop variable [if condition]
    Stop execution when the given line is reached, procedure or function called, variable changed, or condition true.

delete command-number
    The trace or stop corresponding to the given number is removed. The numbers associated with traces and stops are printed by the status command.

status [> filename]
    Print out the currently active trace and stop commands.

cont
    Continue execution from where it stopped. This can only be done when the program was stopped by an interrupt or through use of the stop command.

step
    Execute one source line.

next
    Execute up to the next source line. The difference between this and step is that if the line contains a call to a procedure or function the step command will stop at the beginning of that block, while the next command will not.

print expression [, expression ...]
    Print out the values of the Pascal expressions. Variables declared in an outer block but having the same identifier as one in the current block may be referenced as ``block-name . variable''.

whatis identifier
    Print the declaration of the given identifier.

which identifier
    Print the full qualification of the given identifer, i.e. the outer blocks that the identifier is associated with.

assign variable expression
    Assign the value of the expression to the variable.

call procedure(parameters)
    Execute the object code associated with the named procedure or function.

help
    Print out a synopsis of pdx commands.

gripe
    Invokes a mail program to send a message to the person in charge of pdx.

where
    Print out a list of the active procedures and functions and the respective source line where they are called.

source filename
    Read pdx commands from the given filename. Especially useful when the filename has been created by redirecting a status command from an earlier debugging session.

dump [> filename]
    Print the names and values of all active data.

list [source-line-number [, source-line-number]]

list procedure/function
    List the lines in the current source file from the first line number to the second inclusive. As in the editor ``$'' can be used to refer to the last line. If no lines are specified, the entire file is listed. If the name of a procedure or function is given lines n-k to n+k are listed where n is the first statement in the procedure or function and k is small.

file [filename]
    Change the current source file name to filename. If none is specified then the current source file name is printed.

edit [filename]

edit procedure/function-name
    Invoke an editor on filename or the current source file if none is specified. If a procedure or function name is specified, the editor is invoked on the file that contains it. Which editor is invoked by default depends on the installation. The default can be overridden by setting the environment variable EDITOR to the name of the desired editor.

pi  Recompile the program and read in the new symbol table information.

sh command-line
    Pass the command line to the shell for execution. The SHELL environment variable determines which shell is used.

alias new-command-name old-command-name
    This command makes pdx respond to new-command-name the way it used to respond to old-command-name.

quit
    Exit pdx.

The following commands deal with the program at the px instruction level rather than source level. They are not intended for general use.

tracei [address] [if cond]

tracei [variable] [at address] [if cond]

stopi [address] [if cond]

stopi [at] [address] [if cond]
    Turn on tracing or set a stop using a px machine instruction addresses.

xi address [, address]
    Print the instructions starting at the first address. Instructions up to the second address are printed.

xd address [, address]
    Print in octal the specified data location(s).

FILES
obj
Pascal object file
.pdxinit
Pdx initialization file

SEE ALSO
pi(1), px(1)
An Introduction to Pdx

BUGS
Pdx does not understand sets, and provides no information about files.

The whatis command doesn't quite work for variant records.

Bad things will happen if a procedure invoked with the call command does a non-local goto.

The commands step and next should be able to take a count that specifies how many lines to execute.

There should be commands stepi and nexti that correspond to step and next but work at the instruction level.

There should be a way to get an address associated with a line number, procedure or function, and variable.

Most of the command names are too long.

The alias facility is quite weak.

A csh-like history capability would improve the situation.