Windows内核调试Devstudio的Spindump



因此,当遇到僵局,静置误,锁反转等时,spindump工具非常有用。它只是转储系统上的线程堆栈(userland和bernel(,并且对阻止哪些线程的线程相当可见。

现在使用Devstudio在第二VM上进行内核调试,我遇到了僵局。我看到我可以使用"!进程0 0"来倾倒所有进程。而且我相信我可以切换到一个过程,然后倾倒线程(?(,然后选择一个带有"!thread"one_answers" k"的线程以查看堆栈。但是实际上有数千个线程,肯定有一种方法可以将它们全部丢弃而无需手动做吗?

"!进程0 7"运行约40分钟,并且设置一个堆栈中没有我的功能。

大棘发出看起来像 Thread 0x8ab 1000 samples (1-1000) priority 81 (base 81) *1000 call_continuation + 23 (kernel.development + 1927415) *1000 arc_reclaim_thread + 2391 (arc.c:5095,11 in zfs + 131367) *1000 cv_timedwait_hires + 206 (spl-condvar.c:172,14 in spl + 8125) *1000 msleep + 98 (kernel.development + 7434066) *1000 _sleep + 219 (kernel.development + 7432603) *1000 lck_mtx_sleep_deadline + 147 (kernel.development + 2362339) *1000 thread_block_reason + 286 (kernel.development + 2407438)

那里没有什么神奇的,只是它通过所有线程迭代。

用0,1,2

使用!

引用了windbg chm文件

The !stacks extension gives a brief summary of the state of every thread. You   
can use this extension instead of the !process extension to get a quick overview    
of the system, especially when debugging multithread issues such as resource    
conflicts or deadlocks.
The !findstack user-mode extension also displays information about particular stacks.
Here is an example of the simplest !stacks display:
kd> !stacks 0
Proc.Thread  .Thread  ThreadState  Blocker
                                     [System]
   4.000050  827eea10  Blocked    +0xfe0343a5
                                     [smss.exe]
                                     [csrss.exe]
  b0.0000a8  82723b70  Blocked    ntoskrnl!_KiSystemService+0xc4
  b0.0000c8  82719620  Blocked    ntoskrnl!_KiSystemService+0xc4
  b0.0000d0  827d5d50  Blocked    ntoskrnl!_KiSystemService+0xc4
.....

编辑

!堆栈是一个耗时的操作速度相对于使用的运输
VM到VM有自己的开销与Net调试或一个物理机器的物理连接或1394在胜利10上的安静比COM端口或带有115200 Baudrate的管道更快

我不确定您的VM是什么,但是如果您在Vbox上,则可以尝试VMKD

任何回答您的评论的方法

您可以运行以登录并抓取输出

.logopen z: foo.txt;!堆栈0;.logclose

将在所需路径中打开日志文件,然后将所有输出重定向到日志文件,然后关闭日志文件,一旦命令完成

也要牢记!堆栈接受通配符滤清器字符串,因此只能堆叠带有您知道可以过滤的符号

喜欢

kd> .logopen c:stacks.txt ; !stacks 0  Etw; .logclose
Opened log file 'c:stacks.txt'
Proc.Thread  .Thread  Ticks   ThreadState Blocker
Max cache size is       : 1048576 bytes (0x400 KB) 
Total memory in cache   : 0 bytes (0 KB) 
Number of regions cached: 0
0 full reads broken into 0 partial reads
    counts: 0 cached/0 uncached, 0.00% cached
    bytes : 0 cached/0 uncached, 0.00% cached
** Prototype PTEs are implicitly decoded
                            [82965600 Idle]
                            [840dcc40 System]
   4.000078  8410ed48 0000081 Blocked    nt!EtwpLogger+0xd0
   4.000080  8410e4d8 0000081 Blocked    nt!EtwpLogger+0xd0
   4.000084  84142020 0000081 Blocked    nt!EtwpLogger+0xd0
   4.000088  84142d48 0000081 Blocked    nt!EtwpLogger+0xd0
   4.000090  8416c630 000001d Blocked    nt!EtwpLogger+0xd0
   4.000094  8496ea88 0000bf3 Blocked    nt!EtwpLogger+0xd0
   4.0000a0  84079a88 000004a Blocked    nt!EtwpLogger+0xd0
   4.000194  85144d48 000445c Blocked    nt!EtwpLogger+0xd0
   4.000308  851b9d48 0004035 Blocked    nt!EtwpLogger+0xd0
   4.00032c  851d3d48 0002d48 Blocked    nt!EtwpLogger+0xd0
   4.00034c  852e8d48 0003e4a Blocked    nt!EtwpLogger+0xd0
   4.000350  84973d48 0003df4 Blocked    nt!EtwpLogger+0xd0
   4.000354  84f0dd48 0003de4 Blocked    nt!EtwpLogger+0xd0
   4.000444  854c7970 0002158 Blocked    nt!EtwpLogger+0xd0
                            [84f0b930 smss.exe]
                            [8409eb38 csrss.exe]
                            [84f34d40 wininit.exe]
                            [84f4d030 csrss.exe]
                            [850f8d40 winlogon.exe]
                            [8515bb38 services.exe]
                            [85161d40 lsass.exe]
                            [85163d40 lsm.exe]

最新更新