Open main menu

CDOT Wiki β

Changes

Debugging Parallel Programs in Visual Studio / Team Debug

155 bytes added, 09:12, 22 December 2017
m
Walkthrough
1. When you start debug (F5), click on DEBUG > Windows > Processes.
 
2.
 
3. Terminate or Attach the process by using "Terminate Process" and "Attach to Process "icon.
'''How to Use:'''
Select threadsTerminate or Attach the process by using "Terminate Process" and "Attach to Process "icon.
==Threads window==
On the Threads window, you can see "main thread" line and some worker threads. The yellow arrow points only main thread. and go the next region. Apparently, ntdll.. threads are not used.
[[File:1stblock1stblock2.png|1000px|center|serial]]
You can see "Stack Frame" name on the top screen is changed to main\omp\1
On the Threads window, you can see "main thread" and other new three thread which same as default usable thread number 4 (The number is maximum usable thread of the cpu the program is running. And it is printed in the serial region as "omp_get_max_threads()"). after hitting 4 times (you can see the count on the breakpoint Window), the step goes to the next region.[[File:2ndblockticon.png|50px|center|open]]A thread icon appear the side of the parallel line[[File:2ndblock2.png|1000px|center|open]]
You can see "Stack Frame" name on the top screen is changed to main\omp\2
On the Threads window, you can see "main thread" and other new seven thread which same as the thread number decided inside of the code. after hitting 8 times, the debugging is terminated.
[[File:3rdblock3rdblock2.png|1000px|center|open+]]
==Case B - Using the Parallel Stacks and the Parallel Watch Window==
2.Go to "Add", then pick "Add Existing Project"
 
[[File:Pr1.png|1000px|center|Process window]]
 
3.Navigate to the Source2 project's project file and open it
 [[File:Pr2.png|1000px600px|center|Process window]] 
Next we will have to set the Source2 project to start up with the Source1 project
2.Select Set Startup Projects
 
[[File:Pr3.png|1000px|center|Process window]]
 
3.On the Solution Propert Pages Window, Select Multiple startup projects
*Note:The Projects will execute in order shown
 [[File:Pr4.png|1000px600px|center|Process window]] 
Now when we run the debugger, it will run both projects as a seperate process and will show up on the Processes window.
 
[[File:Pr5.png|1000px|center|Process window]]
 
The Processes Window will show:
3.Give it a name and set command to C:\Windows\System32\cmd.exe
 [[File:Pr6.png|1000px300px|center|Process window]] 
4.Apply the changes and then under tools, select your command line tool
*IMPORTANT: Do not press enter to continue, Visual Studios only allow the debugger to attach to a running process
 [[File:Pr7.png|1000px600px|center|Process window]] 
Now that your process is running, You can attach the debugger to it
2.Select Debug and pick Attach to Process
 
[[File:Pr8.png|1000px|center|Process window]]
 
3.In the Attach to Process window, select Source2 project's process and click attach
 [[File:Pr9.png|1000px600px|center|Process window]] 
Now your debugger will run the Source1 project with Source2 project as a seperate process
 
[[File:Pr10.png|1000px|center|Process window]]
190
edits