PRB: Unable to Set CodeView Breakpoint on Desired Line

Last reviewed: January 9, 1995
Article ID: Q60338
The information in this article applies to:
  • Microsoft CodeView for MS-DOS, versions 2.2, 3.0, 3.11, 3.14, 4.0, 4.01, 4.05, and 4.1
  • Microsoft CodeView for OS/2, versions 2.2, 3.0, 3.11, 3.12, and 3.5
  • Microsoft CodeView for Windows, versions 3.0, 3.05, 3.06, 3.07, 4.0, 4.01, and 4.1
  • Microsoft CodeView for Win32s, version 4.25

SYMPTOMS

In CodeView, an attempt to set a breakpoint on a specified line fails.

CAUSE

The compiler command line did not specify both the /Od and /Zi option switches. Some compiler optimizations concatenate code in the executable file unless the command line specifies /Od to disable all optimizations.

RESOLUTION

Recompile the code with the correct options specified.

MORE INFORMATION

The code example below demonstrates this problem. When the code is compiled with only the /Zi switch, you cannot set a breakpoint on the indicated line.

Sample Code

/*
 * Compile options needed: /Zi
 */

#include <stdio.h>

int func();

void main(void)
{
   int a, b, c;

   a = func();  // You cannot set a breakpoint on this line because
                // the default optimization concatenates it with the
                // following line to form the expression:
                //    b = (a = func()) + c
   b = a + c;
}

int func()
{
   return(10);
}


Additional reference words: 3.00 3.50 4.00 4.10
KBCategory: kbtool kbcode kbprb
KBSubcategory: CvwIss


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: January 9, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.