[0.2.x] added: method deref() may be skip ( struct.field1.deref().field2 -> struct.field1.field2 )

git-svn-id: https://pykd.svn.codeplex.com/svn@82220 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-01-10 06:34:58 +00:00 committed by Mikhail I. Izmestev
parent f2daca89fc
commit 14e20d47f2
3 changed files with 15 additions and 1 deletions

View File

@ -199,6 +199,14 @@ TypedVarPtr PtrTypedVar::deref()
///////////////////////////////////////////////////////////////////////////////////
TypedVarPtr PtrTypedVar::getField( const std::string &fieldName )
{
TypedVarPtr derefPtr = deref();
return derefPtr->getField( fieldName );
}
///////////////////////////////////////////////////////////////////////////////////
std::string PtrTypedVar::print()
{
std::stringstream sstr;

View File

@ -134,6 +134,8 @@ public:
virtual BaseTypeVariant getValue();
virtual TypedVarPtr getField( const std::string &fieldName );
};
///////////////////////////////////////////////////////////////////////////////////

View File

@ -219,6 +219,10 @@ class TypedVarTest( unittest.TestCase ):
self.assertTrue(False)
except pykd.BaseException:
pass
def testSkipDeref(self):
tv = target.module.typedVar( "g_structTest1" )
self.assertEqual( tv.m_field4.deref().m_field1, tv.m_field4.m_field1 )
def testUnNamedStruct(self):
tv = target.module.typedVar( "g_unNamedStruct" )
@ -267,7 +271,7 @@ class TypedVarTest( unittest.TestCase ):
self.assertTrue( str(target.module.typedVar( "g_unTypedPtrToFunction" ) ) )
def testNotValidPrint(self):
types = ("structTest", ) #, "ULong[100]", "Ulong*" )
types = ("structTest", "ULong[100]", "ULong*" )
for ti in types:
self.assertTrue( str(pykd.typedVar( target.module.type(ti), 0 ) ) )