home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
- December 14, 1985
-
- TURBODBG.DOC
-
- OVERVIEW
-
- TURBODBG is a source code debugger for use in debugging Turbo
- Pascal (tm) Programs on the IBM-PC (tm). When used in
- conjunction with TURBO.COM, it allows you to:
-
- 1. View your source code while debugging.
- 2. Trace the operation of your program statement by
- statement.
- 3. Insert breakpoints in your program by procedure/function
- name or by statement number.
- 4. Examine (and change) global variables in your program,
- including strings, array variables, and records.
-
-
- SYSTEM REQUIREMENTS
-
- 1. Turbo Pascal IBM-PC Version 3.00B or 3.01A.
- 2. Approximately 64k or so more memory than would normally
- be required to run your program in the Turbo memory
- mode.
-
-
- OPERATION
-
- To use TURBODBG, include the file DBG??.COM (the ?? is a two
- digit revision number) on the disk (or in the directory) with
- TURBO.COM, TURBO.MSG, and your program file. At the DOS prompt,
- call for DBG??. After a brief sign on message, TURBODBG will
- load TURBO.COM and transfer control to it. (The message
- 'Incorrect TURBO.COM version!' indicates that TURBODBG and your
- version of TURBO.COM are incompatible.)
-
- At this point, all of the commands and features of Turbo Pascal
- should operate as they always have with the exception of the Run
- command. The only special requirement for programs to be
- debugged is that the {$U+} compiler directive not be used. When
- the Run command is executed, TURBODBG will regain control and the
- debugging screen will appear.
-
- The debugging screen is divided into two parts. The lower
- section is the command and data section. The '*' is a prompt for
- one of the commands described later. The top part of the screen
- displays the program source code text which at this point will be
- centered at the first executable statement of your program.
-
- Within the text part of the display, the current statement (the
- next one to be executed) will be highlighted. The left margin
-
-
- 1
-
-
-
-
-
-
-
-
-
-
-
- contains the statement number of the first statement occurring on
- that particular line. Statement numbers are consecutive numbers
- and are used to refer to individual statements in the commands
- described later. Since there may be more than one statement on a
- line, the statement number in the margin is that of the first
- statement on the line. The first character of each statement is
- highlighted. Note also that there may be no statements on a
- given line so those lines will have no numbers.
-
- Dividing the two portions of the debugging screen is a line which
- at this point will probably display 'Memory'. This indicates
- that the text file being observed is in memory. Later, when
- viewing a portion of the program source code which is in an
- 'include' file, the name of the 'include' file will appear here.
-
-
- SPECIAL KEYS FOR VIEWING TEXT
-
- The following keys may be used to change the text being
- displayed:
-
- Pg Up
- Pg Dn Move the display up or down one page.
-
- ^Pg Up
- ^Pg Dn Move to the start or end of the current file.
-
- Up arrow
- Down arrow Scroll up or down one line.
-
- F10 key Toggle between the debug screen and the screen
- of the program under test.
-
- In addition, the text being displayed may be changed using the
- View command described later.
-
-
- COMMAND EDITOR
-
- When entering commands, the following keys may used to edit the
- command: (They perform the same functions as they do in the
- Turbo Pascal editor.)
-
- ^A,^S,^D,^F,^G,^T,^H,LFARW,RTARW,^LFARW,^RTARW,
- Ins, Del, Backspace
-
- The Insert mode (default) is indicated by a slightly fatter
- cursor while the cursor is normal in the Overwrite mode.
-
- In addition, the F3 function key causes the last command entered
- (having more than three characters) to be redisplayed. This may
-
-
-
- 2
-
-
-
-
-
-
-
-
-
-
-
- be used to make minor changes to a previous command or to correct
- a syntax error.
-
- Note that commands are not acted upon until the Enter key is hit.
- (The cursor does not have to be at the line end to enter the
- command.)
-
-
- COMMAND PARAMETERS
-
- Commands consist of one or two letters (only one letter commands
- presently exist) which may be followed by one or more parameters.
- A non alphabetic character must follow the command to delimit it
- from a following parameter. The parameters which may be used
- are:
-
- <Symbol>
- A Pascal source code symbol representing a
- procedure/function name, variable, or constant as
- appropriate. The special symbol 'RTN' may be used to refer
- to the return point of a procedure/function.
-
- <Statement>
- A statement number as displayed in the left margin of the
- text display.
-
-
- COMMANDS
-
- G (Go)
-
- Format:
- G [<parameter> [<parameter..]]
-
- The Go command starts execution of the program under test.
- Execution will continue until a breakpoint is reached, the
- program terminates, or the <control Break> key is hit.
-
- One or more breakpoints may be entered with the Go command.
- These breakpoints are called temporary breakpoints as they are
- in effect only until the first stopping point is reached. Any
- temporary breakpoint would then have to reentered with the next
- Go command if desired.
-
- The program under test may be interrupted using the <control
- Break> key. Note that <control C> does not perform the same
- function but rather performs its normal Turbo Pascal function
- (as defined by the {$C } compiler directive.
-
-
-
-
-
-
- 3
-
-
-
-
-
-
-
-
-
-
-
- Examples:
-
- G Start execution with no temporary breakpoints. (There
- might be some permanent breakpoints, however.)
-
- G 345 PROC1 RTN
- Start execution with temporary breakpoints at statement
- 345, at the start of procedure PROC1, and at the return
- point of the current procedure/function. In addition,
- there might be other permanent breakpoints in effect.
-
- T (Trace)
-
- Format:
- T
-
- Execute the current statement. Only one statement is executed.
-
-
- N (Next)
-
- Format:
- N
-
- Execute the current statement in its entirety.
-
- The difference between the Trace and the Next command is that
- if the current statement is a procedure or function call, Next
- will completely execute the procedure/function whereas Trace
- will Trace through the procedure/function.
-
-
- P (Permanent breakpoint)
-
- Format:
- [-]P [<parameter>]
-
- The P command is used to specify permanent breakpoints. Unlike
- temporary breakpoints, permanent breakpoints remain in effect
- until removed (using a '-' preceding the P command).
-
- If no parameter is entered, the breakpoints in effect are
- listed.
-
- Examples:
-
- P List all permanent breakpoints.
- -P Delete all permanent breakpoints.
- P 345 Install a breakpoints at statement 345.
- -P PROC1 Remove a breakpoint at procedure PROC1.
-
-
-
-
- 4
-
-
-
-
-
-
-
-
-
-
-
- V (View text)
-
- Format:
- V [<parameter>]
-
- The View command may be used to change the text being observed
- in the text window. If no parameter is entered, the text will
- be centered around the current statement (the one to be
- executed next).
-
- Examples:
-
- V InitScreens View text at procedure InitScreens.
- V 545 View text around statement 545.
- V Rtn Find out where this procedure/function was
- called from.
-
-
- E (Examine/change variable or constant)
-
- Format:
- E <symbol>
-
- The Examine/change command allows the the value of global
- variables and constants to be displayed. In addition, for
- variables, a new value may be entered. Note that Turbo Pascal
- 'typed constants' are actually initialized variables and these
- may also be changed.
-
- After a variable value has been output in response to the
- Examine/change command, a new value may be entered followed by
- the Enter key. For byte and integer types, a hex value may be
- specified by preceding it with a '$'. Hitting the Enter key
- only retains the old variable value.
-
- 8 bit variables (byte, char, boolean) are displayed in decimal,
- hex, and character (if printable). In the case of boolean, 0
- is false, and 1 is true.
-
- Integer variables are displayed as both decimal and hex.
-
- Real variables are displayed in 'E' format and also decimal
- format if within a reasonable range.
-
- Pointer variables are displayed with the phrase 'Points to:'
- followed by an address and symbolic name if appropriate. If
- the pointer variable is followed by '^', the contents of the
- pointed to variable are displayed.
-
- String variables are displayed as a string within quotes. When
- specifying a change to a string variable, enclose the new
- string in quotes. A null string is specified by two quotes
-
-
- 5
-
-
-
-
-
-
-
-
-
-
-
- enclosing nothing. Individual characters of a string may be
- displayed and changed by treating the string as an array.
-
- Non numerical scaler variables are displayed numerically. For
- instance, a variable defined as
-
- Var Color :(red,green,blue,orange);
-
- would be be given a value of 2 if it contained blue. However,
- note that:
-
- E BLUE
-
- could be used to verify that blue was represented by 2.
-
- Sets cannot be examined.
-
- Examples:
-
- E RealArray[4,3]
- E InString
- E PersonRecord[12].ID.Lastname
- E PT^.Index1
- E START^.NEXT^.NEXT^.NEXT^.VALUE[10][3]
-
-
- Q (Quit)
-
- Format:
- Q
-
- The Quit command when entered in TURBODBG returns control to
- Turbo Pascal without running the program under test to
- completion.
-
-
- HINTS
-
- It is possible to insert breakpoints in the source code using
- INLINE($CC). These breakpoints cannot be removed by TURBODBG
- but may be useful for conditional breaks. For instance:
-
- IF I=49 THEN INLINE($CC);
-
- To get around the fact that local variables are not visible, the
- CONST's and VAR's may be moved temporarily to a global area.
- Turbo Pascal allows them to be moved just above the
- procedure/function definition. Of course this only works if the
- procedure/function is not used recursively and if there is no
- symbol name conflict.
-
-
-
-
- 6
-
-
-
-
-
-
-
-
-
-
-
- RESTRICTIONS, PROBLEMS, BUGS
-
- The following are current limits. These may be easily changed by
- changing a constant and recompiling.
-
- Permanent and temporary breakpoints are limited to 3 each.
- Maximum number of include files = 6.
- Maximum include file size = 32k.
- Maximum number of statements = 2000.
- Maximum allowable symbol table size = 5k.
- Maximum symbol length = 28.
-
- When changing a string using Examine/change, there currently is
- no protection against entering one that is too long. Use care.
-
- Only global procedure/functions, variables, and constants are
- known to TURBODBG currently. Procedure/function dummy variables
- and function values may be added in the future. It may not be
- practical to make local variables and procedure/function symbols
- accessible.
-
- Presently symbolic constants cannot be used as subscripts in the
- Examine/change command. For instance, if
-
- Var Opcode :ARRAY[MOV..CMP] OF BYTE;
-
- it is presently necessary to specify OPCODE[0] rather than
- OPCODE[MOV] when using the Examine/change command.
-
- The <control Break> program interrupt does not perform properly
- when the program under test is waiting for keyboard input.
-
- A simple screen switch is currently used. This limits debugging
- to text only programs.
-
- There is a problem when compiling to a disk COM file. Turbo
- often takes a short cut and transfers directly from memory to
- disk without recompiling. However, the memory file has been
- altered by TURBODBG and the resulting COM file is corrupted. It
- is best at this stage to compile to disk only without the
- debugger.
-
- At this stage, TURBODBG is experimental. Please report any
- problems, comments, suggestions, and especially if it doesn't
- work with your IBM-PC version 3.00B or 3.01A TURBO.COM to me at
- Compuserve ID 76327,53.
-
- Dave Baldwin
-
- IBM-PC is a trademark of International Business Machines
- Corporation.
- Turbo Pascal is a trademark of Borland International Inc.
-
-
- 7
-
-
-
-
-