mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.3.x] restored tests of synthetic symbols
git-svn-id: https://pykd.svn.codeplex.com/svn@90487 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
b8828155e0
commit
4caa408721
@ -18,7 +18,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
int a;
|
||||
volatile int a;
|
||||
a = 10;
|
||||
break;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import mspdbtest
|
||||
import excepttest
|
||||
import targetprocess
|
||||
import ehloadtest
|
||||
import synsymtest
|
||||
|
||||
pykd.initialize()
|
||||
|
||||
@ -55,6 +56,7 @@ def getTestSuite( singleName = "" ):
|
||||
unittest.TestLoader().loadTestsFromTestCase( typedvar.TypedVarTest ),
|
||||
#unittest.TestLoader().loadTestsFromTestCase( regtest.CpuRegTest ),
|
||||
unittest.TestLoader().loadTestsFromTestCase( customtypestest.CustomTypesTest ),
|
||||
unittest.TestLoader().loadTestsFromTestCase( synsymtest.SynSymTest ),
|
||||
# ^^^
|
||||
unittest.TestLoader().loadTestsFromTestCase( TerminateProcessTest ),
|
||||
|
||||
|
@ -9,73 +9,22 @@ class SynSymTest(unittest.TestCase):
|
||||
|
||||
def testAdd(self):
|
||||
"""Add new synthetic symbol"""
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-1, 1, "synSym1")
|
||||
self.assertEqual(
|
||||
target.module.offset("FuncWithName0")-1,
|
||||
target.module.offset("synSym1"))
|
||||
_addr = target.module.offset("FuncTestClass::staticMethod") - 1
|
||||
|
||||
pykd.addSyntheticSymbol(_addr, 1, "synSym1")
|
||||
self.assertEqual(target.module.synSym1, _addr)
|
||||
|
||||
self.assertRaises( pykd.DbgException, pykd.addSyntheticSymbol, _addr, 1, "synSym1" )
|
||||
|
||||
def testDel(self):
|
||||
"""Remove synthetic symbol"""
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-2, 1, "synSym2")
|
||||
self.assertEqual(
|
||||
pykd.delSynSymbol( target.module.offset("synSym2") ), 1 )
|
||||
_addr = target.module.offset("FuncTestClass::staticMethod") - 2
|
||||
|
||||
exceptionOccurred = True
|
||||
try:
|
||||
target.module.rva("synSym2")
|
||||
exceptionOccurred = False
|
||||
except pykd.BaseException:
|
||||
pass
|
||||
self.assertTrue(exceptionOccurred)
|
||||
_synsym = pykd.addSyntheticSymbol(_addr, 1, "synSym2")
|
||||
self.assertEqual(target.module.synSym2, _addr)
|
||||
|
||||
def testDelAll(self):
|
||||
"""Remove all synthetic symbols"""
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-3, 1, "synSym3")
|
||||
pykd.delAllSynSymbols()
|
||||
pykd.removeSyntheticSymbol(_synsym)
|
||||
|
||||
exceptionOccurred = True
|
||||
try:
|
||||
target.module.rva("synSym3")
|
||||
exceptionOccurred = False
|
||||
except pykd.BaseException:
|
||||
pass
|
||||
self.assertTrue(exceptionOccurred)
|
||||
self.assertRaises( pykd.DbgException, target.module.offset, "synSym2" )
|
||||
|
||||
def testDelByMask(self):
|
||||
"""Remove synthetic symbol by mask"""
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-4, 1, "synSym4")
|
||||
self.assertTrue( pykd.delSynSymbolsMask( "*", "synSym4" ) >= 1 )
|
||||
|
||||
exceptionOccurred = True
|
||||
try:
|
||||
target.module.rva("synSym4")
|
||||
exceptionOccurred = False
|
||||
except pykd.BaseException:
|
||||
pass
|
||||
self.assertTrue(exceptionOccurred)
|
||||
|
||||
def testReload(self):
|
||||
"""Restore synthetic symbols after reload module symbols"""
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-5, 1, "synSym5")
|
||||
target.module.reload()
|
||||
self.assertEqual(
|
||||
target.module.offset("FuncWithName0")-5,
|
||||
target.module.offset("synSym5"))
|
||||
|
||||
def testAddSynSymbolException(self):
|
||||
"""Test of AddSynSymbolException"""
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-6, 1, "synSym6")
|
||||
|
||||
exceptionOccurred = False
|
||||
try:
|
||||
pykd.addSynSymbol(
|
||||
target.module.offset("FuncWithName0")-6, 1, "synSym7")
|
||||
except pykd.AddSynSymbolException:
|
||||
exceptionOccurred = True
|
||||
self.assertTrue(exceptionOccurred)
|
||||
self.assertRaises( pykd.DbgException, pykd.removeSyntheticSymbol, _synsym )
|
||||
|
Loading…
Reference in New Issue
Block a user