4.11.5 Interrupting Your Application

There may be times when you want to interrupt your application immediately. You can force an immediate interruption of a CVW session by pressing CTRL+ALT+SYS RQ. You then have the opportunity to change debugging options; for example, you can add breakpoints and modify variables. To resume continuous execution, just press F5; to single-step, press F10.

You should take care when you interrupt the CVW session. For example, if you interrupt the session while Windows code or other system code is being executed, attempting to use the Step command or the Trace command could produce unpredictable results. When you interrupt the CVW session, it is usually safer to set breakpoints in your code and resume continuous execution than to use Step or Trace.

An infinite loop in your code presents a special problem. Again, because you should avoid using Step or Trace after interrupting your application, you should try to locate the loop by setting breakpoints in places you suspect are in the loop.

Whether or not you locate the infinite loop, you will have to terminate your application. The wka (Windows Kill Application) command terminates the task that is currently running. You should use the wka command only when your application is the one being executed.

If your application is currently executing a module that contains symbol information, the CVW Source window highlights the current instruction. However, if your application contains modules without symbolic information, it is more difficult to determine whether the assembly-language code displayed in the Source window belongs to your application or to another task.

In this case, use the wdg (Windows Display Global Heap) command, supplying the value in the CS register as the parameter. CVW displays a listing that indicates whether the code segment belongs to your application. If the code segment does belong to your application, you can use the wka command without affecting other tasks. The wka command does not perform all the cleanup tasks associated with the normal termination of a Windows application. For example, graphics device interface (GDI) objects created during the execution of the application but not destroyed before you terminated the application remain allocated in the systemwide global heap. This reduces the amount of memory available during your Windows session. Because of this, you should use the wka command to terminate the application only if you cannot terminate it normally.

The wka command simulates a fatal error in your application. Because of this, when you use the wka command, Windows displays an error message. After you close the message box, Windows may not release subsequent mouse input messages from the system queue until you press a key. If this happens, the cursor moves on the Windows screen, but Windows does not appear to respond to the mouse. After you press any key, Windows responds to all mouse events that occurred before you pressed the key.