mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[0.1.x] ~[wi:10168]: tests
git-svn-id: https://pykd.svn.codeplex.com/svn@73278 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
15b5736adf
commit
e8906c5d2c
@ -88,25 +88,27 @@ TypeInfoPtr TypeInfo::getTypeInfo( pyDia::SymbolPtr &symScope, const std::strin
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TypeInfoPtr TypeInfo::getTypeInfo( pyDia::SymbolPtr &symScope, pyDia::SymbolPtr symChild )
|
||||
TypeInfoPtr TypeInfo::getTypeInfo( pyDia::SymbolPtr &symScope, pyDia::SymbolPtr &symChild )
|
||||
{
|
||||
CComVariant constVal;
|
||||
if ( symChild->getSymTag() == SymTagData )
|
||||
|
||||
pyDia::SymbolPtr symType = symChild;
|
||||
if ( symType->getSymTag() == SymTagData )
|
||||
{
|
||||
if ( symChild->getLocType() == LocIsBitField )
|
||||
if ( symType->getLocType() == LocIsBitField )
|
||||
{
|
||||
return TypeInfoPtr( new BitFieldTypeInfo(symChild) );
|
||||
return TypeInfoPtr( new BitFieldTypeInfo(symType) );
|
||||
}
|
||||
|
||||
if ( symChild->getDataKind() == DataIsConstant )
|
||||
if ( symType->getDataKind() == DataIsConstant )
|
||||
{
|
||||
symChild->getValue( constVal );
|
||||
symType->getValue( constVal );
|
||||
}
|
||||
|
||||
symChild = symChild->getType();
|
||||
symType = symType->getType();
|
||||
}
|
||||
|
||||
TypeInfoPtr ptr = getTypeInfo( symChild );
|
||||
TypeInfoPtr ptr = getTypeInfo( symType );
|
||||
|
||||
ptr->setConstant( constVal );
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symScope, const std::string &symName );
|
||||
|
||||
static
|
||||
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symScope, pyDia::SymbolPtr symChild );
|
||||
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symScope, pyDia::SymbolPtr &symChild );
|
||||
|
||||
static
|
||||
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symbol );
|
||||
|
@ -111,6 +111,11 @@ class TypedVarTest( unittest.TestCase ):
|
||||
self.assertEqual( 3, len( tvl ) )
|
||||
self.assertEqual( [100,200,300], [ tv.num for tv in tvl ] )
|
||||
|
||||
tvl = target.module.typedVarList( target.module.g_childListHead, target.module.type("ChildEntryTest"), "m_next" )
|
||||
self.assertEqual( 3, len( tvl ) )
|
||||
self.assertEqual( [1000,2000,3000], [ tv.m_someBaseFiled2 for tv in tvl ] )
|
||||
self.assertEqual( [1001,2001,3001], [ tv.m_childFiled1 for tv in tvl ] )
|
||||
|
||||
def testTypedVarArray(self):
|
||||
tvl = target.module.typedVarArray( target.module.g_testArray, "structTest", 2 )
|
||||
self.assertEqual( 2, len( tvl ) )
|
||||
|
@ -164,6 +164,25 @@ struct listStruct1 {
|
||||
struct listStruct1 *next;
|
||||
};
|
||||
|
||||
|
||||
struct SomeBaseClassWithFields {
|
||||
int m_someBaseFiled1;
|
||||
int m_someBaseFiled2;
|
||||
};
|
||||
|
||||
struct BaseEntryStruct {
|
||||
BaseEntryStruct *m_next;
|
||||
};
|
||||
|
||||
struct ChildEntryTest : SomeBaseClassWithFields, BaseEntryStruct {
|
||||
int m_childFiled1;
|
||||
};
|
||||
|
||||
BaseEntryStruct *g_childListHead = NULL;
|
||||
ChildEntryTest g_childListEntry1;
|
||||
ChildEntryTest g_childListEntry2;
|
||||
ChildEntryTest g_childListEntry3;
|
||||
|
||||
class classWithDestructor
|
||||
{
|
||||
public:
|
||||
@ -315,6 +334,20 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
g_listItem11.next = &g_listItem12;
|
||||
g_listItem12.next = &g_listItem13;
|
||||
|
||||
g_childListEntry1.m_someBaseFiled2 = 1000;
|
||||
g_childListEntry1.m_childFiled1 = 1001;
|
||||
|
||||
g_childListEntry2.m_someBaseFiled2 = 2000;
|
||||
g_childListEntry2.m_childFiled1 = 2001;
|
||||
|
||||
g_childListEntry3.m_someBaseFiled2 = 3000;
|
||||
g_childListEntry3.m_childFiled1 = 3001;
|
||||
|
||||
g_childListHead = &g_childListEntry1;
|
||||
g_childListEntry1.m_next = &g_childListEntry2;
|
||||
g_childListEntry2.m_next = &g_childListEntry3;
|
||||
g_childListEntry3.m_next = NULL;
|
||||
|
||||
// Let test scripts to execute
|
||||
__debugbreak();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user