pykd/samples/stacks.py
2010-11-26 14:03:25 +00:00

32 lines
710 B
Python

import sys
from pykd import *
def printStack():
threadList = getThreadList()
oldMode = getProcessorMode()
if oldMode == "X64" and loadModule( "wow64" ) != None:
setProcessorMode("X86")
for threadPtr in threadList:
setImplicitThread( threadPtr )
stackFrames = getCurrentStack()
for frame in stackFrames: dprintln( findSymbol( frame.instructionOffset ) + " (%x)" % frame.instructionOffset )
dprintln("")
setProcessorMode(oldMode)
if __name__ == "__main__":
if not isSessionStart():
createSession()
loadDump( sys.argv[1] )
dprintln( sys.argv[1] + " - loaded OK" )
printStack()