mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 19:53:22 +08:00
33 lines
992 B
Python
33 lines
992 B
Python
import unittest
|
|
import pykd
|
|
import target
|
|
|
|
class StackTest(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.processId = pykd.startProcess( target.appPath + " stacktest" )
|
|
pykd.go() # skip initial breakpoint
|
|
|
|
def tearDown(self):
|
|
pykd.killProcess( self.processId )
|
|
|
|
def testGetStack(self):
|
|
|
|
expectedStack = [ 'targetapp!stackTestRun2',
|
|
'targetapp!stackTestRun1',
|
|
'targetapp!stackTestRun',
|
|
'targetapp!wmain',
|
|
'targetapp!__tmainCRTStartup',
|
|
'targetapp!wmainCRTStartup',
|
|
'kernel32!BaseThreadInitThunk',
|
|
'ntdll!RtlUserThreadStart' ]
|
|
|
|
realStack = []
|
|
for frame in pykd.getStack():
|
|
moduleName, symbolName, disp = pykd.findSymbolAndDisp( frame.ip )
|
|
realStack.append( "%s!%s" % ( moduleName, symbolName ) )
|
|
|
|
self.assertEqual( expectedStack, realStack )
|
|
|
|
|