VS2010中断点处冻结所有线程

发布于 2024-08-19 22:50:51 字数 263 浏览 5 评论 0原文

我正在使用 VS2010 Beta 2 来调试一些多线程代码。喜欢并行堆栈等。

不过,我有一个问题:我在一个可能由多个线程调用的方法中设置了断点。一旦到达断点,我真的想将注意力集中在触发该断点的线程上。然而,当我点击“step”时,VS 经常切换到另一个线程(假设我在线程 1 上停止,但与此同时,线程 2 遇到了我的断点)。

我知道我可以手动冻结线程窗口中的线程。有没有一种方法可以自动执行此操作 - 基本上,一旦我遇到断点,就冻结除当前线程之外的所有线程,直到我遇到 F-5?

I'm using VS2010 Beta 2 to debug some multi-threaded code. Love parallel stacks, etc.

I have a question, though: I have a breakpoint set in a method that may be called by multiple threads. Once I hit the breakpoint, I really want to keep the focus on the thread that triggered the that breakpoint. However, when I hit "step", VS often switches to another thread (say I'm stopped on thread 1, but in the meanwhile, thread 2 hits my breakpoint).

I know that I can manually freeze threads in the thread window. Is there a way to do it automatically -- basically, once I hit a breakpoint, freeze all threads except the current one until I hit F-5?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

何处潇湘 2024-08-26 22:50:51

我刚刚发布了一个 Visual Studio 2010 扩展,它完全可以满足您的需求。
而且它是免费的:)。

演示

此 Visual Studio 2010 扩展添加了两个快捷方式和工具栏按钮,使开发人员可以在调试多线程应用程序时轻松专注于单线程。

它极大地减少了手动进入“线程”窗口冻结/解冻除需要遵循的线程之外的所有线程的需要,因此有助于提高工作效率。

功能

仅限制当前线程的进一步执行。将冻结所有其他线程。快捷键:CTRL+T+T 或雪花按钮。
切换到下一个单线程(基于ID)。将更改当前线程并冻结所有其他线程。快捷键:CTRL+T+J 或“下一步”按钮。

请访问此处的图库官方页面Codeplex 存储库

I have just released a Visual Studio 2010 extension that does exactly what you are looking for.
And it's free :).

Presentation

This Visual Studio 2010 extension adds two shortcuts and toolbar buttons to allow developers to easily focus on single threads while debugging multi-threaded applications.

It dramatically reduces the need to manually go into the Threads window to freeze/thaw all threads but the one that needs to be followed, and therefore helps improve productivity.

Features

Restrict further execution to the current thread only. Will freeze all other threads. Shortcut: CTRL+T+T or Snowflake button.
Switch to the next single thread (based on ID). Will change current thread and freeze all other threads. Shortcut: CTRL+T+J or Next button.

Check it out here on the Gallery, on the official page or the Codeplex repository.

念三年u 2024-08-26 22:50:51

如果您从“调试”->“Windows”->“线程”加载“线程”窗口。一旦遇到断点,您可以选择所有线程并单击“冻结线程”,然后您可以恢复活动线程,选择它并选择“解冻线程”。

这将只允许当前线程在调试器中执行。

If you load the Threads window from Debug->Windows->Threads.. Once you hit a break point, you can select all the threads and click "Freeze Threads" then you can resume the active thread, selecting it and choosing "Thaw threads".

This will allow only the current thread to execute in the debugger.

孤寂小茶 2024-08-26 22:50:51

据我所知,但是您可以在单步执行时禁用断点。

当我担心混淆许多线程时,我倾向于保持线程窗口打开并记下线程 ID。

Not that I'm aware of, however you could disable your breakpoint while you are stepping through.

When I'm worried about confusing many threads I tend to just keep the threads window open and keep a note of the thread id's.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文