WinDBG Preview 版脚本

WinDBG Preview 支持用 JS 来写脚本。

之前弄过一套,虽然不能自动化调试,但是看信息,看数据什么的挺方便,

但是,脚本不见了。。。也没保存,也没入库。。。这里赶快保存一下。

没啥用的脚本,但是没准哪天用到了,还能想一想。

查看所有线程的调用栈信息。

确实就没啥用。

 1 "use strict";
 2 
 3 function initializeScript()
 4 {
 5     host.diagnostics.debugLog("***> initializeScript
");
 6     return [new host.apiVersionSupport(1, 7)];
 7 }
 8 
 9 function RunCommands(cmd)
10 {
11     var ctl = host.namespace.Debugger.Utility.Control;   
12     var output = ctl.ExecuteCommand(cmd);
13     host.diagnostics.debugLog("run> [" + cmd + "]
");
14     for (var line of output)
15     {
16         host.diagnostics.debugLog("     ", line, "
");
17     }
18     host.diagnostics.debugLog("
");
19 }
20 
21 function invokeScript()
22 {
23     //
24     // Insert your script content here.  This method will be called whenever the script is
25     // invoked from a client.
26     //
27     // See the following for more details:
28     //
29     //     https://aka.ms/JsDbgExt
30     //
31     host.diagnostics.debugLog("***> invokeScript
");
32 
33     var ctl = host.namespace.Debugger.Utility.Control;
34     for (var i=0;i<=28;i++)
35     {
36         var cmd = "~" + i.toString() + "s" + "; kv";
37         RunCommands(cmd);
38     }
39 }
原文地址:https://www.cnblogs.com/suanguade/p/15214010.html