Open main menu

CDOT Wiki β

Changes

Debugging Parallel Programs in Visual Studio / Team Debug

808 bytes added, 02:51, 22 December 2017
Case C
 
<source lang="c">
//Source1.cpp
#include <iostream>
std::cin.get(c);
}
 
</source>
<source lang="c">
//Source2.cpp
}
</source>
We will create a seperate project for each of these pieces of code.
There are two methods to debug multiple processes.
'''Start Multiple Projects'''
First we need to put both of there projects in the same solution.
2.Go to "Add", then pick "Add Existing Project"
3.Navigate to the 2nd Source2 project's project file and open it
PIC
Next we will have to set the 2nd Source2 project to start up with the 1st Source1 project
To do this we must:
3.On the Solution Propert Pages Window, Select Multiple startup projects
4.Select Start as the action for the 2nd Source2 Project
*Note:The Projects will execute in order shown
PIC
Now when we run the debugger, it will run both projects as a seperate processand will show up on the Processes windowThe Processes Window will show: *Name: Name of the process*ID: Process ID*Path to the executable*Title: Menu Bar Title*State: Break or Running*Debugging:Debugging (Native, Managed, and so on.)*Connection Type: Transport type (default, native with no authentication)*Connection Target: Transport Qualifier (remote computer)   
'''Attach debugger to background process'''
First we must run the 2nd Source2 project without the debugger (VS 2017 will not allow you to attach as a running background process that is using the debugger).
1.Select Tools and pick External Tools
4.Apply changes and then under tools, select your commandline tool
5.In the commandline, navigate to the 2nd Source2 project's debug folder*The executable should be located in the projects Debug folder*If there is no debug folder, you must run the Source2 project at least once
6.In the commandline, type the name of the 2nd Source2 project with the .exe extensionand the appropriate agruements and the press enter to execute*IMPORTANT: Do not press enter to continue, Visual Studios only allow the debugger to attach to a running process
Now that your process is running, You can attach the debugger to it
To do this:
1.Start Debugging 2.Select Debug and pick Attach to Process
23.In the Attach to Process window, select 2nd Source2 project's process and click attach
Now your debugger will run the 1st Source1 project with 2nd Source2 project as a seperate process
28
edits