我如何在.NET中的线程转储? (一拉JVM线程转储) [英] How do I make a thread dump in .NET ? (a la JVM thread dumps)

查看:122
本文介绍了我如何在.NET中的线程转储? (一拉JVM线程转储)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有发现任何方式倾倒在堆栈上.NET中的所有线程。既不被发送到处理也不编程方式访问所有线程的信号。我只能得到通过Thread.CurrentThread访问到当前线程。

I have found no way of dumping the stack on all threads in .NET. Neither a signal to be send to the process nor programatic access to all the threads. I can only get access to the current thread via Thread.CurrentThread.

什么花样?

推荐答案

如果你想获得一个堆栈转储,而进程已经运行(一拉jstack),那里描述的here

If you're trying to get a stack dump while the process is already running (a la jstack), there are two methods as described here:

有一个鲜为人知但有效的工具,称为<一个href="http://www.tomergabel.com/ct.ashx?id=1db72c20-3c25-42ad-93c4-b0551a0fed4e&url=http%3a%2f%2fwww.microsoft.com%2fdownloads%2fdetails.aspx%3fFamilyID%3d80CF81F7-D710-47E3-8B95-5A6555A230C2%26displaylang%3den">Managed堆栈管理器的。虽然有基本的图形用户界面,它可以有效地将一个.NET相当于jstack,如果你要添加的路径;那么它的打字只是一个问题:

There is a little-known but effective tool called the Managed Stack Explorer. Although it features a basic GUI, it can effectively be a .NET equivalent of jstack if you add to the path; then it’s just a question of typing:

mse /s /p <pid>

  1. 下载并安装相应的调试工具的Windows版本的体系结构(x86 / 64 /安腾)
  2. 如果您需要有关Windows函数调用的信息(例如,你想跟踪到内核调用),下载并安装相应的符号。这不是严格必要的,如果你只是想你自己的code线程转储。
  3. 如果您需要行号或其他详细信息,请务必将您的程序集PDB文件所在的调试器可以找到它们(通常你只要把他们旁边,你的实际程序集)。
  4. 在开始 - >程序 - > Windows调试工具[64] - > WinDbg的
  5. 使用菜单将调试器附加到正在运行的进程
  6. 加载SOS扩展名.loadby索斯mscorwks为.NET 2.0(.load SOS对.NET 1.0 / 1.1)
  7. 使用以一个线程转储!eestack
  8. 在分离使用.detach

我只是发现有必要采取生产线程转储,这为我工作。希望它可以帮助: - )

I just found it necessary to take a production thread dump and this worked for me. Hope it helps :-)

这篇关于我如何在.NET中的线程转储? (一拉JVM线程转储)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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