mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.1.x] fixed : issue #10338 ( print typeInfo raises TypeException )
git-svn-id: https://pykd.svn.codeplex.com/svn@74920 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
0beb496d8d
commit
25d2e5ef59
@ -513,10 +513,11 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
.def( "bitOffset", &TypeInfo::getBitOffset )
|
.def( "bitOffset", &TypeInfo::getBitOffset )
|
||||||
.def( "bitWidth", &TypeInfo::getBitWidth )
|
.def( "bitWidth", &TypeInfo::getBitWidth )
|
||||||
.def( "field", &TypeInfo::getField )
|
.def( "field", &TypeInfo::getField )
|
||||||
.def( "__getattr__", &TypeInfo::getField )
|
|
||||||
.def( "asMap", &TypeInfo::asMap )
|
.def( "asMap", &TypeInfo::asMap )
|
||||||
.def( "deref", &TypeInfo::deref );
|
.def( "deref", &TypeInfo::deref )
|
||||||
|
.def( "__str__", &TypeInfo::print )
|
||||||
|
.def( "__getattr__", &TypeInfo::getField );
|
||||||
|
|
||||||
python::class_<TypedVar, TypedVarPtr, python::bases<intBase>, boost::noncopyable >("typedVar",
|
python::class_<TypedVar, TypedVarPtr, python::bases<intBase>, boost::noncopyable >("typedVar",
|
||||||
"Class of non-primitive type object, child class of typeClass. Data from target is copied into object instance",
|
"Class of non-primitive type object, child class of typeClass. Data from target is copied into object instance",
|
||||||
python::no_init )
|
python::no_init )
|
||||||
|
@ -35,6 +35,13 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual std::string print() {
|
||||||
|
std::stringstream sstr;
|
||||||
|
sstr << "Type name: " << getName();
|
||||||
|
sstr << " Size: 0x" << std::hex << getSize() << " (" << std::dec << getSize() << ")";
|
||||||
|
return sstr.str();
|
||||||
|
}
|
||||||
|
|
||||||
virtual std::string getName() = 0;
|
virtual std::string getName() = 0;
|
||||||
|
|
||||||
virtual ULONG getSize() = 0;
|
virtual ULONG getSize() = 0;
|
||||||
|
@ -147,3 +147,25 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
|
|
||||||
ti = target.module.type("StructWithNested::Nested")
|
ti = target.module.type("StructWithNested::Nested")
|
||||||
self.assertTrue( hasattr( ti, "m_nestedFiled" ) )
|
self.assertTrue( hasattr( ti, "m_nestedFiled" ) )
|
||||||
|
|
||||||
|
def testPrint(self):
|
||||||
|
self.assertTrue( str(target.module.type( "g_ucharValue" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_ushortValue" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_ulongValue" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_ulonglongValue" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_structWithBits" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_structTest" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_structTest1" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_testArray" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_structTestPtr" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_structTestPtrPtr" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "longlongArray" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "intMatrix4" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "ptrIntMatrix" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_classChild" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_struct3" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_listHead" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_voidPtr" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_arrOfPtrToFunc" ) ) )
|
||||||
|
self.assertTrue( str(target.module.type( "g_unTypedPtrToFunction" ) ) )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user