mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 20:03:33 +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;
|
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 );
|
ptr->setConstant( constVal );
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symScope, const std::string &symName );
|
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symScope, const std::string &symName );
|
||||||
|
|
||||||
static
|
static
|
||||||
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symScope, pyDia::SymbolPtr symChild );
|
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symScope, pyDia::SymbolPtr &symChild );
|
||||||
|
|
||||||
static
|
static
|
||||||
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symbol );
|
TypeInfoPtr getTypeInfo( pyDia::SymbolPtr &symbol );
|
||||||
|
@ -111,6 +111,11 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
self.assertEqual( 3, len( tvl ) )
|
self.assertEqual( 3, len( tvl ) )
|
||||||
self.assertEqual( [100,200,300], [ tv.num for tv in 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):
|
def testTypedVarArray(self):
|
||||||
tvl = target.module.typedVarArray( target.module.g_testArray, "structTest", 2 )
|
tvl = target.module.typedVarArray( target.module.g_testArray, "structTest", 2 )
|
||||||
self.assertEqual( 2, len( tvl ) )
|
self.assertEqual( 2, len( tvl ) )
|
||||||
|
@ -164,6 +164,25 @@ struct listStruct1 {
|
|||||||
struct listStruct1 *next;
|
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
|
class classWithDestructor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -315,6 +334,20 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
g_listItem11.next = &g_listItem12;
|
g_listItem11.next = &g_listItem12;
|
||||||
g_listItem12.next = &g_listItem13;
|
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
|
// Let test scripts to execute
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user