【问题标题】:How to look for a thread with specific call stacks (from thousands of threads)如何查找具有特定调用堆栈的线程(来自数千个线程)
【发布时间】:2021-08-04 19:20:15
【问题描述】:

我需要从转储文件中查看具有特定堆栈跟踪的线程。该文件有数千个线程

0:638> !threads
ThreadCount:      23800
UnstartedThread:  175
BackgroundThread: 4569
PendingThread:    194
DeadThread:       19053
Hosted Runtime:   no

我使用~* e !clrstack 试图获取我以后可以搜索的所有堆栈。但我猜windbg缓冲区足够小,因为当我滚动到顶部时,我只会得到几百个线程堆栈。我尝试使用该选项将结果写入文本文件,但这似乎只是写出缓冲区中的任何内容。有什么想法可以让windbg窗口缓冲区变得非常大,或者有任何其他技巧来寻找可能具有特定调用堆栈的线程?

【问题讨论】:

    标签: .net windbg sos sosex


    【解决方案1】:

    在任何命令之前使用 .logopen yourpath\foo.txt,windbg 会将所有内容记录在 txt 文件中

    0:000> .logopen d:\foo.txt
    Opened log file 'd:\foo.txt'
    
    0:000> ~* e kb
    RetAddr           : Args to Child                                                           : Call Site
    00007ff8`c4d3444f : 00000072`ece4d000 00007ff8`c4d8d4b0 00007ff8`c4d8d4b0 00007ff8`c4d8d4b0 : ntdll!LdrpDoDebuggerBreak+0x30
    xx
    RetAddr           : Args to Child                                                           : Call Site
    xx
    
    0:000> .logclose
    Closing open log file d:\foo.txt
    0:000> q
    
    cat d:\foo.txt
    Opened log file 'd:\foo.txt'
    
    0:000> ~* e kb
    RetAddr           : Args to Child                                                           : Call Site
    00007ff8`c4d3444f : 00000072`ece4d000 00007ff8`c4d8d4b0 00007ff8`c4d8d4b0 00007ff8`c4d8d4b0 : ntdll!LdrpDoDebuggerBreak+0x30
    
    cat d:\foo.txt | wc
         27     193    2736
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-26
      • 1970-01-01
      • 2014-01-20
      • 1970-01-01
      • 2017-11-27
      • 1970-01-01
      • 2013-08-23
      • 1970-01-01
      相关资源
      最近更新 更多