mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 19:13:22 +08:00
[0.1.x] +unnamed struct test
git-svn-id: https://pykd.svn.codeplex.com/svn@73285 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
e8906c5d2c
commit
858c5f2492
@ -11,7 +11,7 @@ class TypedVarTest( unittest.TestCase ):
|
||||
def testCtor( self ):
|
||||
tv = target.module.typedVar( "structTest", target.module.g_structTest )
|
||||
tv = target.module.typedVar( "g_structTest" )
|
||||
|
||||
|
||||
def testBaseTypes(self):
|
||||
self.assertEqual( 1, target.module.typedVar( "g_ucharValue" ) )
|
||||
self.assertEqual( 2, target.module.typedVar( "g_ushortValue" ) )
|
||||
@ -21,8 +21,8 @@ class TypedVarTest( unittest.TestCase ):
|
||||
self.assertEqual( -2, target.module.typedVar( "g_shortValue" ) )
|
||||
self.assertEqual( -4, target.module.typedVar( "g_longValue" ) )
|
||||
self.assertEqual( -8, target.module.typedVar( "g_longlongValue" ) )
|
||||
|
||||
def testConst(self):
|
||||
|
||||
def testConst(self):
|
||||
try:
|
||||
self.assertEqual( True, target.module.typedVar( "g_constBoolValue" ) )
|
||||
except pykd.BaseException:
|
||||
@ -150,16 +150,21 @@ class TypedVarTest( unittest.TestCase ):
|
||||
self.assertEqual( 4, ind )
|
||||
self.assertTrue( ind in { 1 : "1", 4 : "2" } )
|
||||
self.assertEqual( "2", { 1 : "1", 4 : "2" }[ind] )
|
||||
|
||||
|
||||
def testDeref(self):
|
||||
tv = target.module.typedVar( "g_structTest1" )
|
||||
self.assertEqual( target.module.g_structTest, tv.m_field4.deref().getAddress() )
|
||||
|
||||
|
||||
tv = target.module.typedVar( "g_structTest" )
|
||||
self.assertEqual( 0, tv.m_field4.deref().getAddress() )
|
||||
|
||||
|
||||
try:
|
||||
tv.m_field1.deref()
|
||||
self.assertTrue(False)
|
||||
except pykd.BaseException:
|
||||
pass
|
||||
|
||||
def testUnNamedStruct(self):
|
||||
tv = target.module.typedVar( "g_unNamedStruct" )
|
||||
self.assertEqual( 4, tv.m_fieldNestedStruct )
|
||||
self.assertEqual( 5, tv.m_fieldOfUnNamed )
|
||||
|
@ -197,6 +197,13 @@ listStruct1 g_listItem11 = { 100 };
|
||||
listStruct1 g_listItem12 = { 200 };
|
||||
listStruct1 g_listItem13 = { 300 };
|
||||
|
||||
struct {
|
||||
struct {
|
||||
int m_fieldNestedStruct;
|
||||
};
|
||||
int m_fieldOfUnNamed;
|
||||
}g_unNamedStruct;
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -257,6 +264,7 @@ void FuncWithName0()
|
||||
std::cout << ptrIntMatrix1;
|
||||
std::cout << g_bigValue;
|
||||
std::cout << g_classChild.m_enumField;
|
||||
std::cout << g_unNamedStruct.m_fieldNestedStruct;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -274,6 +282,7 @@ void FuncWithName1(int a)
|
||||
std::cout << _structTest.m_field1;
|
||||
std::cout << _struct2.m_struct.m_field1;
|
||||
std::cout << g_string;
|
||||
std::cout << g_unNamedStruct.m_fieldOfUnNamed;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -318,6 +327,23 @@ int doLoadUnload()
|
||||
|
||||
return 0;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int doExeptions()
|
||||
{
|
||||
__debugbreak();
|
||||
|
||||
PUCHAR _ptr = reinterpret_cast<UCHAR *>(2);
|
||||
__try {
|
||||
*_ptr = 5;
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
}
|
||||
|
||||
++_ptr;
|
||||
*_ptr = 6;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -348,6 +374,9 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
g_childListEntry2.m_next = &g_childListEntry3;
|
||||
g_childListEntry3.m_next = NULL;
|
||||
|
||||
g_unNamedStruct.m_fieldNestedStruct = 4;
|
||||
g_unNamedStruct.m_fieldOfUnNamed = 5;
|
||||
|
||||
// Let test scripts to execute
|
||||
__debugbreak();
|
||||
|
||||
@ -363,6 +392,9 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
::EnumWindows(&EnumWindowsProc2, 7);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
if ( !_tcsicmp(argv[1], _T("-testExceptions")) )
|
||||
return doExeptions();
|
||||
}
|
||||
|
||||
__debugbreak();
|
||||
|
Loading…
Reference in New Issue
Block a user