mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 20:03:33 +08:00
[0.3.x] updated: tests
git-svn-id: https://pykd.svn.codeplex.com/svn@83865 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
e0fc219466
commit
fd0174d87c
@ -59,5 +59,15 @@ inline python::list loadDoubles( kdlib::MEMOFFSET_64 offset, unsigned long count
|
|||||||
return vectorToList( kdlib::loadDoubles( offset, count, phyAddr ) );
|
return vectorToList( kdlib::loadDoubles( offset, count, phyAddr ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline python::list loadPtrList( kdlib::MEMOFFSET_64 offset )
|
||||||
|
{
|
||||||
|
return vectorToList( kdlib::loadPtrList(offset) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline python::list loadPtrArray( kdlib::MEMOFFSET_64 offset, unsigned long count )
|
||||||
|
{
|
||||||
|
return vectorToList( kdlib::loadPtrs(offset, count) );
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace pykd
|
} // end namespace pykd
|
||||||
|
|
||||||
|
@ -229,10 +229,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
// "Return string represention of windows UNICODE_STRING type" );
|
// "Return string represention of windows UNICODE_STRING type" );
|
||||||
//python::def( "loadAnsiString", &loadAnsiStr,
|
//python::def( "loadAnsiString", &loadAnsiStr,
|
||||||
// "Return string represention of windows ANSI_STRING type" );
|
// "Return string represention of windows ANSI_STRING type" );
|
||||||
//python::def( "loadPtrList", &loadPtrList,
|
python::def( "loadPtrList", &loadPtrList,
|
||||||
// "Return list of pointers, each points to next" );
|
"Return list of pointers, each points to next" );
|
||||||
//python::def( "loadPtrs", &loadPtrArray,
|
python::def( "loadPtrs", &loadPtrArray,
|
||||||
// "Read the block of the target's memory and return it as a list of pointers" );
|
"Read the block of the target's memory and return it as a list of pointers" );
|
||||||
python::def( "loadFloats", &loadFloats, loadFloats_( python::args( "offset", "count", "phyAddr" ),
|
python::def( "loadFloats", &loadFloats, loadFloats_( python::args( "offset", "count", "phyAddr" ),
|
||||||
"Read the block of the target's memory and return it as list of floats" ) );
|
"Read the block of the target's memory and return it as list of floats" ) );
|
||||||
python::def( "loadDoubles", &loadDoubles, loadDoubles_( python::args( "offset", "count", "phyAddr" ),
|
python::def( "loadDoubles", &loadDoubles, loadDoubles_( python::args( "offset", "count", "phyAddr" ),
|
||||||
@ -458,8 +458,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
// "Add a new field to custom defined struct" )
|
// "Add a new field to custom defined struct" )
|
||||||
.def( "ptrTo", &kdlib::TypeInfo::ptrTo,
|
.def( "ptrTo", &kdlib::TypeInfo::ptrTo,
|
||||||
"Return pointer to the type" )
|
"Return pointer to the type" )
|
||||||
//.def( "arrayOf", &kdlib::TypeInfo::arrayOf,
|
.def( "arrayOf", &kdlib::TypeInfo::arrayOf,
|
||||||
// "Return array of the type" )
|
"Return array of the type" )
|
||||||
.def( "__str__", &TypeInfoAdapter::print,
|
.def( "__str__", &TypeInfoAdapter::print,
|
||||||
"Return typa as a printable string" )
|
"Return typa as a printable string" )
|
||||||
.def( "__getattr__", TypeInfoAdapter::getElementByName )
|
.def( "__getattr__", TypeInfoAdapter::getElementByName )
|
||||||
|
@ -22,14 +22,14 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
tv = pykd.typedVar( target.moduleName + "!g_structTest" )
|
tv = pykd.typedVar( target.moduleName + "!g_structTest" )
|
||||||
|
|
||||||
def testBaseTypes(self):
|
def testBaseTypes(self):
|
||||||
self.assertEqual( 1, target.module.typedVar( "ucharVar" ) )
|
self.assertEqual( 10, target.module.typedVar( "ucharVar" ) )
|
||||||
self.assertEqual( 2, target.module.typedVar( "ushortVar" ) )
|
self.assertEqual( 1020, target.module.typedVar( "ushortVar" ) )
|
||||||
self.assertEqual( 4, target.module.typedVar( "ulongVar" ) )
|
self.assertEqual( 10002000, target.module.typedVar( "ulongVar" ) )
|
||||||
self.assertEqual( 8, target.module.typedVar( "ulonglongVar" ) )
|
self.assertEqual( 1234567890, target.module.typedVar( "ulonglongVar" ) )
|
||||||
self.assertEqual( -1, target.module.typedVar( "charVar" ) )
|
self.assertEqual( -5, target.module.typedVar( "charVar" ) )
|
||||||
self.assertEqual( -2, target.module.typedVar( "shortVar" ) )
|
self.assertEqual( -1020, target.module.typedVar( "shortVar" ) )
|
||||||
self.assertEqual( -4, target.module.typedVar( "longVar" ) )
|
self.assertEqual( -1002000, target.module.typedVar( "longVar" ) )
|
||||||
self.assertEqual( -8, target.module.typedVar( "longlongVar" ) )
|
self.assertEqual( -1234567890, target.module.typedVar( "longlongVar" ) )
|
||||||
|
|
||||||
def testPtrTo(self):
|
def testPtrTo(self):
|
||||||
tvBaseType = pykd.typedVar( pykd.typeInfo("UInt8B").ptrTo(), target.module.offset("pbigValue") )
|
tvBaseType = pykd.typedVar( pykd.typeInfo("UInt8B").ptrTo(), target.module.offset("pbigValue") )
|
||||||
@ -272,8 +272,8 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
self.assertTrue( str(target.module.typedVar( "ptrIntMatrix" ) ) )
|
self.assertTrue( str(target.module.typedVar( "ptrIntMatrix" ) ) )
|
||||||
self.assertTrue( str(target.module.typedVar( "g_classChild" ) ) )
|
self.assertTrue( str(target.module.typedVar( "g_classChild" ) ) )
|
||||||
#self.assertTrue( str(target.module.typedVar( "g_struct3" ) ) )
|
#self.assertTrue( str(target.module.typedVar( "g_struct3" ) ) )
|
||||||
#self.assertTrue( str(target.module.typedVar( "g_listHead" ) ) )
|
self.assertTrue( str(target.module.typedVar( "g_listHead" ) ) )
|
||||||
#self.assertTrue( str(target.module.typedVar( "g_voidPtr" ) ) )
|
self.assertTrue( str(target.module.typedVar( "voidPtr" ) ) )
|
||||||
#self.assertTrue( str(target.module.typedVar( "g_arrOfPtrToFunc" ) ) )
|
#self.assertTrue( str(target.module.typedVar( "g_arrOfPtrToFunc" ) ) )
|
||||||
#self.assertTrue( str(target.module.typedVar( "g_unTypedPtrToFunction" ) ) )
|
#self.assertTrue( str(target.module.typedVar( "g_unTypedPtrToFunction" ) ) )
|
||||||
|
|
||||||
|
@ -120,13 +120,13 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
self.assertEqual( pykd.ptrSize(), target.module.type("structTest**").size() )
|
self.assertEqual( pykd.ptrSize(), target.module.type("structTest**").size() )
|
||||||
self.assertEqual( pykd.sizeof("structTest"), target.module.type("structTest").size() )
|
self.assertEqual( pykd.sizeof("structTest"), target.module.type("structTest").size() )
|
||||||
self.assertEqual( pykd.sizeof("structTest**"), target.module.type("structTest**").size() )
|
self.assertEqual( pykd.sizeof("structTest**"), target.module.type("structTest**").size() )
|
||||||
self.assertEqual( pykd.sizeof("Int1B"), target.module.type("Int1B").size() )
|
self.assertEqual( pykd.sizeof("Int1B"), pykd.typeInfo("Int1B").size() )
|
||||||
|
|
||||||
def testBitField( self ):
|
def testBitField( self ):
|
||||||
ti = target.module.type( "g_structWithBits" )
|
ti = target.module.type( "g_structWithBits" )
|
||||||
self.assertEqual( 0, ti.fieldOffset("m_bit6_8") )
|
self.assertEqual( 0, ti.fieldOffset("m_bit6_8") )
|
||||||
self.assertEqual( 4, ti.m_bit6_8.size() )
|
self.assertEqual( 4, ti.m_bit6_8.size() )
|
||||||
self.assertEqual( "ULong:3", ti.m_bit6_8.name() )
|
self.assertEqual( "UInt4B:3", ti.m_bit6_8.name() )
|
||||||
self.assertEqual( 3, ti.m_bit6_8.bitWidth() )
|
self.assertEqual( 3, ti.m_bit6_8.bitWidth() )
|
||||||
self.assertEqual( 6, ti.m_bit6_8.bitOffset() )
|
self.assertEqual( 6, ti.m_bit6_8.bitOffset() )
|
||||||
|
|
||||||
@ -139,12 +139,13 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
self.assertEqual( "enumType", ti.m_enumField.name() )
|
self.assertEqual( "enumType", ti.m_enumField.name() )
|
||||||
|
|
||||||
def testPtr(self):
|
def testPtr(self):
|
||||||
self.assertEqual( "listStruct1*", target.module.type( "g_listHead1" ).name() )
|
self.assertEqual( "ULongLong*", target.module.type( "pbigValue" ).name() )
|
||||||
self.assertEqual( "listStruct1*[2]", target.module.type( "g_arrOfListStruct1" ).name())
|
self.assertEqual( "testStruct*", target.module.type( "testStruct*" ).name() )
|
||||||
self.assertEqual( "Void*", target.module.type( "g_voidPtr" ).name() )
|
self.assertEqual( "UShort*", target.module.type( "UShort*" ).name() )
|
||||||
self.assertEqual( "Void*[3]", target.module.type( "g_arrOfVoidPtr" ).name())
|
self.assertEqual( "Void*", target.module.type( "voidPtr" ).name() )
|
||||||
self.assertEqual( "<function>*", target.module.type( "g_ptrToFunction" ).name())
|
self.assertEqual( "Void*[3]", target.module.type( "voidPtrArray" ).name())
|
||||||
self.assertEqual( "<function>*[4]", target.module.type( "g_arrOfPtrToFunc" ).name())
|
#self.assertEqual( "<function>*", target.module.type( "g_ptrToFunction" ).name())
|
||||||
|
#self.assertEqual( "<function>*[4]", target.module.type( "g_arrOfPtrToFunc" ).name())
|
||||||
|
|
||||||
def testUnion(self):
|
def testUnion(self):
|
||||||
ti = target.module.type("unionTest")
|
ti = target.module.type("unionTest")
|
||||||
|
Loading…
Reference in New Issue
Block a user