mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[0.2.x] added : test for sign bit fields
git-svn-id: https://pykd.svn.codeplex.com/svn@83599 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
d0234bcb4f
commit
c3bc370765
@ -78,11 +78,11 @@ class ModuleTest( unittest.TestCase ):
|
|||||||
fileName = pykd.getSourceFile(target.module.FuncWithName0 )
|
fileName = pykd.getSourceFile(target.module.FuncWithName0 )
|
||||||
self.assertTrue( re.search('targetapp\\.cpp', fileName ) )
|
self.assertTrue( re.search('targetapp\\.cpp', fileName ) )
|
||||||
fileName, lineNo, displacement = pykd.getSourceLine( target.module.FuncWithName0 + 2)
|
fileName, lineNo, displacement = pykd.getSourceLine( target.module.FuncWithName0 + 2)
|
||||||
self.assertEqual( 413, lineNo )
|
self.assertEqual( 421, lineNo )
|
||||||
self.assertTrue( re.search('targetapp\\.cpp', fileName ) )
|
self.assertTrue( re.search('targetapp\\.cpp', fileName ) )
|
||||||
self.assertEqual( 2, displacement )
|
self.assertEqual( 2, displacement )
|
||||||
fileName, lineNo, displacement = pykd.getSourceLine()
|
fileName, lineNo, displacement = pykd.getSourceLine()
|
||||||
self.assertEqual( 689, lineNo )
|
self.assertEqual( 698, lineNo )
|
||||||
|
|
||||||
def testEnumSymbols( self ):
|
def testEnumSymbols( self ):
|
||||||
lst = target.module.enumSymbols()
|
lst = target.module.enumSymbols()
|
||||||
|
@ -77,7 +77,5 @@ if __name__ == "__main__":
|
|||||||
target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]
|
target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]
|
||||||
|
|
||||||
unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( getTestSuite() )
|
unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( getTestSuite() )
|
||||||
|
|
||||||
#unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( getTestSuite("moduletest.ModuleTest.testFindSymbol") )
|
|
||||||
|
|
||||||
raw_input()
|
|
||||||
|
@ -141,6 +141,10 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
self.assertEqual( 4, tv.m_bit0_4 )
|
self.assertEqual( 4, tv.m_bit0_4 )
|
||||||
self.assertEqual( 1, tv.m_bit5 )
|
self.assertEqual( 1, tv.m_bit5 )
|
||||||
self.assertEqual( 3, tv.m_bit6_7 )
|
self.assertEqual( 3, tv.m_bit6_7 )
|
||||||
|
tv = target.module.typedVar("g_structWithSignBits")
|
||||||
|
self.assertEqual( 4, tv.m_bit0_4 )
|
||||||
|
self.assertEqual( -1, tv.m_bit5 )
|
||||||
|
self.assertEqual( -1, tv.m_bit6_7 )
|
||||||
|
|
||||||
def testTypedVarList(self):
|
def testTypedVarList(self):
|
||||||
tvl = target.module.typedVarList( target.module.g_listHead, "listStruct", "listEntry" )
|
tvl = target.module.typedVarList( target.module.g_listHead, "listStruct", "listEntry" )
|
||||||
|
@ -47,6 +47,13 @@ struct structWithBits {
|
|||||||
ULONG m_bit6_7 : 2;
|
ULONG m_bit6_7 : 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct structWitSignBits {
|
||||||
|
LONG m_bit0_4 : 5;
|
||||||
|
LONG m_bit5 : 1;
|
||||||
|
LONG m_bit6_7 : 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
union unionTest {
|
union unionTest {
|
||||||
ULONG m_value;
|
ULONG m_value;
|
||||||
@ -98,6 +105,7 @@ typedef struct structAbstract *pstructAbstract;
|
|||||||
pstructAbstract g_structAbstract = 0;
|
pstructAbstract g_structAbstract = 0;
|
||||||
|
|
||||||
structWithBits g_structWithBits = { 4, 1, 3};
|
structWithBits g_structWithBits = { 4, 1, 3};
|
||||||
|
structWitSignBits g_structWithSignBits = { 4, 1, 3 };
|
||||||
|
|
||||||
structTest g_structTest = { 0, 500, true, 1, NULL };
|
structTest g_structTest = { 0, 500, true, 1, NULL };
|
||||||
structTest g_structTest1 = { 0, 500, true, 1, &g_structTest };
|
structTest g_structTest1 = { 0, 500, true, 1, &g_structTest };
|
||||||
@ -450,6 +458,7 @@ void FuncWithName0()
|
|||||||
std::cout << (*ptrIntMatrix)[0][1];
|
std::cout << (*ptrIntMatrix)[0][1];
|
||||||
std::cout << g_struct3.m_noArrayField;
|
std::cout << g_struct3.m_noArrayField;
|
||||||
std::cout << g_structWithBits.m_bit5;
|
std::cout << g_structWithBits.m_bit5;
|
||||||
|
std::cout << g_structWithSignBits.m_bit5;
|
||||||
std::cout << ptrStrArray;
|
std::cout << ptrStrArray;
|
||||||
std::cout << g_structTest1.m_field2;
|
std::cout << g_structTest1.m_field2;
|
||||||
std::cout << ptrIntMatrix1;
|
std::cout << ptrIntMatrix1;
|
||||||
|
Loading…
Reference in New Issue
Block a user