2
我发现!findstack
只是可以用来过滤非托管代码,但它没有过滤托管代码,所以有没有任何等效的命令!findstack
过滤托管代码?是否有任何等价命令用于!findstack过滤托管代码?
我发现!findstack
只是可以用来过滤非托管代码,但它没有过滤托管代码,所以有没有任何等效的命令!findstack
过滤托管代码?是否有任何等价命令用于!findstack过滤托管代码?
我不知道这样一个现成的使用功能的,所以我在这里看到两个选项:
接近)
这可能类似于此:
~*e .foreach(word {!clrstack}) {.if ($spat("${word}", "?*RunMessageLoop?*") == 1) {.printf "Found!\n"}}
B方法)
把下列句子变成一个名为clrfindstack.py
from pykd import *
import sys
if len(sys.argv) == 1: # script name only
print "Please provide a search string as argument"
exit()
threads = getNumberThreads()
for thread in range(0, threads):
dbgCommand("~"+str(thread)+"s") # select the thread
stack = dbgCommand("!clrstack") # run !clrstack
if sys.argv[1] in stack: # [0] is the script name
print "Found", sys.argv[1], "in thread", thread, "(Use ~"+str(thread)+"s to select it)"
,然后运行它
0:000> !py c:\tmp\clrfindstack.py
Please provide a search string as argument
0:000> !py c:\tmp\clrfindstack.py RunMessageLoop
Found RunMessageLoop in thread 0 (Use ~0s to select it)
的实现可能不是很Python的,但确实它的工作。
太好了,谢谢托马斯。 – Jason