mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.3.x] added : method 'typeInfo.method' ( return method's type by name )
git-svn-id: https://pykd.svn.codeplex.com/svn@91073 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
be9f1420ec
commit
1d4c95497e
@ -846,6 +846,12 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return name of struct field by index" )
|
||||
.def( "fields", TypeInfoAdapter::getFields,
|
||||
"Return list of tuple ( filedName, fieldType )" )
|
||||
.def( "getNumberMethods", TypeInfoAdapter::getMethodsCount,
|
||||
"Return number of methods" )
|
||||
.def( "method", TypeInfoAdapter::getMethodByName,
|
||||
"Return method's type by name")
|
||||
.def( "method", TypeInfoAdapter::getMethodByIndex,
|
||||
"Return method's by index")
|
||||
.def( "deref", TypeInfoAdapter::deref,
|
||||
"Return type of pointer" )
|
||||
.def( "append", TypeInfoAdapter::appendField,
|
||||
|
@ -145,6 +145,24 @@ struct TypeInfoAdapter : public kdlib::TypeInfo {
|
||||
return typeInfo.getElement(index);
|
||||
}
|
||||
|
||||
static size_t getMethodsCount( kdlib::TypeInfo &typeInfo )
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return typeInfo.getMethodsCount();
|
||||
}
|
||||
|
||||
static kdlib::TypeInfoPtr getMethodByName( kdlib::TypeInfo &typeInfo, const std::wstring& methodName)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return typeInfo.getMethod(methodName);
|
||||
}
|
||||
|
||||
static kdlib::TypeInfoPtr getMethodByIndex( kdlib::TypeInfo &typeInfo, size_t index )
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return typeInfo.getMethod(index);
|
||||
}
|
||||
|
||||
static kdlib::TypeInfoPtr ptrTo( kdlib::TypeInfo &typeInfo, size_t ptrSize = 0 )
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
|
@ -325,6 +325,12 @@ class TypeInfoTest( unittest.TestCase ):
|
||||
lst = target.module.enumTypes("NonExsistType")
|
||||
self.assertEqual([],lst)
|
||||
|
||||
|
||||
def testArrayOverflow(self):
|
||||
self.assertRaises(pykd.TypeException, pykd.baseTypes.UInt8B.arrayOf, 0xFFFFFFFFFFFFFFFF)
|
||||
|
||||
def testMethodCount(self):
|
||||
self.assertEqual( 8, target.module.type("classChild").getNumberMethods() )
|
||||
|
||||
def testGetMethod(self):
|
||||
self.assertEqual( "Int4B(__thiscall classChild::)(Int4B)", target.module.type("classChild").method("childMethod").name() )
|
||||
self.assertEqual( "Int4B(__thiscall classChild::)(Int4B)", target.module.type("classChild").method(1).name() )
|
||||
|
Loading…
Reference in New Issue
Block a user