是否可以在 Visual Studio 2010 中中断除一个线程之外的所有线程?
是否可以在 Visual Studio 2010 Ultimate 中中断除一个线程之外的所有线程?
我的应用程序中的线程之一正在运行 TCP 代理。当客户端(连接到我的代理)没有每隔几秒发送一个保持活动数据包时,它连接到的服务器就会断开连接。
因此,我需要中断所有其他线程(例如数据包处理),以便我可以在不断开连接的情况下编辑该部分。
如果没有附加组件,这可以实现吗?
Is it possible to break all threads but one in Visual Studio 2010 Ultimate?
One of the threads in my application is running a TCP proxy. The server that it connects to disconnects when the client (that connects to my proxy) doesn't send a keep-alive packet every few seconds.
So I would need to break all other threads (like packet processing) so that I can edit that part without getting disconnected.
Is this achievable without add-ons?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当您在调试器中“Break All”时,在“线程”窗口中,右键单击所有不想运行的线程并选择“冻结”,然后继续运行,只有您的目标线程会运行。
When you Break All in the debugger, in the threads window, right click on all of the threads you don't want to run and select freeze, then continue running, only your target thread will be running.
可以在您想要用计时器暂停的线程中放置一个 while 循环,以输出有关文本框上某些变量的数据。然后让按钮在循环之间步进?
只是一个想法。
It might be possible to just put a while loop in the thread that are you wanting to pause with a timer to output data about certain variables on a textbox. Then make the button to step between the loops?
Just an idea.
一种可能有效的解决方案是编写一个宏,当您停止在 BP 处时调用该宏,该函数会评估发送一些保持活动数据包的某个函数。
例如,您的宏就像
DTE.Windows.Item("{ECB7191A-597B-41F5-9843-03A4CF275DDE}").Activate() '立即窗口
DTE.ExecuteCommand("Debug.Print", "KeepAliveFunc()")
这显然不理想,但如果没有其他帮助......
One solution that might possibly work, is to write a macro that you call when you stop at a BP that function evaluates some function that sends some stay alive packets.
E.g. your macro goes like
DTE.Windows.Item("{ECB7191A-597B-41F5-9843-03A4CF275DDE}").Activate() 'Immediate Window
DTE.ExecuteCommand("Debug.Print", "KeepAliveFunc()")
It's obviously not ideal, but if nothing else helps...
看起来这是不可能的。有关同一问题的先前讨论,请参阅中断单线程。
Looks like it is not possible. See Breaking single thread for a previous discussion of the same problem.