如何在 Visual Studio 中转储或搜索所有线程的调用堆栈
如何在 Visual Studio 中转储或搜索所有线程的调用堆栈?我们有一个服务器进程需要调试,它有数百个线程正在运行,因此手动检查每个线程应该很困难。
我知道 gdb 中的“线程应用”可以做这种事情。所以我想知道 Visual Studio 的调试器中是否有类似的功能。
另外我使用的是 Visual Studio 2005,所以请给出 VS 2005 的解决方案(VS 2010 中提供了所有调用堆栈中的搜索...)。
How to dump or search in call stacks of ALL threads in Visual Studio? We have a server process to debug and it has hundreds of threads running, so it should be hard to manually check each threads.
I know "thread apply" in gdb can do this kind of things. So I was wondering is there anything similar available in visual studio's debugger.
Also I was using visual studio 2005, so please give a solution for VS 2005 ( search in all call stack is provided in VS 2010...).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也遇到了同样的问题,也是在 VS2005 中。我找到了一个更简单的解决方案:
调试时打开VS的命令窗口,使用命令:
Debug.ListCallStack /AllThreads
我在以下位置找到了这个:
https://web.archive.org/web/20150627064016/http://blogs.msdn.com/b/greggm/archive/2005/08/02/446899.aspx
I just had the same problem, also in VS2005. I found a simpler solution:
While debugging open the command window of VS and use the command:
Debug.ListCallStack /AllThreads
I found this on:
https://web.archive.org/web/20150627064016/http://blogs.msdn.com/b/greggm/archive/2005/08/02/446899.aspx
后来我通过使用 WinDbg 找到了答案,
首先在 VS 调试会话中保存一个小型转储,例如 myapp.dmp
然后使用以下命令将所有调用堆栈转储到 out.txt
cdb -zc:\myapp.dmp -logo out.txt -行 -c "~*kb;q" -yc:\符号
Later I found the answer by using WinDbg,
First save a minidump in VS debug session, say, myapp.dmp
Then using the following command to dump all callstack to out.txt
cdb -z c:\myapp.dmp -logo out.txt -lines -c "~*kb;q" -y c:\symbols
在 VS 2019 中(也可能在其他版本中)
主菜单:调试 ->窗口 ->线程
显示“线程”选项卡,其中列出了所有线程,对于每个线程,您可以展开堆栈跟踪,并且有一个可以覆盖堆栈跟踪的搜索 - 这样在搜索后您将只获得包含所需单词的线程:
In VS 2019 (and may be in others)
Main menu: Debug -> Windows -> Threads
Shows Threads tab which lists all threads, for each thread you can expand stack trace and there is a search which can cover stack traces - so that after search you'll get only threads which include required words: