mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 02:53:22 +08:00
[0.3.x] added : function getModulesList ( return list of modules for the current target )
git-svn-id: https://pykd.svn.codeplex.com/svn@91084 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
0288cae4f8
commit
933e3e650d
@ -549,6 +549,10 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
python::def( "setImplicitThread", pykd::setImplicitThread,
|
||||
"Set implicit thread" );
|
||||
|
||||
// modules
|
||||
python::def( "getModulesList", pykd::getModuleList,
|
||||
"Return list of modules for the current target" );
|
||||
|
||||
// events
|
||||
python::def("getLastEvent", pykd::getLastEvent,
|
||||
"Get last debug event information");
|
||||
|
@ -6,6 +6,22 @@ namespace pykd {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
python::list getModuleList()
|
||||
{
|
||||
std::vector<kdlib::ModulePtr > moduleLst;
|
||||
|
||||
do {
|
||||
AutoRestorePyState pystate;
|
||||
for ( unsigned long i = 0; i < kdlib::getNumberModules(); ++i)
|
||||
moduleLst.push_back( kdlib::loadModule(kdlib::getModuleOffsetByIndex(i) ) );
|
||||
|
||||
} while(false);
|
||||
|
||||
return vectorToList(moduleLst);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FixedFileInfoPtr ModuleAdapter::getFixedFileInfo( kdlib::Module& module )
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
@ -155,4 +171,5 @@ python::list ModuleAdapter::getTypedVarArrayByTypeName( kdlib::Module& module, k
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
} // namespace pykd
|
||||
|
@ -16,6 +16,8 @@ namespace pykd {
|
||||
|
||||
typedef boost::shared_ptr< kdlib::FixedFileInfo > FixedFileInfoPtr;
|
||||
|
||||
python::list getModuleList();
|
||||
|
||||
struct ModuleAdapter : public kdlib::Module
|
||||
{
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
@ -136,4 +136,7 @@ class ModuleTest( unittest.TestCase ):
|
||||
self.assertFalse(target.module==None)
|
||||
self.assertTrue(target.module!=None)
|
||||
|
||||
def testModuleList(self):
|
||||
self.assertTrue( [] != pykd.getModulesList() )
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user