28
edits
Changes
→Case C
==Case C==
We will use the following 2 programs to debugg 2 processes.
Each of these programs will be a separate project.
There are two methods to debug multiple processes.
Start Multiple Projects
First we need to put both of there projects in the same solution.
To do this we must:
1.Right Click Project Solution
2.Go to "Add", then pick "Add Existing Project"
3.Navigate to the 2nd project's project file and open it
PIC
Next we will have to set the 2nd project to start up with the 1st project
To do this we must:
1.Right Click Project Solution
2.Select Set Startup Projects
3.On the Solution Propert Pages Window, Select Multiple startup projects
4.Select Start as the action for the 2nd Project
*Note:The Projects will execute in order shown
PIC
Now when we run the debugger, it will run both projects as a seperate process.
Attach debugger to background process
First we must run the 2nd project without the debugger
(VS 2017 will not allow you to attach a running process that is using the debugger)
1.Select Tools and pick External Tools
2.Click add on the External Tools
3.Give it a name and set command to C:\Windows\System32\cmd.exe
4.Apply changes and then under tools, select your commandline tool
5.In the commandline, navigate to the 2nd project's debug folder
6.In the commandline, type the name of the 2nd project with the .exe extension
Now that your process is running, You can attach the debugger to it
To do this:
1.Select Debug and pick Attach to Process
2.In the Attach to Process window, select 2nd project's process and click attach
Now your debugger will run the 1st project with 2nd project as a seperate process