<< 一生必看的经典电影 | 首页 | java 服务降级开关设计思路 - 程序员之路 - 博客频道 - CSDN.NET >>

c# - How do I make a thread dump in .NET ? (a la JVM thread dumps) - Stack Overflow

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:

Using Managed Stack Explorer

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>

 

Using windbg

  1. Download and install the appropriate Debugging Tools for Windows version for your architecture (x86/x64/Itanium)
  2. If you need information about Windows function calls (e.g. you want to trace into kernel calls), download and install the appropriate symbols. This isn't strictly necessary if you just want a thread dump of your own code.
  3. If you need line numbers or any other detailed information, make sure to place your assemblies' PDB files where the debugger can find them (normally you just put them next to your actual assemblies).
  4. Start->Programs->Debugging Tools for Windows [x64]->windbg
  5. Attach the debugger to your running process using the menu
  6. Load the SOS extension with ".loadby sos mscorwks" for .NET 2.0 (".load sos" for .NET 1.0/1.1)
  7. Take a thread dump using "!eestack"
  8. Detach using ".detach"

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

阅读全文……

标签 :



发表评论 发送引用通报