mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[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:
parent
9a6a26b1ed
commit
8f3e1352e1
@ -4,6 +4,7 @@
|
|||||||
#include "kdlib/typeinfo.h"
|
#include "kdlib/typeinfo.h"
|
||||||
|
|
||||||
#include "pydbgeng.h"
|
#include "pydbgeng.h"
|
||||||
|
#include "stladaptor.h"
|
||||||
#include "variant.h"
|
#include "variant.h"
|
||||||
|
|
||||||
namespace pykd {
|
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
|
} //end namespace pykd
|
||||||
|
@ -213,6 +213,9 @@ inline kdlib::MEMOFFSET_64 getImplicitProcessOffset()
|
|||||||
return kdlib::getImplicitProcessOffset();
|
return kdlib::getImplicitProcessOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
python::list getProcessThreads();
|
||||||
|
python::list getTargetProcesses();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -363,6 +363,10 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Set implicit process" );
|
"Set implicit process" );
|
||||||
// python::def( "getCurrentProcessExeName", &getCurrentProcessExecutableName,
|
// python::def( "getCurrentProcessExeName", &getCurrentProcessExecutableName,
|
||||||
// "Return name of executable file loaded in the current process");
|
// "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,
|
python::def ( "getNumberThreads", pykd::getNumberThreads,
|
||||||
|
@ -81,7 +81,7 @@ def getTestSuite( singleName = "" ):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
print "\nTesting PyKd ver. " + pykd.version
|
print "\nTesting PyKd ver. " + pykd.__version__
|
||||||
|
|
||||||
target.appPath = sys.argv[1]
|
target.appPath = sys.argv[1]
|
||||||
target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]
|
target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user