Microsoft KB Archive/168080

= PRB: Debugger Displays Incorrect Information for Variable =

Article ID: 168080

Article Last Modified on 10/2/2003

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Standard Edition
 * Microsoft Visual C++ 6.0 Service Pack 5

-



This article was previously published under Q168080



SYMPTOMS
When you debug an optimized build of an application that includes debug information, the debugger may display incorrect symbol data.



RESOLUTION
You can work around this problem by displaying the desired variable in a dialog box or printing it out using cout or printf;



MORE INFORMATION
The debugger displays incorrect symbol data when debugging an application built with the following compiler options:
 * /Oy (Frame-Pointer Omission)
 * /Og (Global Optimizations)
 * /Zi or /Z7 (Debug Info)

Steps to Reproduce Behavior
 Create a console application that includes the code listed below. Set the active configuration to Release. In the project Settings dialog box, click the C/C++ tab and select Program Database in the Debug Info list box. In the Project Settings dialog box, click the Linker tab and select the "Generate debug info" check box. Set a breakpoint in Something.  Press the F5 key to build and debug the application. //Compiler options needed: /GX /Oy /Og /MLd #include <windows.h>  #include

void Something(DWORD dwFirst, DWORD dwSecond) {     // cout will display the correct information. std::cout << "dwFirst = " << dwFirst << ", dwSecond = " << dwSecond << std::endl; }

int main {     DWORD dwFirst = 123456; DWORD dwSecond = 234567;

Something(dwFirst, dwSecond); return 0 ; }                       </li></ol>

Keywords: kbbug kbide kbdebug kbprb KB168080

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.