/*************************************************************************/
                             TURBO DEBUGGER
                   USING THE HARDWARE DEBUGGING FEATURES


CONFIGURING YOUR SYSTEM
=======================

Before you can set hardware breakpoints, you must install TDDEBUG.386.

Turbo Debugger uses the debug registers of 80386 (and higher) processors to
set hardware breakpoints. However, for Turbo Debugger to take advantage of
the special debug registers, TDDEBUG.386 must be properly installed.
(TDDEBUG.386 provides the same functionality as the Windows SDK file
WINDEBUG.386, with added support for the debug registers.)

INSTALL.EXE copies TDDEBUG.386 to your hard disk and alters your Windows
SYSTEM.INI file so that Windows loads TDDEBUG.386 instead of WINDEBUG.386.
If you are having problems setting hardware breakpoints, make sure that
TDDEBUG.386 is correctly installed:

 1)  The installation program copies TDDEBUG.386 from the installation disks
     to your your language BIN directory. If you move the file to another
     directory, substitute that directory in the following instructions.

 2)  With an editor, open the Windows SYSTEM.INI file, search for "[386enh]".
     Add the following line to that section:

        device = c:\lang_dir\bin\TDDEBUG.386

 3)  If there's a line in the [386enh] section that loads WINDEBUG.386, you
     must either comment that line out with a semicolon or delete it
     altogether. (You can't load both TDDEBUG.386 and WINDEBUG.386.)

For example, if you load WINDEBUG.386 from the C:\WINDOWS directory,
the commented-out line would read:

     ;device=c:\windows\windebug.386


SETTING HARDWARE BREAKPOINTS
============================

There are several ways to set a hardware-assisted breakpoint:

o Choose Breakpoints|Changed memory global.

    In the input box of the dialog box that opens, enter a memory 
    address followed by the number of bytes TDW is to watch to determine
    if your program has changed anything in that part of memory. If you
    enter a variable name or expression as the address, the count refers
    to how many objects of that size to watch.
    
    For example, if your program contains a word-sized variable x, 
    typing "x,2" causes two objects of size sizeof(x) (4 bytes total)
    to be watched.

    When you set a breakpoint using the Changed Memory Global command, Turbo
    Debugger automatically determines whether that breakpoint can make use of
    the available hardware. If it can, Turbo Debugger sets a hardware
    breakpoint for you and indicates that the breakpoint is set in hardware
    by putting an asterisk (*) after the global breakpoint number in the left
    pane of the Breakpoints window.

o Choose Breakpoints|Hardware Breakpoint.

    Use this command to set a general-purpose hardware breakpoint. This 
    command displays the Hardware Breakpoint Options dialog box (described
    later).

o Use the Breakpoint Options dialog box (see the paragraphs after the next
  one for an explanation of how to display this dialog box) to get to the 
  Hardware Breakpoint Options dialog box (described later).

    In the Breakpoint Options dialog box, check the Global checkbox, then
    press the Change button to display the Conditions and Actions dialog
    box. In this dialog box, select the Hardware radio button in the
    Condition group, then press the Hardware button at the bottom of the
    box to display the Hardware Breakpoint Options dialog box.

    You can get to the Breakpoint Options dialog box from two locations:
    the Breakpoints menu or the Breakpoints view window.

    - Choose Breakpoints|At (Alt-B A) to display the Breakpoint Options
      dialog box.

    - Choose View|Breakpoints to display the Breakpoints window. In the left
      pane, highlight the breakpoint you want to work with, then display the
      local menu (Alt-F10 or right-hand mouse click) and choose the Set
      Options or the Add command to display the Breakpoint Options dialog box.


USING THE HARDWARE BREAKPOINT OPTIONS DIALOG BOX
================================================

This section starts with a description of the hardware and software
limitations on the hardware conditions you can set with Turbo Debugger,
and then explains all the options you can set from the Hardware Breakpoints
dialog box.


Hardware conditions permitted with TDDEBUG.386
----------------------------------------------

When you're using TDDEBUG.386 with Turbo Debugger, you can set the following
types of hardware breakpoints from the Hardware Breakpoint dialog box:

o Instruction fetch

o Read from memory

o Read/write memory

Because you can't set any type of data matching when you use TDDEBUG.386,
you must always set the Data Match radio buttons to Match All. You can
also match only a single memory address or range of memory addresses.
A range can encompass from 1 to 16 bytes, depending on how many other
hardware breakpoints you have set and the address of the beginning of
the range.

The other options in the Hardware Breakpoint dialog are for other hardware
debuggers and device drivers that might support more matching modes.


The Hardware Breakpoint Options dialog box
------------------------------------------

This section describes the options on the Hardware Breakpoint Option
dialog box. Remember that your hardware isn't likely to support
all combinations of matching that you can specify from this menu. The
previous section describes the combinations that are allowed for the
TDDEBUG.386 device driver supplied with Turbo Debugger.

The Hardware Breakpoint Options dialog box lets you set the three matching
criteria that make up a hardware breakpoint:

o The bus cycle type to be matched

o The range of addresses to be matched

o The range of data values to be matched

For example, a hardware breakpoint might say "Watch for an I/O write
anywhere from address 3F8 to 3FF as long as the data value is equal to
1." This breakpoint will then be triggered any time a byte of 1 is
written to any of the I/O locations that control the COM1 serial port.

Usually, you set far simpler hardware breakpoints than this, such
as "Watch for I/O to address 200."

  Cycle Type radio buttons
  ------------------------

  With these radio buttons, you can make one of the following settings:

  Read Memory          Match memory reads
  Write Memory         Match memory writes
  Access Memory        Match memory read or write
  Input I/O            Match I/O input
  Output I/O           Match I/O Output
  Both I/O             Match I/O input or output
  Fetch Instruction    Match instruction fetch

  The Access Memory option is a combination of the Read Memory and Write
  Memory options--it matches either memory reads or writes. Likewise,
  the Both I/O option matches I/O reads or writes.

  Some hardware debuggers are capable of distinguishing between simple
  data reads from memory and instruction fetches. In this case, if you
  set a breakpoint to match on read memory, an instruction fetch from
  that location will not trigger the hardware breakpoint. Instruction
  cycles include all the bytes that the processor reads in order to
  determine the instruction operation to perform, including prefix
  bytes, operand addresses, and immediate values. The actual data read
  or written to memory referenced by an operand's address is not
  considered to be part of the instruction fetch. For example,

      MOV    AX,[1234]

  fetches 3 instruction bytes from memory and reads 2 data bytes. If you
  use instruction fetch matching, remember that the 80x86 processor
  family prefetches instructions to be executed, so you may get false
  matches, depending on whether your hardware debugger can sort out
  prefetched instructions from ones that are really executed.

  Address radio buttons
  ---------------------

  With these radio buttons, you can make one of the following settings:

  Above              Match above an address
  Below              Match below an address
  Range              Match within address range
  Not Range          Match outside address range
  Less or Equal      Match below or equal to address
  Greater or Equal   Match above or equal to address
  Equal              Match a single address
  Unequal            Match all but a single address
  Match All          Match any address


  Data Match radio buttons
  ------------------------

  The Data Match radio buttons let you make the following settings:
  
  Above              Match above a value
  Below              Match below a value
  Range              Match within value range
  Not Range          Match outside value range
  Less or Equal      Match below or equal to value
  Greater or Equal   Match above or equal to value
  Equal              Match a single value
  Unequal            Match all but a single value
  Match All          Match any value

  If you turn on a Data or Address option that involves any less-than or
  greater-than condition, a single address match range either starts at
  zero and extends to the value you specified, or starts at the value
  you specified and extends to the highest allowed value for addresses
  or data.

/***************************** END OF FILE *******************************/
