forked from TimMisiak/WinDbgCookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstackCollector.js
47 lines (40 loc) · 884 Bytes
/
stackCollector.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"use strict";
function initializeScript()
{
return [new host.apiVersionSupport(1, 7)];
}
class StackEntry
{
constructor(name)
{
this.__name = name;
this.__count = 0;
}
getOrCreateChild(name)
{
if (!(name in this))
{
this[name] = new StackEntry(name);
}
return this[name];
}
toString()
{
return this.__name + " - " + this.__count;
}
}
var stackRoot = new StackEntry();
function onBreakpoint()
{
var node = stackRoot;
for (var frame of host.namespace.Debugger.State.DebuggerVariables.curstack.Frames)
{
var funcName = frame.toString().split("+")[0].trim();
node = node.getOrCreateChild(funcName);
node.__count++;
}
}
function resetStackTraces()
{
stackRoot = new StackEntry();
}