Returning Control to CodeView

ID Number: Q43648

2.x 3.00 3.10 3.11 3.14 3.50 | 2.x 3.00 3.10 3.11 3.12 3.50

MS-DOS | OS/2

Summary:

The following are two software methods of returning control to

CodeView during program execution:

1. Use the debug interrupt, interrupt 03, in your code. Interrupt 03

is called a microprocessor (or logical) interrupt. It is the

interrupt that CodeView uses to make breakpoints. Hard code

interrupt 03 into your code in selected places where you want to

return control to CodeView.

The following sample program demonstrates the technique. Note that

a macro could easily be constructed to insert breakpoints where

desired, and inline assembly could easily be used as well as the

int86() function:

#include <dos.h>

#include <stdio.h>

void main()

{

union REGS inregs;

int i = 1;

for( ;; )

{

printf( "Loop iteration: %d\n", i++ );

int86( 0x03, &inregs, &inregs );

}

}

2. Use CTRL+C and CTRL+BREAK to return control to CodeView. This is a

useful method for breaking out of a program that is currently

running or that has locked up. The position in the source code to

which you are returned depends on when you press ^C and what caused

the system to hang (for example, an infinite loop, a bad pointer,

and so on). Execution may be continued from this point in the usual

manner (F5, F8, F10, and so on).

Under OS/2 CTRL+BREAK does not return control to CodeView. CTRL+C

may be used to abort a normally executing program but you cannot

continue to debug from that point as you can in DOS.

There is no hardware interrupt that will return control to CodeView.

Additional reference words: 2.2 2.20 2.3 2.30 2.35 3.0 3.00 3.1 3.10

3.11 3.12 3.14 3.5 3.50 CONTROL-C CONTROL+C CONTROL+BREAK

CONTROL-BREAK ^C ^BREAK