Re: Deugging release build of MFC app

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Jay Daniel wrote:
Hey all,

I was hoping someone could shed some light on what's required to debug a release build of an MFC application in Visual Studio 2003. I'm creating a multithreaded app, and I find that things run as expected in debug mode, but fail in release mode.

I see that the default configuration for Release builds includes debug symbols, but when I step through the code, the values I see in the watch window don't jive with their "actual" values. For instance, if I have an integer member of my thread class, it appears in the watch window to be garbage. If, however, I format it as a string and pop up a messagebox (which is a no-no for a UI thread, I realize), then it displays the proper value that was assigned to it. Am I missing something very basic?

I'm running Windows XP SP2 on a P4 with hyperthreading if that makes any difference. Any help would be greatly appreciated.

Code optimizations in the release build can cause many strange effects in the debugger. You can try temporarily turning off optimizations in the release build for a more sane experience. But this may or may not hide the original problem :(


Another aid is to format strings and send them to OutputDebugString instead of to a message box. The strings appear in the debugger output window without stopping execution flow.

--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Re: Invalid attempt to read when no data is present
    ... Odd that you can debug with the code you posted. ... SqlDataReader that takes 2 strings as parameters. ... "Andy Sutorius" wrote in message ... > "Kevin Spencer" wrote in message ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Problems piping input into program
    ... get the strings as args list in mainfunction, ... your program doesn't do anything redirecting ... you should first write interactive program with stdin as input, ... debug it interactively, then test it with redirct from coonsole window. ...
    (microsoft.public.vc.ide_general)
  • Any more ideas? -- RE: How to debug binary-only modules and binaries
    ... Thanks for your reply, but I've tried strings, objdump, gdb and several ... --Guolin Cheng ... How to debug binary-only modules and binaries ...
    (Fedora)
  • Re: SSIS: How do I drag varibale to Watch Window?
    ... Ok So what are you trying to debug? ... the only thing you will debug is script in the Script task. ... I see the variables in Watch 1 window. ... How drag and drop the variable icon onto the watch window. ...
    (microsoft.public.sqlserver.dts)
  • Re: Deugging release build of MFC app
    ... > multithreaded app, and I find that things run as expected in debug mode, ... > window don't jive with their "actual" values. ... > integer member of my thread class, it appears in the watch window to be ...
    (microsoft.public.vc.mfc)