home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
180.img
/
TURBOD.ZIP
/
HELPME!.DOC
< prev
next >
Wrap
Text File
|
1989-05-02
|
14KB
|
347 lines
TURBO DEBUGGER 1.5 COMMON QUESTIONS AND ANSWERS
-----------------------------------------------
1. How does TD handle screen output for graphics- and text-based
programs?
Turbo debugger has a number of strategies that it can use to
control how and when the screen gets refreshed. If you are
debugging a program that uses a graphics display mode or if
you want to use Borland pop-up utilities such as SideKick
and SideKick+ while inside Turbo Debugger, you should review
the following tips.
The default screen-updating mode is "Flip"; this means that
Turbo Debugger uses an alternate video display page on
adapters that support multiple display pages. This results
in fast screen-swapping between Turbo Debugger and your
program, but it also can interfere with the operation of
pop-up utilities and graphics programs.
Pop-up utilities may not appear on the screen, even though
they are active and processing your keystrokes. You must
select "Swap" mode for display-updating in order for pop-ups
to work properly. Use Turbo Debugger's -ds command-line
option to do this, or use the TDINST utility to permanently
set this mode. "Swap" mode makes screen updating slower, but
it makes sure that Turbo Debugger's screen does not
interfere with either your program's or any pop-up's
display.
You may also need to use "Swap" when you use the OS Shell
command or run an editor from within TD. Most programs
expect to run on video page 0, and do not check to see what
the current video page is. TD's OS Shell and any editors
that TD runs in "Flip" mode do not run from video page 0,
and the programs may appear to hang, even though you will be
able to type in keystrokes normally. If this happens, use
the -ds command-line option when you run TD or reinstall TD
to use "Swap" instead of "Flip."
If you are debugging a graphics mode application, you must
specify the -ds command-line option ("Swap" contents) and
you may want to use Turbo Debugger's -vg command-line
option (Graphics Save). This causes additional memory to be
set aside for saving the entire graphics image your
program produces. If you don't use this option, a "red
cloud" may appear on your program's screen. These options
can also be set permanently by using the TDINST program.
The Graphics Save option takes an additional 8K of memory
and slows screen-swapping.
If you are running a graphics program that changes the EGA
palette, make sure you use the -vp command line option to
save the palette.
2. Can Turbo Debugger execute other programs while you are
still using the debugger?
The OS Shell and Edit commands in the Module and File
windows can swap the program you are debugging to disk in
order to make room to run DOS or your editor. The default
amount of memory to swap is 128K. You can use TDINST to set a
different amount if that's not enough memory to run your
editor or other programs. Setting the swap size to 0K tells
Turbo Debugger to swap the entire user program to disk
before running the DOS command processor.
Only your program gets swapped to disk; Turbo Debugger
remains in memory.
3. How can I break out of a program even though interrupts are
disabled?
If you have an 80386-chip-based computer and are using
TD386, option -B allows break even when interrupts are
disabled. For example, this option enables a break from
CLI
JMP $
4. Why can't I hit Ctrl-Break to get out of a program
running on a remote machine?
The program running in the remote machine has taken control
of Interrupt 1B (Ctrl-Break). TDREMOTE does not take back
control of Interrupt 1B until you stop execution of the
running program on the debugger side by completing the
program or hitting Ctrl-F2 (Program Reset).
5. What are some of the syntactic and parsing differences
between Turbo Debugger's built-in assembler and the
standalone Turbo Assembler?
A discussion follows this short example program:
.model small
.data
abc struc
mem1 dd ?
mem2 db ?
mem3 db " "
abc ends
align 16
a abc <1,2,"xyz">
msg1 db "testing 1 2 3", 0
msg2 db "hello world", 0
nmptr dw msg1
fmptr dd msg1,msg2
nfmptr dw fmptr
xx dw seg a
.code
push cs
pop ds
mov bx,offset a
mov bx,nmptr
les si,fmptr
mov ah,4ch
int 21h
end
The assembler expression parser does not accept all legal
TASM instruction operands. This allows TD's assembler
expressions to be more general and allows multiple levels of
memory-referencing, more like that used in C and Pascal.
However, there are a few constructs that you may be used to
that you'll have to specify differently for the TD assembler
expression parser to accept them:
a. Size overrides should always appear inside the
brackets; PTR is optional after the size. Also, when
referring to a structure, you must use the name of the
struc, not the name of the variable:
OK: [byte ptr bx] [dword si] [abc bx]
BAD: byte ptr[bx] [struc abc bx] [a bx]
b. You must specify a structure name when accessing the
members of a structure via a register pointer:
OK: [abc ptr bx].mem1 [abc bx].mem3 + 1
BAD: [bx].mem1
c. You can't use multiple instances of [] unless they are
adjacent, and you can only follow an [] expression with
a dot and a structure member name or another []
expression:
OK: 4[bx][si] [abc bx].mem2
BAD: [bx]4[si] [bx]+4
d. If you use a register as part of a memory expression
and you don't specify a size, WORD is assumed:
[bx] is the same as [word bx]
e. You can use any register you want between [], not just
the combinations of BX, BP, SI, and DI allowed in
instruction operands:
OK: [ax+bx] [bx+sp]
f. You can use multiple levels of [] to follow chains of
pointers:
OK: [byte [[nfmptr]+4]]
g. Be careful using registers to access memory locations.
You may get unexpected results if your segment
registers are not set up properly. If you don't
explicitly specify a segment register, Turbo Debugger
uses the DS register to reference memory.
h. When you do specify a segment register, make sure you
follow the same rule for size overrides: put it
INSIDE the brackets:
OK: [byte es:di] [es:fmptr]
BAD: es:[byte di]
i. Use the OFFSET operator to get the address of a
variable or structure. Turbo Debugger automatically
supplies the [] around a variable name if you just type
the variable name alone:
a contents of structure a
[a] contents of structure a
offset a address of structure a
j. You can use the type overrides and the format control
count to examine any area of memory displayed as you
wish:
[byte es:bx],10 10 bytes pointed to by es:bx
[dword ds:si],4 4 dwords pointed to by ds:si
This is very useful when specifying watch expressions.
k. Sometimes you use a word memory location or register to
point to a paragraph in memory that contains a data
structure. Access the structure with expressions like
[abc [xx]:0].mem1
[abc es:0].mem3
6. Are there any syntactic or parsing differences between Turbo
Debugger's C expression evaluation and Turbo C's?
You can't pass constant-string arguments when evaluating
functions.
OK: myfunc(123) myfunc(string_variable)
BAD: myfunc("constant")
7. Are there any syntactic or parsing differences between Turbo
Debugger's Pascal expression evaluation and Turbo Pascal's?
a. Turbo Debugger does not support expressions for set
constructors:
OK: [4..7]
BAD: [myvar1..myvar2] [3+4..7+8]
b. You can't pass constant-string arguments when evaluating
functions or procedures.
OK: MyFunc(123) MyFunc(StringVariable)
BAD: MyFunc('Constant')
MyFunc(StringConstant), where StringConstant is
defined with a "const" declaration and is not a
typed constant.
c. You can't evaluate procedures or functions that have
structure VALUE parameters. You can evaluate procedures or
functions that have structure VARIABLE parameters, though.
8. What should I be aware of when I am debugging multilanguage
programs with Turbo Debugger?
Turbo Debugger's default source language is "Auto," which
means it chooses the expression language based on the current
source module. This can cause some confusion if your program
has source modules written in different languages (like C
and assembler). Since you are actually entering a language
expression any time Turbo Debugger prompts you for a value
or an address, this can cause some unexpected results:
a. Even if you are in a CPU window or a Dump window, you
must still enter addresses in the source language,
despite the fact that the window is displaying in hex.
For example, to display the contents of memory address
1234:5678, you must type one of the following
expressions, depending on your current source language:
C 0x1234:0x5678
Pascal $1234:$5678
Assembler 1234:5678
b. When your current language is assembler, you must be
careful when entering hex numbers, since they are
interpreted EXACTLY as they would be in an assembler
source file. This means that if you want to enter a
number that starts with one of the hex digits A - F, you
must first precede the letter with a 0 so Turbo Debugger
knows you are entering a number. Likewise, if your
number ends in B or D (indicating a binary or decimal
number), you must add an H to indicate that you really want
a hex number:
OK: 0aaaa 123dh 89abh
BAD: aaaa 123d 89ab
9. Why does the text "Cannot be changed" come up when I do an
assignment in the Data/Evaluate/Modify "New value" pane?
If you use the Data/Evaluate/Modify command (Ctrl-F4) to
change a variable by direct assignment, the "New value" pane
will say "Cannot be changed." This doesn't mean the
assignment didn't take effect. What it does mean is that the
assignment expression as a whole is not a memory-referencing
expression whose value you can change by moving to the
bottom pane. Here are some examples of direct assignment
expressions:
C x = 4
Pascal ratio := 1.234
Assembler wval = 4 shl 2
If you had typed just "x," "ratio," or "wval" into the top
pane, then you would be able to move to the bottom pane and
enter a new value. The direct assignment method using the
"=" or ":=" assignment operator is quicker and more
convenient if you don't care about examining the value of
the variable before modifying it.
10. Why does an inspector occasionally display question marks
when inspecting a Turbo C register variable?
If you inspect a register variable that is not in the
current scope, you'll see ???? for the value. A register
variable only displays a value if the register is in your
current scope (valid at the current location in your
program).
11. What is the most likely reason for Turbo Debugger to hang
when starting up on a PC-compatible computer?
If your computer is a Tandy 1000A, IBM PC Convertible, or
NEC MultiSpeed, or if TD hangs when loading on your system,
run TDINST and change the last item in the Options menu so
that NMI Intercept is set to "No." Some computers use the
NMI (Non-Maskable Interrupt) in ways that conflict with TD,
so you must disable TD's use of this interrupt in order to
run the program.
Also, if you are using a 80386-based machine and have the
SuperKey utility loaded, be careful not to press a key when
TD386 is loading, since SuperKey may capture the keystroke
and cause unexpected results.
12. What could happen when global breakpoints are set on local
variables?
When you set global breakpoints using local variables, make
sure the breakpoints are cleared before you exit the
procedure or function that the variables are defined in. The
best way to do this is to put a breakpoint on the last line
of the procedure or function. If you do not clear the
breakpoints, your program will break unexpectedly and may
even hang on some machines because the breakpoints are being
set in memory that is not currently being used by the
procedure or function.