Welcome to MSDN Blogs Sign in | Join | Help
Retail debugging technique -- #pragma optimize

Retail debugging is one of those things that is both painful and necessary. To avoid repeating myself, I will just point to my old blog entry on this subject -- http://blogs.msdn.com/greggm/archive/2004/12/15/315673.aspx.

I was doing some retail debugging today, and realized that I forgot to mention one good technique for solving retail only bugs – disable optimizations for the interesting code. Lots of bugs go away when everything is compiled /Od, but often you can disable optimizations in a function or two without destroying your repro.

#pragma warning(push)

#pragma warning(disable:4748) // Disable warning about /GS being disabled due to optimizations being disabled

#pragma optimize("", off)

HRESULT MyClass::MyFunction()

{

...

}

#pragma optimize("", on)

#pragma warning(pop)

 

Posted: Monday, January 23, 2006 2:12 PM by greggm

Comments

Gooey Bugs said:

Introduction This FAQ can be used to narrow down the problems associated with debugging any type of solution

# August 7, 2007 6:17 PM
New Comments to this post are disabled
Page view tracker