BUG: Break When Expression Has Changed Fails On Struct Members

Last reviewed: July 22, 1997
Article ID: Q117147
4.00 4.01 4.10 | 4.00 4.01 4.10
MS-DOS         | WINDOWS
kbtool kbbuglist

The information in this article applies to:

  • 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 using "Break when Expression has changed" breakpoints which include structure members in the expression, the breakpoints may fail and/or break many times in the exit and startup code following a program restart. In Codeview for Windows, a General Protection Fault may also occur, followed by a system hang.

RESOLUTION

To work around this problem, run the program to termination at the end of the first debugging session, clear the offending breakpoints, restart the program, and then reset the breakpoints. If you have Visual C++ and your program is a Windows-based application, you can use the Visual Workbench debugger instead. Note that for some MS-DOS programs you may also be able use the Visual Workbench debugger if the program can be rebuilt as a QuickWin application.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The sample program below can be used to demonstrate this problem. Build a debug version of the program, load it into Codeview, and enter these commands in the Codeview command window:

For an MS-DOS target                For a Windows target
---------------------------------   ---------------------------------
p2       // step into code          p2       // step into code
bp =A.s  // BP when A.s changes     bp =A.s  // BP when A.s changes
g        // break hit correctly     g        // break hit correctly
g        // break in exit code      g        // break in exit code
g        // program terminates      g        // hit 3 more times
l        // restart                 g        // program terminates
g        // break in startup code   l        // restart
g        // hit 19 times to finish  g        // breakpoint missed
bc*      // clear all breakpoints   bc*      // clear all breakpoints
l        // restart                 l        // restart
p2                                  p2
bp =A.s // break when A.s changes bp =A.s // break when A.s changes
g        // repeat of above         g        // repeat of above

Note that the problem is not as severe for static structures. (substitute bp = B.i in the steps above).

Sample Code

/* Compile options needed:  /Zi /Od
*/

#ifdef _WINDOWS
#include <windows.h>
#endif

void main( void )
{
    struct tagA {
        short s;
    } A;

    static struct tagB {
        int  i;
    } B;

    A.s = 1;
    B.i = 2;
}


Additional reference words:
KBCategory: kbtool kbbuglist
KBSubcategory: 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.