UMBC CMSC 211

UMBC | CSEE


CodeView

"The classic way to debug a program is to plant code at various places in the program that displays what you hope are critical values"

Needless to say, this can be a long drawn out affair, because you printed things at the wrong time, did not print something you needed, the problem is in a different area than you thought, etc! Thne you have to take out that code, undo it, if you will. Of course, that assumes that you don't make more bugs than you solve!

What is needed is a way to observe the program live, during execution, and change it dynamically. That is what an interactive debugger is! The user can cause:

DEBUG

The most basic debugger is Microsoft DEBUG

It gets better!

With a windowing environment, something better was needed. Microsoft has CodeView (CV) and Borland has TD. We will focus on CV.

To use CV, the program must be assembled with the debug information turned on so that you can use the symbolic names of your source code. It also allows you to work with the source code. To do this, assemble the code with one of the following:

masm /zi prog
link /co prog

or

ml /Zi prog
with ml, you must have an uppercase Z and a lower case i!

Now you can use CV with the following:

cv prog (This refers to the execute file.)

Opening Window

When CV starts, there is a program window with a menubar that has: CodeView opens with three windows titled: locals, source1, and command. There are three of the ten defined windows. One the is particular useful is the registers window, and should also be opened. There are ten defined windows:
  1. Help
  2. Locals
  3. Watch
  4. Source1
  5. Source2
  6. Memory1
  7. Memory2
  8. Register
  9. 8087
  10. Command

The source code should be in the source1 window. This code can be displayed in three formats. One is just the source code with line numbers. One is the "disassembled code" on one line. The third on has the source code followed by disassembled code. The disassembled code includes the machine language in hex format. The disassembled code shows the results of the macros after they are expanded, or the true code produced.

One window that should be opened manually everytime is the Register window. It will show the contents of each register and decode the flag register for you. This window provides you with essential information for the debug session.


UMBC | CSEE