[0.3.x] added : getProcessThreads ( Get all process's threads )

[0.3.x] added : getTargetProcesses ( Get all target processes  )

git-svn-id: https://pykd.svn.codeplex.com/svn@87298 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2014-02-17 13:50:51 +00:00 committed by Mikhail I. Izmestev
parent 9a6a26b1ed
commit 8f3e1352e1
4 changed files with 54 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#include "kdlib/typeinfo.h"
#include "pydbgeng.h"
#include "stladaptor.h"
#include "variant.h"
namespace pykd {
@ -96,4 +97,49 @@ std::wstring printExceptionInfo( kdlib::ExceptionInfo& exceptionInfo )
///////////////////////////////////////////////////////////////////////////////
python::list getProcessThreads()
{
std::vector<kdlib::MEMOFFSET_64> threadList;
do {
AutoRestorePyState pystate;
unsigned long threadNumber = getNumberThreads();
for ( unsigned long i = 0; i < threadNumber; ++i )
{
kdlib::THREAD_DEBUG_ID threadId = kdlib::getThreadIdByIndex(i);
threadList.push_back( kdlib::getThreadOffset(threadId) );
}
} while(false);
return vectorToList(threadList);
}
///////////////////////////////////////////////////////////////////////////////
python::list getTargetProcesses()
{
std::vector<kdlib::PROCESS_DEBUG_ID> processList;
do {
AutoRestorePyState pystate;
unsigned long processNumber = getNumberProcesses();
for ( unsigned long i = 0; i < processNumber; ++i )
{
processList.push_back( kdlib::getProcessIdByIndex(i) );
}
} while(false);
return vectorToList(processList);
}
///////////////////////////////////////////////////////////////////////////////
} //end namespace pykd

View File

@ -213,6 +213,9 @@ inline kdlib::MEMOFFSET_64 getImplicitProcessOffset()
return kdlib::getImplicitProcessOffset();
}
python::list getProcessThreads();
python::list getTargetProcesses();
///////////////////////////////////////////////////////////////////////////////
inline

View File

@ -363,6 +363,10 @@ BOOST_PYTHON_MODULE( pykd )
"Set implicit process" );
// python::def( "getCurrentProcessExeName", &getCurrentProcessExecutableName,
// "Return name of executable file loaded in the current process");
python::def( "getProcessThreads", pykd::getProcessThreads,
"Get all process's threads " );
python::def( "getTargetProcesses", pykd::getTargetProcesses,
"Get all target processes " );
python::def ( "getNumberThreads", pykd::getNumberThreads,

View File

@ -81,7 +81,7 @@ def getTestSuite( singleName = "" ):
if __name__ == "__main__":
print "\nTesting PyKd ver. " + pykd.version
print "\nTesting PyKd ver. " + pykd.__version__
target.appPath = sys.argv[1]
target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]