Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Process Failure at startup

Process Failure at startup

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studiohelpcsharpdebugging
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • F ForNow

      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

      S Offline
      S Offline
      Santhosh G_
      wrote on last edited by
      #2

      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
      ..
      #endif

      The 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.

      F 1 Reply Last reply
      0
      • S Santhosh G_

        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
        ..
        #endif

        The 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.

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • F ForNow

          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

          S Offline
          S Offline
          Santhosh G_
          wrote on last edited by
          #4

          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

          F 1 Reply Last reply
          0
          • S Santhosh G_

            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

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            Somewhere between the initlization and the CWinApp constructer the code dies I think using DEBUG_PROCESS flags will send events at everypoint till the process is created

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups