We help IT Professionals succeed at work.

Debugging multiple processes in MS VC++

felonius asked

I am finding myself in a position where I need to make applications that consist of multiple processes (*NOT* threads). My program starts in one process and spawns several others along the way. This is all fine, except for the fact that I only seem to be able to debug the first process.

Is it possible in Visual C++ 6 to switch to debugging the other processes? If so, how? Note that they all use the same exe module and setting break points in the code used by the other processes has no effect.

(PS: The reason why I use multiple processes is because they in later phases of my project need to be distributed on a network and they communicate via TCP/IP - anyway this is done via the WMPI from Critical Software)

Thanks in advance,
Jacob Marner
Watch Question

I don't think you can. What you can do is to write messages from critical points in your code to log file.

Author of the Year 2009
Have you tried using the Attach To Process command on the Build/Start Debug menu?

-- Dan


Not a perfect solution, but acceptable. Thanks.

In case somebody asks this question again, here is what I did:

1. I insert some blocking command where I want the break point ( say, with a getchar() call )
2. execute the program outside the debugger.
3. I attach to the process I want to debug
4. open the source code in the main window,
5. set a break point just after getchar(),
6. hit enter in the application window
I am now debugging the child process with full symbol info.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.