如何调试僵局? [英] How to debug a deadlock?

查看:132
本文介绍了如何调试僵局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除此之外,我不知道我现在可以复制它,它的发生(我一直在使用一个星期或这个特殊的应用目前两人没有问题),假设我运行在VS我的应用程序调试器,我应该怎么去完事后调试僵局?我想我也许能获得在调用栈,如果我停下程序,从而看到不同的线程是当它发生,但点击暂停只是把Visual Studio中陷入僵持过,直到我杀了我的申请。

Other than that I don't know if I can reproduce it now that it's happened (I've been using this particular application for a week or two now without issue), assuming that I'm running my application in the VS debugger, how should I go about debugging a deadlock after it's happened? I thought I might be able to get at call stacks if I paused the program and hence see where the different threads were when it happened, but clicking pause just threw Visual Studio into a deadlock too till I killed my application.

有一些方法不是通过我的源代码树浏览发现潜在的问题等?有没有办法在调用栈获得一旦问题已发生,看看问题出在哪里?任何其他工具/提示/技巧,可以帮助?

Is there some way other than browsing through my source tree to find potential problems? Is there a way to get at the call stacks once the problem has occured to see where the problem is? Any other tools/tips/tricks that might help?

推荐答案

您所做的是正确的方法是什么。如果Visual Studio还死锁,现在再发生。这只是运气不好,除非有一些其他的问题。

What you did was the correct way. If Visual Studio also deadlocks, that happens now and then. It's just bad luck, unless there's some other issue.

您不必为了调试它运行在调试器中的应用。正常运行应用程序,如果发生死锁,以后可以附加VS。 按Ctrl + Alt + P ,选择的过程,选择调试类型,点击连接即可。使用一组不同种类的调试器可能会降低VS的崩溃(特别是如果你没有调试本机代码)的风险。

You don't have to run the application in the debugger in order to debug it. Run the application normally, and if the deadlock happens, you can attach VS later. Ctrl+Alt+P, select the process, choose debugger type and click attach. Using a different set of debugger types might reduce the risk of VS crashing (especially if you don't debug native code)

一个死锁涉及2个或更多的线程。你可能知道,因为你发现你的应用程序死锁第一个(可能是你的UI线程)。现在你只需要找到另一个。随着架构的知识,应该很容易找到。

A deadlock involves 2 or more threads. You probably know the first one (probably your UI thread) since you noticed the deadlock in your application. Now you only need to find the other one. With knowledge of the architecture, it should be easy to find (e.g. what other threads use the same locks, interact with the UI etc)

如果VS不起作用所有的,你可以随时使用的WinDbg 。这里下载: http://www.microsoft.com/whdc/devtools/debugging/default.mspx

If VS doesn't work at all, you can always use windbg. Download here: http://www.microsoft.com/whdc/devtools/debugging/default.mspx

这篇关于如何调试僵局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆