PRB: Debugger/CodeView Appear Not to Break on Correct Line

Last reviewed: July 22, 1997
Article ID: Q111501
4.00 4.01 4.10 | 1.00 1.50 1.51 1.52 4.00 4.01 4.10
MS-DOS         | WINDOWS
kbtool kbprb

The information in this article applies to:

  • The Visual Workbench Integrated Debugger included with:

        - Microsoft Visual C++ for Windows, versions 1.0, 1.5, 1.51, and 1.52
        - Microsoft CodeView for MS-DOS, versions 4.0, 4.01, and 4.1
        - Microsoft CodeView for Windows, versions 4.0, 4.01, and 4.1
    

SYMPTOMS

When setting a breakpoint (using the "Break When Expression Has Changed" option) where a variable in the expression is modified by the increment (++) or decrement (--) operator, CodeView and the Visual Workbench debugger may not appear to stop on the correct source line.

CAUSE

The debugger will stop after the assembly language instruction that first modifies the variable. In a situation where multiple assembly language instructions are necessary to implement the C language source line, the debugger will stop on that source line, because the line has not executed to completion.

MORE INFORMATION

This is the expected behavior for the 16-bit debuggers. Using Mixed Source/Assembly mode will reveal the fact that the C language statements x++ and x-- each require two assembly language statements. CodeView and the Visual Workbench debugger both step, and therefore break at the assembly language level and stop after the first assembly statement involved in the increment of the variable x.

NOTE: This does not occur with the 32-bit debugger.

The sample program below demonstrates the situation. When "Break When Expression Has Changed" is set on the variable x, the debugger will stop on the statement x++ instead of the following line. This is because the variable x is a long, and the C language statement x++ needs two assembly statements to be implemented.

To reproduce this problem using CodeView for Windows or the Visual Workbench debugger, this sample should be compiled and linked as a QuickWin application.

Sample Code

/* Compile options needed: /Od /Zi
** ** The CodeView command window command to set a ** breakpoint when the variable x has changed is: ** ** bp=x
*/

long x;

void main()
{
   x++;
}


Additional reference words: 1.00 1.50 4.00 4.10
KBCategory: kbtool kbprb
KBSubcategory: WBDebug CvwIss
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.