Appendix: Predefined Symbols

The Watcom Debugger defines a number of symbols that have special meanings. This appendix describes the the following:

Registers

Each of the registers is designated by a special name.

eax32-bit EAX register (32-bit mode only)
ax16-bit AX register
al8-bit AL register
ah8-bit AH register
ebx32-bit EBX register (32-bit mode only)
bx16-bit BX register
bl8-bit BL register
bh8-bit BH register
ecx32-bit ECX register (32-bit mode only)
cx16-bit CX register
cl8-bit CL register
ch8-bit CH register
edx32-bit EDX register (32-bit mode only)
dx16-bit DX register
dl8-bit DL register
dh8-bit DH register
eipInstruction pointer register (32-bit mode only)
ipInstruction pointer register
esiSource index register (32-bit mode only)
siSource index register
ediDestination index register (32-bit mode only)
diDestination index register
espStack pointer register (32-bit mode only)
spStack pointer register
ebpBase pointer register (32-bit mode only)
bpBase pointer register
csCode segment register
dsData segment register
esExtra segment register
fsSegment register (32-bit mode only)
gsSegment register (32-bit mode only)
ssStack segment register
flFlags register
eflFlags register (32-bit mode only)

You can identify the bits in the Flags and Extended Flags registers, as shown in the following table:

FlagsEFlagsDescription
fl.oefl.ooverflow flag
fl.defl.ddirection flag
fl.iefl.iinterrupt flag
fl.sefl.ssign flag
fl.zefl.zzero flag
fl.aefl.aauxiliary carry flag
fl.pefl.pparity flag
fl.cefl.ccarry flag

Math coprocessor symbols

The following symbols access the registers, control word, and status word of the math coprocessor:

st0 - st7
Numeric Data Processor registers (math coprocessor registers)
cw
8087 control word (math coprocessor control word)

You can identify the bits of the control word, as follows:

cw.ic
infinity control
  • 0 = projective
  • 1 = affine
cw.rc
rounding control (2 bits)
  • 00 = round to nearest or even
  • 01 = round down (towards negative infinity)
  • 10 = round up (towards positive infinity)
  • 11 = chop (truncate toward zero)
cw.pc
precision control (2 bits)
  • 00 = 24 bits
  • 01 = reserved
  • 10 = 53 bits
  • 11 = 64 bits
cw.iem
interrupt enable mask (8087 only)
  • 0 = interrupts enabled
  • 1 = interrupts disabled (masked)
cw.pm
precision (inexact result) mask
cw.um
underflow mask
cw.om
overflow mask
cw.zm
zero-divide mask
cw.dm
denormalized operand mask
cw.im
invalid operand mask
sw
8087 status word (math coprocessor status word)

You can identify the individual bits of the status word, as follows:

sw.b
busy
sw.c3
condition code bit 3
sw.st
stack stop pointer (3 bits)

    000 = register 0 is stack top
    001 = register 1 is stack top
    010 = register 2 is stack top
        .
        .
        .
    111 = register 7 is stack top
            
sw.c2
condition code bit 2
sw.c1
condition code bit 1
sw.c0
condition code bit 0
sw.es
error summary (287, 387 only)
sw.sf
stack fault (387 only)
sw.pe
precision (inexact result) exception
sw.ue
underflow exception
sw.oe
overflow exception
sw.ze
zero-divide exception
sw.de
denormalized operand exception
sw.ie
invalid operation exception

Using register symbols

The debugger permits you to manipulate register contents using any of the operators described in the Expression Handling chapter. By default, these predefined names are accessed just like any other variables that you or the application have defined.

Should the situation ever arise where the application defines a variable whose name conflicts with that of one of these debugger variables, the module specifier _dbg may be used to refer to the symbol defined by the debugger rather than the one defined by the application.

For example, if the application defines a variable called cs, then you must use _dbg@cs to refer to the Code Segment register.

The flags register, the 8087 control word, and the 8087 status word can be accessed as a whole or by its component status bits. For example:

    /fl.c=0
    /cw.um=0
    ?sw.oe

In the above example, the ``carry'' flag is cleared, the 8087 underflow mask of the control word is cleared, and the 8087 overflow exception bit of the status word is printed.

The low-order bit of the expression's result is used to set or clear the specified flag. For example:

    fl.c=0x03a6

In the above example, the ``carry'' flag is cleared since the low-order bit of the result is 0.

Other symbols

The debugger also defines some other special names:

dbg$32
the mode in which the processor is running:
0
16-bit mode
1
32-bit mode
dbg$bp
the register pair SS:BP (16-bit mode) or SS:EBP (32-bit mode).

For example:

    ? dbg$bp
      
dbg$code
the current code location under examination. The dot address ``.'' is either set to dbg$code or dbg$data, depending on whether you were last looking at code or data.
dbg$cpu
the type of CPU that's in your PC:
0
Intel 8088, 8086 or compatible processor
1
Intel 80188, 80186 or compatible processor
2
Intel 80286 or compatible processor
3
Intel 80386 or compatible processor
4
Intel 80486 or compatible processor
5
Intel Pentium processor
dbg$ctid
the identification number of the current execution thread. Under QNX, the current thread ID is always 1. The current execution thread can be selected using the Threads window or the Thread command.
dbg$data
the current data location under examination. The dot address ``.'' is either set to dbg$code or dbg$data, depending on whether you were last looking at code or data.
dbg$etid
the identification number of the thread that was executing when the debugger was entered. Under QNX, the executing thread ID is always 1.
dbg$fpu
the type of numeric data processor (math coprocessor) installed in your PC:
-1
80x87 emulator
0
No coprocessor
1
Intel 8087
2
Intel 80287
3
Intel 80387
4
Intel 80486 processor, supporting coprocessor instructions
5
Intel Pentium processor, supporting coprocessor instructions
dbg$ip
This debugger symbol represents the instruction pointer register pair CS:IP (16-bit mode) or CS:EIP (32-bit mode). For example:
    ? dbg$ip
      
dbg$monitor
the type of monitor adapter you have:
0
IBM Monochrome Adapter
1
IBM Color Graphics Adapter (CGA)
2
IBM Enhanced Graphics Adapter (EGA)
3
IBM Video Graphics Array (VGA)
dbg$os
This debugger symbol represents the operating system currently running the application:
1
DOS
2
OS/2
3
DOS Extender from Phar Lap Software, Inc.
5
NetWare 386 from Novell, Inc.
6
QNX from QNX Software Systems Ltd.
7
DOS/4GW from Tenberry Software, Inc. (included in the Watcom C/C++(32) and Watcom FORTRAN 77/32 packages)
8
Windows 3.x from Microsoft Corporation
10
Windows NT or Windows 95 from Microsoft Corporation
11
AutoCAD from Autodesk, Inc.
dbg$pid
the process ID for the program being debugged.
dbg$radix
the current default numeric radix.
dbg$remote
1 if the REMotefiles option was specified; 0 otherwise.
dbg$sp
This debugger symbol represents the register pair SS:SP (16-bit mode) or SS:ESP (32-bit mode). For example:
    ? dbg$sp
      
dbg$loaded
1 if a program is loaded; 0 otherwise.
dbg$nil
the null pointer value.
dbg$src
1 if you're currently debugging in an area that contains debugging information.