You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/debugger/debug-multithreaded-applications-in-visual-studio.md
+18-15Lines changed: 18 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Debug Multithreaded Applications in Visual Studio | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "04/21/2017"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
7
ms.technology:
@@ -44,25 +44,34 @@ translation.priority.ht:
44
44
# Debug Multithreaded Applications in Visual Studio
45
45
A thread is a sequence of instructions to which the operating system allocates processor time. Every process that is running in the operating system consists of at least one thread. Processes that have more than one thread are called multithreaded.
46
46
47
-
Computers with multiple processors, multi-core processors, or hyperthreading processes can run multiple threads at the same time. Parallel processing of multiple threads can greatly improve program performance, but it can also make debugging more difficult because it introduces the need to keep track of multiple threads.
47
+
Computers with multiple processors, multi-core processors, or hyperthreading processes can run multiple threads at the same time. Parallel processing of multiple threads can greatly improve program performance, but it can also make debugging more difficult because it introduces the need to keep track of multiple threads.
48
48
49
-
In addition, multithreading introduces some new types of potential bugs. Often, for example, two or more threads have to access the same resource, but only one thread can safely access the resource at a time. Some form of mutual exclusion is necessary to make sure that only one thread is accessing the resource at a time. If mutual exclusion is performed incorrectly, it can create a *deadlock* condition where no thread can execute. Deadlocks can be a particularly hard problem to debug.
49
+
In addition, multithreading introduces some new types of potential bugs. Often, for example, two or more threads have to access the same resource, but only one thread can safely access the resource at a time. Some form of mutual exclusion is necessary to make sure that only one thread is accessing the resource at a time. If mutual exclusion is performed incorrectly, it can create a *deadlock* condition where no thread can execute. Deadlocks can be a particularly hard problem to debug.
50
+
51
+
Visual Studio provides different tools for use in debugging multithreaded apps.
52
+
53
+
- For threads, the primary tools for debugging threads are the **Threads** window, thread markers in source windows, **Parallel Stacks** window, **Parallel Watch** window, and the **Debug Location** toolbar. To get started, see [Get started debugging a multithreaded application](../debugger/how-to-use-the-threads-window.md) and [Using the Parallel Stacks window](../debugger/using-the-parallel-stacks-window.md).
50
54
51
-
Visual Studio provides a **Threads** window, a GPU Threads window, a **Tasks** window, a Parallel Watch window, and other features that make multithreaded debugging easier. The best way to learn about the threading features is by doing the walkthroughs. See [Get started debugging a multithreaded application](../debugger/how-to-use-the-threads-window.md) and [Walkthrough: Debugging a C++ AMP Application](http://msdn.microsoft.com/Library/40e92ecc-f6ba-411c-960c-b3047b854fb5).
55
+
- For code that uses the [Task Parallel Library (TPL)](http://msdn.microsoft.com/Library/b8f99f43-9104-45fd-9bff-385a20488a23) or the [Concurrency Runtime](/cpp/parallel/concrt/concurrency-runtime/), the primary tools for debugging multithreaded applications are the **Parallel Stacks** window, the **Parallel Watch** window, and the **Tasks** window (the **Tasks** window also supports JavaScript). To get started, see [Walkthrough: Debugging a Parallel Application](../debugger/walkthrough-debugging-a-parallel-application.md) and [Walkthrough: Debugging a C++ AMP Application](http://msdn.microsoft.com/Library/40e92ecc-f6ba-411c-960c-b3047b854fb5).
56
+
57
+
- For debugging threads on the GPU, the primary tools is the **GPU Threads** windows. See [How to: Use the GPU Threads window](../debugger/how-to-use-the-gpu-threads-window.md).
52
58
53
-
Visual Studio also provides powerful breakpoints and tracepoints, which can be very useful when you debug multithreaded applications. You can use breakpoint filters to place breakpoints on individual threads. See [Using Breakpoints](../debugger/using-breakpoints.md)
59
+
Visual Studio also provides powerful breakpoints and tracepoints, which can be very useful when you debug multithreaded applications. You can use breakpoint filters to place breakpoints on individual threads. See [Using Breakpoints](../debugger/using-breakpoints.md).
54
60
55
61
Debugging a multithreaded application that has a user interface can be especially difficult. In that case, you might consider running the application on a second computer and using remote debugging. For information, see [Remote Debugging](../debugger/remote-debugging.md).
56
62
57
63
## In This Section
58
64
[Get started debugging a multithreaded application](../debugger/how-to-use-the-tasks-window.md).
59
-
A guided tour of thread debugging features, with emphasis on features how to[!INCLUDE[vs_orcas_long](../debugger/includes/vs_orcas_long_md.md)].
65
+
A guided tour of thread debugging features, with emphasis on features in the **Threads** window[!INCLUDE[vs_orcas_long](../debugger/includes/vs_orcas_long_md.md)].
60
66
61
67
[Debug Threads and Processes](../debugger/debug-threads-and-processes.md)
62
68
Explains the basics of debugging threads and processes.
Copy file name to clipboardExpand all lines: docs/debugger/debug-threads-and-processes.md
+11-6Lines changed: 11 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Tools to debug threads and processes | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "12/09/2016"
4
+
ms.date: "04/21/2017"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
7
ms.technology:
@@ -51,9 +51,14 @@ translation.priority.ht:
51
51
The [!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] debugger provides powerful but easy-to-use tools for debugging threads and processes.
52
52
53
53
## Tools and features
54
-
The primary tools for working with processes in [!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] are the **Attach to Process** dialog box, the **Processes** window, and the **Debug Location** toolbar. The primary tools for debugging threads are the **Threads** window, thread markers in source windows, and the **Debug Location** toolbar.
54
+
The tools you need to use in [!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] depend on what type of code you are trying to debug:
55
+
- For processes, the primary tools are the **Attach to Process** dialog box, the **Processes** window, and the **Debug Location** toolbar.
56
+
57
+
- For threads, the primary tools for debugging threads are the **Threads** window, thread markers in source windows, **Parallel Stacks** window, **Parallel Watch** window, and the **Debug Location** toolbar.
55
58
56
-
The primary tools for debugging multithreaded applications are the **Parallel Stacks** and **Parallel Tasks**, **Parallel Watch**, and **GPU Threads** windows.
59
+
- For code that uses the <xref:System.Threading.Tasks.Task> in the [Task Parallel Library (TPL)](http://msdn.microsoft.com/Library/b8f99f43-9104-45fd-9bff-385a20488a23), the [Concurrency Runtime](/cpp/parallel/concrt/concurrency-runtime/) (native code), the primary tools for debugging multithreaded applications are the **Parallel Stacks** windoww, the **Parallel Watch** window, and the **Tasks** window (the **Tasks** window also supports the JavaScript promise object).
60
+
61
+
- For debugging threads on the GPU, the primary tools is the **GPU Threads** windows.
57
62
58
63
The following table shows the information available and the actions you can perform in each of these places:
59
64
@@ -64,9 +69,9 @@ translation.priority.ht:
64
69
|**Threads** window|Threads in current process:<br /><br /> - Thread ID<br />- Managed ID<br />- Category (main thread, interface thread, remote procedure call handler, or worker thread)<br />- Thread Name<br />- Location where thread is created<br />- Priority<br />- Affinity Mask<br />- Suspended Count<br />- Process Name<br />- Flag Indicator<br />- Suspended indicator|Tools:<br /><br /> - Search<br />- Search Call Stack<br />- Flag Just My Code<br />- Flag Custom Module Selection<br />- Group by<br />- Columns<br />- Expand/Collapse callstacks<br />- Expand/Collapse groups<br />- Freeze/Thaw Threads<br /><br /> Shortcut menu:<br /><br /> - Show threads in source<br />- Switch to a thread<br />- Freeze a running thread<br />- Thaw a frozen thread<br />- Flag a thread for additional study<br />- Unflag a thread<br />- Rename a thread<br />- Show and hide threads<br /><br /> Other actions:<br /><br /> - View the call stack for a thread in a DataTip|
65
70
|Source window|Thread indicators in left gutter indicate single or multiple threads (off by default, turned on by using shortcut menu in **Threads** window)|Shortcut menu:<br /><br /> - Switch to a thread<br />- Flag a thread for additional study<br />- Unflag a thread|
66
71
|**Debug Location** toolbar|- Current process<br />- Suspend the application<br />- Resume the application<br />- Suspend and shut down the application<br />- Current thread<br />- Toggle current thread flag state<br />- Show only flagged threads<br />- Show only current process<br />- Current stack frame|- Switch to another process<br />- Suspend, resume, or shut down the application<br />- Switch to another thread in current process<br />- Switch to another stack frame in current thread<br />- Flag or unflag current threads<br />- Show only flagged threads<br />- Show only the current process|
67
-
|**Parallel Stacks** window|- Call stacks for multiple threads in one window.<br />- Active stack frame for each thread.<br />- Callers and callees for any method.|- Filter out specified threads<br />- Switch to Parallel Tasks view<br />- Flag or unflag a thread<br />- Zoom|
68
-
|**Parallel Tasks** window|- View information about <xref:System.Threading.Tasks.Task> objects including task ID, task status (scheduled, running, waiting, deadlocked), and which thread is assigned to the task.<br />- Current location in call stack.<br />- Delegate passed to the task at creation time|- Switch to current task<br />- Flag or unflag a task<br />- Freeze or thaw a task|
69
-
|**Parallel Watch** window|- The flag column, in which you can mark a thread that you want to pay special attention to.<br />- The frame column, in which an arrow indicates the selected frame.<br />- A configurable column that can display the machine, process, tile, task, and thread.|- Flag or unflag a thread<br />- Display only flagged threads<br />- Switch frames<br />- Sort a column<br />- Group threads<br />- Freeze or thaw threads<br />- export the data in the Parallel Watch window|
72
+
|**Parallel Stacks** window|- Call stacks for multiple threads in one window.<br />- Active stack frame for each thread.<br />- Callers and callees for any method.|- Filter out specified threads<br />- Switch to Tasks view<br />- Flag or unflag a thread<br />- Zoom|
73
+
|**Parallel Watch** window|- The flag column, in which you can mark a thread that you want to pay special attention to.<br />- The frame column, in which an arrow indicates the selected frame.<br />- A configurable column that can display the machine, process, tile, task, and thread.|- Flag or unflag a thread<br />- Display only flagged threads<br />- Switch frames<br />- Sort a column<br />- Group threads<br />- Freeze or thaw threads<br />- export the data in the Parallel Watch window|
74
+
|**Tasks** window|- View information about <xref:System.Threading.Tasks.Task> objects including task ID, task status (scheduled, running, waiting, deadlocked), and which thread is assigned to the task.<br />- Current location in call stack.<br />- Delegate passed to the task at creation time|- Switch to current task<br />- Flag or unflag a task<br />- Freeze or thaw a task|
70
75
|**GPU Threads** window|- The flag column, in which you can mark a thread that you want to pay special attention to.<br />- The active thread column, in which a yellow arrow indicates an active thread. An arrow indicates a thread where execution broke into the debugger.<br />- The **Thread Count** column, which displays the number of threads at the same location.<br />- The **Line** column, which displays the line of code where each group of threads is located.<br />- The **Address** column, which displays the instruction address where each group of threads is located.<br />- The **Location** column, which is the location in the code of the address.<br />- The **Status** column, which shows whether the thread is active or blocked.<br />- The **Tile** column, which shows the tile index for the threads in the row.|- Change to a different active thread<br />- Display a particular tile and thread<br />- Display or hide a column<br />- Sort by a column<br />- Group threads<br />- Freeze or thaw threads<br />- Flag or unflag a thread<br />- Display only flagged threads|
Copy file name to clipboardExpand all lines: docs/debugger/using-the-tasks-window.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Using the Tasks Window | Microsoft Docs"
3
3
ms.custom: ""
4
-
ms.date: "11/04/2016"
4
+
ms.date: "04/21/2017"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
7
ms.technology:
@@ -38,13 +38,13 @@ translation.priority.ht:
38
38
- "zh-tw"
39
39
---
40
40
# Using the Tasks Window
41
-
The **Tasks** window resembles the **Threads** window, except that it shows information about <xref:System.Threading.Tasks.Task?displayProperty=fullName>, [task_handle](/cpp/parallel/concrt/reference/task-group-class.md), or [WinJS.Promise](http://msdn.microsoft.com/library/windows/apps/br211867.aspx) objects instead of each thread. Like threads, tasks represent asynchronous operations that can run concurrently; however, multiple tasks may run on the same thread. See [Asynchronous programming in JavaScript (Windows Store apps)](http://msdn.microsoft.com/library/windows/apps/hh700330.aspx) for more information.
41
+
The **Tasks** window resembles the **Threads** window, except that it shows information about <xref:System.Threading.Tasks.Task?displayProperty=fullName>, [task_handle](/cpp/parallel/concrt/reference/task-group-class.md), or [WinJS.Promise](http://msdn.microsoft.com/library/windows/apps/br211867.aspx) objects instead of each thread. Like threads, tasks represent asynchronous operations that can run concurrently; however, multiple tasks may run on the same thread.
42
42
43
43
In managed code, you can use the **Tasks** window when you work with <xref:System.Threading.Tasks.Task?displayProperty=fullName> objects or with the **await** and **async** keywords (**Await** and **Async** in VisualBasic). For more information about tasks in managed code, see [Parallel Programming](http://msdn.microsoft.com/Library/4d83c690-ad2d-489e-a2e0-b85b898a672d).
44
44
45
45
In native code, you can use the **Tasks** window when you work with [task groups](/cpp/parallel/concrt/task-parallelism-concurrency-runtime), [parallel algorithms](/cpp/parallel/concrt/parallel-algorithms), [asynchronous agents](/cpp/parallel/concrt/asynchronous-agents), and [lightweight tasks](/cpp/parallel/concrt/task-scheduler-concurrency-runtime). For more information about tasks in native code, see [Concurrency Runtime](/cpp/parallel/concrt/concurrency-runtime).
46
46
47
-
In JavaScript, you can use the Tasks window when you are working with promise .then code.
47
+
In JavaScript, you can use the Tasks window when you are working with promise .then code. See [Asynchronous programming in JavaScript (Windows Store apps)](http://msdn.microsoft.com/library/windows/apps/hh700330.aspx) for more information.
48
48
49
49
You can use the **Tasks** window whenever you break into the debugger. You can access it on the **Debug** menu by clicking **Windows** and then clicking **Tasks**. The following illustration shows the **Tasks** window in its default mode.
0 commit comments