[0.3.x] added : typedVar constructor allowing to set function prototype to work with overloaded functions

git-svn-id: https://pykd.svn.codeplex.com/svn@91106 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\ussrhero_cp 2017-01-07 22:19:55 +00:00 committed by Mikhail I. Izmestev
parent 8361ab5243
commit 683241ce2f
3 changed files with 8 additions and 1 deletions

View File

@ -916,6 +916,7 @@ BOOST_PYTHON_MODULE( pykd )
.def("__init__", python::make_constructor(pykd::getTypedVarByName) )
.def("__init__", python::make_constructor(pykd::getTypedVarByTypeName) )
.def("__init__", python::make_constructor(pykd::getTypedVarByTypeInfo) )
.def("__init__", python::make_constructor(pykd::getTypedVarWithPrototype) )
.def("getLocation", TypedVarAdapter::getLocation,
"Return location of the varibale")
.def("getAddress", TypedVarAdapter::getAddress,

View File

@ -32,6 +32,12 @@ inline kdlib::TypedVarPtr getTypedVarByTypeInfo( const kdlib::TypeInfoPtr &type
return kdlib::loadTypedVar( typeInfo, addr );
}
inline kdlib::TypedVarPtr getTypedVarWithPrototype( const std::wstring &name, const std::wstring &prototype)
{
AutoRestorePyState pystate;
return kdlib::loadTypedVar(name, prototype);
}
python::list getTypedVarListByTypeName( kdlib::MEMOFFSET_64 offset, const std::wstring &typeName, const std::wstring &fieldName );
python::list getTypedVarListByType( kdlib::MEMOFFSET_64 offset, kdlib::TypeInfoPtr &typeInfo, const std::wstring &fieldName );
python::list getTypedVarArrayByTypeName( kdlib::MEMOFFSET_64 offset, const std::wstring &typeName, size_t number );

View File

@ -86,7 +86,7 @@ class ModuleTest( unittest.TestCase ):
fileName = pykd.getSourceFile(target.module.CdeclFunc )
self.assertTrue( re.search('testfunc\\.cpp', fileName ) )
fileName, lineNo, displacement = pykd.getSourceLine( target.module.CdeclFunc + 2)
self.assertEqual( 18, lineNo )
self.assertEqual( 27, lineNo )
self.assertTrue( re.search('testfunc\\.cpp', fileName ) )
self.assertEqual( 2, displacement )
#fileName, lineNo, displacement = pykd.getSourceLine()