[0.3.x] added : module.enumTypes method ( return list of types name )
git-svn-id: https://pykd.svn.codeplex.com/svn@90913 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
ff0d434b29
commit
7831e430ae
@ -83,6 +83,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( setHardwareBreakpoint_, Breakpoint::setHardware
|
|||||||
|
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( Module_enumSymbols, ModuleAdapter::enumSymbols, 1, 2 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( Module_enumSymbols, ModuleAdapter::enumSymbols, 1, 2 );
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( Module_findSymbol, ModuleAdapter::findSymbol, 2, 3 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( Module_findSymbol, ModuleAdapter::findSymbol, 2, 3 );
|
||||||
|
BOOST_PYTHON_FUNCTION_OVERLOADS( Module_enumTypes, ModuleAdapter::enumTypes, 1, 2 );
|
||||||
|
|
||||||
BOOST_PYTHON_FUNCTION_OVERLOADS( TypeInfo_ptrTo, TypeInfoAdapter::ptrTo, 1, 2 );
|
BOOST_PYTHON_FUNCTION_OVERLOADS( TypeInfo_ptrTo, TypeInfoAdapter::ptrTo, 1, 2 );
|
||||||
|
|
||||||
@ -685,6 +686,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"The start address is calculated by the same method as the standard macro CONTAINING_RECORD does")
|
"The start address is calculated by the same method as the standard macro CONTAINING_RECORD does")
|
||||||
.def("enumSymbols", ModuleAdapter::enumSymbols, Module_enumSymbols(python::args("mask"),
|
.def("enumSymbols", ModuleAdapter::enumSymbols, Module_enumSymbols(python::args("mask"),
|
||||||
"Return list of tuple ( symbolname, offset )"))
|
"Return list of tuple ( symbolname, offset )"))
|
||||||
|
.def("enumTypes", ModuleAdapter::enumTypes, Module_enumTypes(python::args("mask"),
|
||||||
|
"Return list of types name"))
|
||||||
.def("checksum", ModuleAdapter::getCheckSum,
|
.def("checksum", ModuleAdapter::getCheckSum,
|
||||||
"Return a image file checksum: IMAGE_OPTIONAL_HEADER.CheckSum" )
|
"Return a image file checksum: IMAGE_OPTIONAL_HEADER.CheckSum" )
|
||||||
.def("timestamp", ModuleAdapter::getTimeDataStamp,
|
.def("timestamp", ModuleAdapter::getTimeDataStamp,
|
||||||
|
@ -70,6 +70,23 @@ python::list ModuleAdapter::enumSymbols( kdlib::Module& module, const std::wstri
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
python::list ModuleAdapter::enumTypes(kdlib::Module& module, const std::wstring &mask)
|
||||||
|
{
|
||||||
|
kdlib::TypeNameList typeLst;
|
||||||
|
|
||||||
|
do {
|
||||||
|
AutoRestorePyState pystate;
|
||||||
|
typeLst = module.enumTypes(mask);
|
||||||
|
} while (false);
|
||||||
|
|
||||||
|
python::list pyLst;
|
||||||
|
for (kdlib::TypeNameList::const_iterator it = typeLst.begin(); it != typeLst.end(); ++it)
|
||||||
|
pyLst.append(*it);
|
||||||
|
return pyLst;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
std::wstring ModuleAdapter::findSymbol( kdlib::Module& module, kdlib::MEMOFFSET_64 offset, bool showDisplacement )
|
std::wstring ModuleAdapter::findSymbol( kdlib::Module& module, kdlib::MEMOFFSET_64 offset, bool showDisplacement )
|
||||||
{
|
{
|
||||||
|
@ -161,6 +161,8 @@ struct ModuleAdapter : public kdlib::Module
|
|||||||
|
|
||||||
static python::list enumSymbols( kdlib::Module& module, const std::wstring &mask = L"*" );
|
static python::list enumSymbols( kdlib::Module& module, const std::wstring &mask = L"*" );
|
||||||
|
|
||||||
|
static python::list enumTypes(kdlib::Module& module, const std::wstring &mask = L"*");
|
||||||
|
|
||||||
static std::wstring findSymbol( kdlib::Module& module, kdlib::MEMOFFSET_64 offset, bool showDisplacement = true );
|
static std::wstring findSymbol( kdlib::Module& module, kdlib::MEMOFFSET_64 offset, bool showDisplacement = true );
|
||||||
|
|
||||||
static python::tuple findSymbolAndDisp( kdlib::Module& module, kdlib::MEMOFFSET_64 offset );
|
static python::tuple findSymbolAndDisp( kdlib::Module& module, kdlib::MEMOFFSET_64 offset );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -316,3 +316,12 @@ class TypeInfoTest( unittest.TestCase ):
|
|||||||
self.assertEqual(5, len(dir(ti)))
|
self.assertEqual(5, len(dir(ti)))
|
||||||
self.assertTrue("m_field3" in dir(ti))
|
self.assertTrue("m_field3" in dir(ti))
|
||||||
self.assertFalse("m_field33" in dir(ti))
|
self.assertFalse("m_field33" in dir(ti))
|
||||||
|
|
||||||
|
def testEnumTypes(self):
|
||||||
|
lst = target.module.enumTypes()
|
||||||
|
self.assertNotEqual([], lst)
|
||||||
|
lst = target.module.enumTypes("structTest")
|
||||||
|
self.assertEqual(["structTest"], lst)
|
||||||
|
lst = target.module.enumTypes("NonExsistType")
|
||||||
|
self.assertEqual([],lst)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user