How to break at function in PostMessage/PostThreadMessage while debugging my Release mode binary?
My application quits immediately on launching. This happens only on Release mode build. I have symbolized my release mode binary. I am suspecting that some secondary thread is posting WM_QUIT to our queue. I am trying to Break at Function PostThreadMessage with conditional Msg == 0x0012 ( WM_QUIT ). This wont hit. Just to ascertain, I used break at function in PostMessage and SendMessage. No Luck. Can someone please point out if i am missing something here? How do I enable Break at function in case of release mode binarie开发者_C百科s for WIN32 APIs?
Sincerely, Subramanian
This often happens with a missing break
in your switch/case leading to code falling through to the WM_QUIT handler. The first step I'd take to fix this is to add code to your WM_QUIT handler which outputs the uMsg. This will tell you whether WM_QUIT has really been sent or whether it's just code falling through.
It is possible to breakpoint in Release binaries but the source will not correspond in a nice way to the actual binary so stepping and other debugging features become much less useful.
In terms of setting your breakpoint, set it at {,,user32.dll}_SendMessageA@16
or {,,user32.dll}_SendMessageW@16
depending if you're using Unicode or not. However likely this will not be very useful to you.
To set breakpoint use DebugBreak
API, which would cause the program to crash. Now hit 'Debug' (as appropriate to your OS). It will take you to DebugBreak
location. It is also possible to debug a release build from withing IDE.
But there is some logical problem with your code than just breakpoint.
精彩评论