mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 19:13:22 +08:00
[0.2.x] added: typeInfo::arrayOf method ( contruct array type )
git-svn-id: https://pykd.svn.codeplex.com/svn@82052 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
a1d8e1b42a
commit
0a9c658da6
@ -2,7 +2,7 @@
|
||||
#define PYKD_VERSION_MAJOR 0
|
||||
#define PYKD_VERSION_MINOR 2
|
||||
#define PYKD_VERSION_SUBVERSION 0
|
||||
#define PYKD_VERSION_BUILDNO 10
|
||||
#define PYKD_VERSION_BUILDNO 11
|
||||
|
||||
|
||||
#define __VER_STR2__(x) #x
|
||||
|
@ -410,6 +410,7 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
.def( "deref", &TypeInfo::deref )
|
||||
.def( "append", &TypeInfo::appendField )
|
||||
.def( "ptrTo", &TypeInfo::ptrTo )
|
||||
.def( "arrayOf", &TypeInfo::arrayOf )
|
||||
.def( "__str__", &TypeInfo::print )
|
||||
.def( "__getattr__", &TypeInfo::getField )
|
||||
.def("__len__", &TypeInfo::getElementCount )
|
||||
|
@ -609,6 +609,13 @@ TypeInfoPtr TypeInfo::ptrTo()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TypeInfoPtr TypeInfo::arrayOf( ULONG count )
|
||||
{
|
||||
return TypeInfoPtr( new ArrayTypeInfo(shared_from_this(), count ) );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string UdtTypeInfoBase::print()
|
||||
{
|
||||
std::stringstream sstr;
|
||||
|
@ -201,6 +201,8 @@ public:
|
||||
|
||||
TypeInfoPtr ptrTo();
|
||||
|
||||
TypeInfoPtr arrayOf( ULONG count );
|
||||
|
||||
virtual ULONG getAlignReq() {
|
||||
return 1;
|
||||
}
|
||||
|
@ -482,10 +482,10 @@ std::string getModuleSymbolFileName( ULONG64 baseOffset )
|
||||
|
||||
if (!*moduleInfo.LoadedPdbName)
|
||||
{
|
||||
std::wstring param = L"/f ";
|
||||
param += moduleInfo.ImageName;
|
||||
std::wstringstream sstr;
|
||||
sstr << L"/f \"" << moduleInfo.ImageName << L"\"";
|
||||
|
||||
hres = g_dbgEng->symbols->ReloadWide( param.c_str() );
|
||||
hres = g_dbgEng->symbols->ReloadWide( sstr.str().c_str() );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException("IDebugSymbols::Reload failed" );
|
||||
|
||||
|
@ -46,6 +46,17 @@ class TypedVarTest( unittest.TestCase ):
|
||||
customStructTest.append("m_field1", pykd.typeInfo("UInt8B"))
|
||||
tvCustomStruct = pykd.typedVar( customStructTest.ptrTo(), target.module.offset("g_structTestPtr") )
|
||||
self.assertEqual( 500, tvCustomStruct.deref().m_field1 )
|
||||
|
||||
def testArrayOf(self):
|
||||
arrayType = pykd.typeInfo("UInt8B").arrayOf(5)
|
||||
arrayVar = pykd.typedVar( arrayType, target.module.offset("ulonglongArray") )
|
||||
self.assertEqual( 0xFF, arrayVar[1] )
|
||||
self.assertEqual( 0xFFFFFFFFFFFFFFFF, arrayVar[4] )
|
||||
|
||||
arrayStructType = pykd.typeInfo("structTest").arrayOf(2)
|
||||
arrayStructVar = pykd.typedVar( arrayStructType, target.module.offset("g_testArray") )
|
||||
self.assertEqual( True, arrayStructVar[0].m_field2 )
|
||||
self.assertEqual( 1, arrayStructVar[1].m_field3 )
|
||||
|
||||
def testConst(self):
|
||||
self.assertEqual( True, target.module.typedVar( "g_constBoolValue" ) )
|
||||
|
@ -221,4 +221,11 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
entry = pykd.typedVar("entry1").Flink
|
||||
self.assertEqual( "_LIST_ENTRY*", entry.type().name() )
|
||||
|
||||
def testPtrTo(self):
|
||||
ti = pykd.typeInfo("UInt8B").ptrTo()
|
||||
self.assertTrue( "UInt8B*", ti.name() )
|
||||
|
||||
def testArrayOf(self):
|
||||
ti = pykd.typeInfo("UInt8B").arrayOf(10)
|
||||
self.assertTrue( "UInt8B[10]", ti.name() )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user