• Aucun résultat trouvé

INTERACTIVE DEBUGGER COMMANDS

Dans le document Pascal in MTS (Page 34-39)

PASCAL/JB INTERACTIVE DEBUGGING SYSTEM

INTERACTIVE DEBUGGER COMMANDS

This section describes the various interactive debugger commands. If an error is detected in an interactive debugger command, an appropriate error message is written and the user is prompted for the next debug command. These errors have no effect on the underlying execution of the Pascal/JB program. All interactive debug messages and interactive debug statements use a “+” prefix character.

34 Pascal/JB: Pascal/JB Interactive Debugging System

This aids in identifying when input is being requested by the interactive debugger and when input is being requested by the actual program execution.

Attention interrupts may be used to abort the operation of any interactive debugger command except the GO command. Control returns to the debugger, and the user is prompted for the next debugger command when this occurs. If the attention interrupt occurs during processing of the STEP command, control is passed to the interactive debugger prior to the execution of the NEXT statement encountered. Thus, the current statement is allowed to completely execute before the STEP command is aborted.

The following commands are accepted by the Pascal/JB interactive debugger. The underlined portions represent the minimum acceptable abbreviations.

BREAK <statement specification> ...

The BREAK debug command sets one or more breakpoints in the Pascal/JB program. If the execution of the underlying program proceeds to a statement for which a breakpoint has been set, the execution is suspended prior to the execution of that statement, and control is returned to the interactive debugger, the location of the breakpoint encountered is printed, and the user is prompted for a debug command. The STEP or GO debug statements can be used to resume execution. The CLEAR debug command, described below, resets breakpoints. The format of the <statement specification> is as described earlier in this section. There is no limit to the number of breakpoints that can be active at any time.

Examples:

BREAK Main/Summ_numbers/4

BREAK /Summ_numbers/end Util/Search_Tree/7

CLEAR [<statement specification> ...]

The CLEAR debug statement resets some or all of the active breakpoints set by a previous BREAK command. If no <statement specification> is given on the CLEAR command, all currently active breakpoints are removed. If one or more <statement specification> is given, only the breakpoints associated with those statements are reset. The format of a <statement specification> is as discussed earlier.

Examples:

CLEAR

CLEAR Main/Summ_Numbers/4 Util/Search_Tree/7

DISPLAY <variable> ...

The DISPLAY debug command displays the current value of one or more variables. The variable may be subscripted, dereferenced, or field qualified. Thus, it is possible to display the contents of a field in a dynamic record or an individual element in an array. Array indices must be constants that are compatible with the declared index type. The variable(s) being displayed must be accessible from the current scope (as defined by the normal Pascal rules governing the scope of an identifier). The QUALIFY debug command may be used to change the current scope to that of another stack frame.

Pascal/JB: Pascal/JB Interactive Debugging System 35

Examples:

DISPLAY I SCHED[TUES,15] Head_Ptr@.Next_Ptr@.Student_Name DISPLAY Current_Total

DUMP [<stack-frame specification> [<number>] ]

The DUMP debug command dumps all of the variables associated with a given stack frame.

The format of the dump is identical to the format of the post-mortem dump that Pascal/JB produces when an execution error is encountered. If no stack frame is specified, all currently active stack frames are dumped. The optional number specifies the number of stack frames to dump, starting with the specified stack frame and working back in the chain of routine calls.

Examples:

DUMP {the current stack frame is dumped}

DUMP ALL {all active stack frames are dumped}

DUMP * 3 {the active and previous two stack frames are dumped}

DUMP My_Routine {all variables in the procedure My_Routine are dumped}

EXPLAIN <debug command>

The EXPLAIN debug command gives a brief explanation of the specified <debug command>.

Example:

EXPLAIN DUMP GO

The GO debug command resumes execution of the underlying Pascal/JB program. Control will not return to the interactive debugger unless a breakpoint or an error is encountered during the resumed execution of the program. No parameters are accepted by the GO command. See also the description of the STEP command in this section. RUN is a synonym for GO.

HEXDISPLAY <variable> [<length>] ...

The HEXDISPLAY debug command displays the hexadecimal value of one or more identifiers.

The HEXDISPLAY command is similar to the DISPLAY command except that the DISPLAY command prints the values of the identifiers in a form that is consistent with the declared type of the identifier. Therefore, the DISPLAY command is usually preferred and the HEXDISPLAY command is generally useful only when using Pascal/JB in conjunction with routines written in other languages, for example 370/Assembler. The optional <length> is a positive number that is the length in bytes to be displayed. If <length> is omitted, the declared length of the variable is used.

Examples:

HEXDISPLAY I Head_Ptr@.NAME HEXDISPLAY Head_Ptr@NAME 50 HEXDISPLAY Parts[13,10]

36 Pascal/JB: Pascal/JB Interactive Debugging System

MTS

The MTS debug command returns control to the system. Other system commands (such as

$EDIT) may then be issued. Control may be returned to the interactive debugger using the

$RESTART command provided it has not been unloaded explicitly by the $UNLOAD command or implicitly by issuing a $RUN or $LOAD command. The MTS command does not accept any parameters. See also the “$” command description in this section.

QUALIFY <stack-frame specification>

The QUALIFY debug command resets the current scope to some other stack frame. The behaviour of the DISPLAY, DUMP, and HEXDISPLAY debug commands are all affected by changes in the current scope. The format of the <stack-frame specification> is as described earler in this section.

Examples:

QUALIFY Mysubr QUALIFY *-4

RUN

The RUN debug command is a synonym for the GO debug command.

STEP [number]

The STEP debug command resumes execution of the underlying Pascal/JB program one statement at a time. The optional number parameter specifies the number of statements to be executed, which defaults to 1. The STEP command can be quite useful when trying to determine the flow of control of a Pascal/JB program. If a statement contains a procedure or function call, the STEP command will halt with the execution of the first statement in that procedure or function. Upon completion of the STEP command, control is returned to the debugger, a message indicating the next statement to be executed is printed, and the user is prompted for another debug command.

Examples:

STEP STEP 4

STOP

The STOP debug command terminates execution of both the debugger and the underlying Pascal/JB program and returns control to MTS. The STOP command does not accept any parameters.

TRACEBACK

The TRACEBACK command gives a traceback of all currently active procedures and functions.

The traceback starts with the current location, that is, the location of the breakpoint or error that caused the debugger to be invoked, followed by the location from which that routine was called, followed by the location from which the calling routine was called, and so on.

Pascal/JB: Pascal/JB Interactive Debugging System 37

Example:

TRACEBACK

$<mts-command>

This command executes an MTS command. Control is returned to the interactive debugger upon completion of the command, unless the command unloads the program explicitly, e.g.,

$UNLOAD, or implicitly, e.g., $RUN or $LOAD.

38 Pascal/JB: Pascal/JB Interactive Debugging System

Dans le document Pascal in MTS (Page 34-39)