PDX(1) UNIX Reference Manual PDX(1) NNAAMMEE ppddxx - pascal debugger SSYYNNOOPPSSIISS ppddxx [--rr] [_o_b_j_f_i_l_e] DDEESSCCRRIIPPTTIIOONN PPddxx is a tool for source level debugging and execution of Pascal pro- grams. The _o_b_j_f_i_l_e is an object file produced by the Pascal translator pi(1). If no _o_b_j_f_i_l_e is specified, ppddxx looks for a file named ``obj'' in the current directory. The object file contains a symbol table which in- cludes the name of the all the source files translated by pi(1) to create it. These files are available for perusal while using the debugger. If the file ``._p_d_x_i_n_i_t'' exists in the current directory, then the de- bugger commands in it are executed. --rr The --rr option causes the _o_b_j_f_i_l_e to be executed immediately; if it terminates successfully ppddxx exits. Otherwise it reports the reason for termination and offers the user the option of enter- ing the debugger or simply letting px continue with a trace- back. If --rr is not specified, ppddxx just prompts and waits for a command. The commands are: rruunn [_a_r_g_s] [<< _f_i_l_e_n_a_m_e] [>> _f_i_l_e_n_a_m_e] Start executing _o_b_j_f_i_l_e, passing _a_r_g_s as command line argu- ments; << or >> can be used to redirect input or output in the usual manner. ttrraaccee [iinn _p_r_o_c_e_d_u_r_e/_f_u_n_c_t_i_o_n] [iiff _c_o_n_d_i_t_i_o_n] ttrraaccee _s_o_u_r_c_e-_l_i_n_e-_n_u_m_b_e_r[iiff _c_o_n_d_i_t_i_o_n] ttrraaccee _p_r_o_c_e_d_u_r_e/_f_u_n_c_t_i_o_n [iinn _p_r_o_c_e_d_u_r_e/_f_u_n_c_t_i_o_n] [iiff _c_o_n_d_i_t_i_o_n] ttrraaccee _e_x_p_r_e_s_s_i_o_n aatt _s_o_u_r_c_e-_l_i_n_e-_n_u_m_b_e_r [iiff _c_o_n_d_i_t_i_o_n] ttrraaccee _v_a_r_i_a_b_l_e [iinn _p_r_o_c_e_d_u_r_e/_f_u_n_c_t_i_o_n] [iiff _c_o_n_d_i_t_i_o_n] 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 ddeelleettee command). The first argument describes what is to be traced. If it is a _s_o_u_r_c_e-_l_i_n_e-_n_u_m_b_e_r, 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 param- eters 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 _e_x_p_r_e_s_s_i_o_n with an aatt 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 substan- tially 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 ``iinn'' _p_r_o_c_e_d_u_r_e/_f_u_n_c_t_i_o_n restricts tracing information to be printed only while executing inside the given procedure or function. _C_o_n_d_i_t_i_o_n 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. ssttoopp iiff _c_o_n_d_i_t_i_o_n ssttoopp aatt _s_o_u_r_c_e-_l_i_n_e-_n_u_m_b_e_r [iiff _c_o_n_d_i_t_i_o_n] ssttoopp iinn _p_r_o_c_e_d_u_r_e /_f_u_n_c_t_i_o_n [iiff _c_o_n_d_i_t_i_o_n] ssttoopp _v_a_r_i_a_b_l_e [iiff _c_o_n_d_i_t_i_o_n] Stop execution when the given line is reached, procedure or function called, variable changed, or condition true. ddeelleettee _c_o_m_m_a_n_d-_n_u_m_b_e_r The trace or stop corresponding to the given number is removed. The numbers associated with traces and stops are printed by the ssttaattuuss command. ssttaattuuss [>> _f_i_l_e_n_a_m_e] Print out the currently active ttrraaccee and ssttoopp commands. ccoonntt Continue execution from where it stopped. This can only be done when the program was stopped by an interrupt or through use of the ssttoopp command. sstteepp Execute one source line. nneexxtt Execute up to the next source line. The difference between this and sstteepp is that if the line contains a call to a pro- cedure or function the sstteepp command will stop at the beginning of that block, while the nneexxtt command will not. pprriinntt _e_x_p_r_e_s_s_i_o_n [,, _e_x_p_r_e_s_s_i_o_n ...] 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 ``_b_l_o_c_k-_n_a_m_e . _v_a_r_i_a_b_l_e'' wwhhaattiiss _i_d_e_n_t_i_f_i_e_r Print the declaration of the given identifier. wwhhiicchh _i_d_e_n_t_i_f_i_e_r Print the full qualification of the given identifer, i.e. the outer blocks that the identifier is associated with. aassssiiggnn _v_a_r_i_a_b_l_e _e_x_p_r_e_s_s_i_o_n Assign the value of the expression to the variable. ccaallll _p_r_o_c_e_d_u_r_e (_p_a_r_a_m_e_t_e_r_s) Execute the object code associated with the named procedure or function. hheellpp Print out a synopsis of ppddxx commands. ggrriippee Invokes a mail program to send a message to the person in charge of ppddxx. wwhheerree Print out a list of the active procedures and functions and the respective source line where they are called. ssoouurrccee _f_i_l_e_n_a_m_e Read ppddxx commands from the given _f_i_l_e_n_a_m_e. Especially useful when the _f_i_l_e_n_a_m_e has been created by redirecting a ssttaattuuss com- mand from an earlier debugging session. dduummpp [>> _f_i_l_e_n_a_m_e] Print the names and values of all active data. lliisstt [_s_o_u_r_c_e-_l_i_n_e-_n_u_m_b_e_r [ _s_o_u_r_c_e-_l_i_n_e-_n_u_m_b_e_r]] lliisstt _p_r_o_c_e_d_u_r_e/_f_u_n_c_t_i_o_n 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. ffiillee [_f_i_l_e_n_a_m_e] Change the current source file name to _f_i_l_e_n_a_m_e. If none is specified then the current source file name is printed. eeddiitt [_f_i_l_e_n_a_m_e] eeddiitt _p_r_o_c_e_d_u_r_e/_f_u_n_c_t_i_o_n-_n_a_m_e Invoke an editor on _f_i_l_e_n_a_m_e or the current source file if none is specified. If a _p_r_o_c_e_d_u_r_e or _f_u_n_c_t_i_o_n name is specified, the editor is invoked on the file that contains it. Which edi- tor is invoked by default depends on the installation. The de- fault can be overridden by setting the environment variable ED- ITOR to the name of the desired editor. ppii Recompile the program and read in the new symbol table informa- tion. sshh _c_o_m_m_a_n_d-_l_i_n_e Pass the command line to the shell for execution. The SHELL environment variable determines which shell is used. aalliiaass _n_e_w-_c_o_m_m_a_n_d-_n_a_m_e _o_l_d-_c_o_m_m_a_n_d-_n_a_m_e This command makes ppddxx respond to _n_e_w-_c_o_m_m_a_n_d-_n_a_m_e the way it used to respond to _o_l_d-_c_o_m_m_a_n_d-_n_a_m_e. qquuiitt Exit ppddxx. The following commands deal with the program at the _p_x instruction level rather than source level. They are not intended for general use. ttrraacceeii [_a_d_d_r_e_s_s] [iiff _c_o_n_d] ttrraacceeii [_v_a_r_i_a_b_l_e] [aatt _a_d_d_r_e_s_s] [iiff _c_o_n_d] ssttooppii [_a_d_d_r_e_s_s] [iiff _c_o_n_d] ssttooppii [aatt] [_a_d_d_r_e_s_s] [iiff _c_o_n_d] Turn on tracing or set a stop using a ppxx machine instruction addresses. xxii _a_d_d_r_e_s_s [,, _a_d_d_r_e_s_s] Print the instructions starting at the first _a_d_d_r_e_s_s. Instruc- tions up to the second _a_d_d_r_e_s_s are printed. xxdd _a_d_d_r_e_s_s [,, _a_d_d_r_e_s_s] Print in octal the specified data location(s). EENNVVIIRROONNMMEENNTT EDITOR The eeddiitt function uses the EDITOR environment variable to see what editor to use. SHELL The function sshh checks the SHELL variable to see which shell to execute. FFIILLEESS _o_b_j Pascal object file ._p_d_x_i_n_i_t PPddxx initialization file SSEEEE AALLSSOO pi(1), px(1) _A_r _A_n _I_n_t_r_o_d_u_c_t_i_o_n _t_o _P_d_x HHIISSTTOORRYY PPddxx appeared in 4.2 BSD. BBUUGGSS PPddxx does not understand sets, and provides no information about files. The wwhhaattiiss command doesn't quite work for variant records. Bad things will happen if a procedure invoked with the ccaallll command does a non-local goto. The commands sstteepp and nneexxtt should be able to take a _c_o_u_n_t that specifies how many lines to execute. There should be commands sstteeppii and nneexxttii that correspond to sstteepp and nneexxtt 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(1) - like history capability would improve the situation.