Process Failure at startup
-
I have a process that some how fail at Initialization it is a MFC C++ app so I inserted a __debugbreak at the first possible instance which would be CWinAPP constructer the code starts but never seems to reach that point (probably something to do with the build) When I run this app from task manager I see it start and then it disappears The Program when Initialized display a Main Window I originally started this program using CreateProcess I get a return code 1 inidicating sucesss but like I said it dies at initialization When I run this program using "Start Debugging" from the Visual Studio IDE it seems to performs properly I am thinking That I use CreatePrcess with the DEBUG_PROCESS flag to get a better handle on The problem I appreciate any help Thank you
-
I have a process that some how fail at Initialization it is a MFC C++ app so I inserted a __debugbreak at the first possible instance which would be CWinAPP constructer the code starts but never seems to reach that point (probably something to do with the build) When I run this app from task manager I see it start and then it disappears The Program when Initialized display a Main Window I originally started this program using CreateProcess I get a return code 1 inidicating sucesss but like I said it dies at initialization When I run this program using "Start Debugging" from the Visual Studio IDE it seems to performs properly I am thinking That I use CreatePrcess with the DEBUG_PROCESS flag to get a better handle on The problem I appreciate any help Thank you
Try to log the startup sequence by some log mechanism, like OuputDebugString() or File write. Is there any chance to have code which will run in Release mode? Any code which is written by compiler directive like #ifndef.
#ifndef _DEBUG
..
#endifThe following link may help you to find out this issue. http://forums.codeguru.com/showthread.php?269905-Visual-C-Debugging-Why-does-program-work-in-debug-mode-but-fail-in-release-mode In the debug build, if you have incorrect message handler signatures this doesnt cause any problems. But MFC does a couple of naughty type casts in the message map macros. So when you build the same code in release mode, you are guranteed to run into trouble.
-
Try to log the startup sequence by some log mechanism, like OuputDebugString() or File write. Is there any chance to have code which will run in Release mode? Any code which is written by compiler directive like #ifndef.
#ifndef _DEBUG
..
#endifThe following link may help you to find out this issue. http://forums.codeguru.com/showthread.php?269905-Visual-C-Debugging-Why-does-program-work-in-debug-mode-but-fail-in-release-mode In the debug build, if you have incorrect message handler signatures this doesnt cause any problems. But MFC does a couple of naughty type casts in the message map macros. So when you build the same code in release mode, you are guranteed to run into trouble.
-
Let me clarify I run the VC debugger from The release mode code along with the .pdb I am able to see what's going on
Yes it is possible to debug in release mode. Details are given in the following link. If an application works in a debug build, but fails in a release build, one of the compiler optimizations may be exposing a defect in the source code. To isolate the problem, disable selected optimizations for each source code file until you locate the file and the optimization that is causing the problem. (To expedite the process, you can divide the files into two groups, disable optimization on one group, and when you find a problem in a group, continue dividing until you isolate the problem file.) http://msdn.microsoft.com/en-us/library/fsk896zz.aspx
-
Yes it is possible to debug in release mode. Details are given in the following link. If an application works in a debug build, but fails in a release build, one of the compiler optimizations may be exposing a defect in the source code. To isolate the problem, disable selected optimizations for each source code file until you locate the file and the optimization that is causing the problem. (To expedite the process, you can divide the files into two groups, disable optimization on one group, and when you find a problem in a group, continue dividing until you isolate the problem file.) http://msdn.microsoft.com/en-us/library/fsk896zz.aspx