如何调试在Visual Studio中一个单独的线程? [英] How to debug a single thread in Visual Studio?
问题描述
我有一些项目的解决方案。有在不同项目中的几个突破点。我要跟踪的第一个线程所打的这些突破点之一,并继续跟踪,尽管输入相同的code块的其他线程的单个线程。
I have a solution with some projects. There are several break-points in different projects. I want to trace the first thread hit one of these break-points and continue tracing that single thread despite of other threads entering the same code-blocks.
我知道这是有可能通过对断点定义一个条件,那就是,线程名称= ...或者线程ID = ...但我的情况是装的ASP.NET 应用,一旦我连接到的w3wp.exe
的线程将达到破-points。我需要一些东西像的ThreadLocal<突破点方式>
I know this is possible through defining a condition on the break-point, that is, thread name = ... or thread Id = ... but my case is a heavy loaded ASP.NET application and as soon as I attach to w3wp.exe
many threads will hit the break-points. I need some thing like a ThreadLocal<break-point>
.
这可能吗?如果是这样,怎么样?
Is it possible? If so, how?
推荐答案
冻结/解冻线程是一个不正确的方法,因为其他线程不执行任何code。
Freeze/Thaw threads is an incorrect way because other threads don't execute any code.
最正确和实用的方法是:
The most correct and usable way is to:
- 按Ctrl + A在断点窗口(选择所有断点)。
- 右键单击,然后选择过滤器...。
- 输入的ThreadId =(当前线程ID)。
因此,所有的线程执行,但调试器击中当前线程只。
So all threads are executed, but the debugger hits on the current thread only.
这篇关于如何调试在Visual Studio中一个单独的线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!