[0.2.x] added : detachAllProcesses ( detach from all process and resume all their threads )

[0.2.x] added : killAllProcesses ( detach from all process then terminate them )

git-svn-id: https://pykd.svn.codeplex.com/svn@86269 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-11-05 06:08:27 +00:00 committed by Mikhail I. Izmestev
parent 976e43a31a
commit 6f7c574b6b
3 changed files with 39 additions and 1 deletions

View File

@ -12,6 +12,8 @@ void attachKernel( const std::string &connectOptions = "" );
bool isLocalKernelDebuggerEnabled(); bool isLocalKernelDebuggerEnabled();
void detachProcess( ULONG processId = -1); void detachProcess( ULONG processId = -1);
void terminateProcess( ULONG processId = -1); void terminateProcess( ULONG processId = -1);
void detachAllProcesses();
void terminateAllProcesses();
void loadDump( const std::wstring &fileName ); void loadDump( const std::wstring &fileName );
void writeDump( const std::wstring &fileNamem, bool smallDump ); void writeDump( const std::wstring &fileNamem, bool smallDump );

View File

@ -102,8 +102,12 @@ BOOST_PYTHON_MODULE( pykd )
"Check whether kernel debugging is enabled for the local kernel" ); "Check whether kernel debugging is enabled for the local kernel" );
python::def( "detachProcess", &detachProcess, detachProcess_( boost::python::args( "pid" ), python::def( "detachProcess", &detachProcess, detachProcess_( boost::python::args( "pid" ),
"Stop process debugging") ); "Stop process debugging") );
python::def( "detachAllProcesses", &detachAllProcesses,
"Detach from all process and resume all their threads" );
python::def( "killProcess", &terminateProcess, python::def( "killProcess", &terminateProcess,
"Stop debugging and terminate current process" ); "Stop debugging and terminate current process" );
python::def( "killAllProcesses", &terminateAllProcesses,
"Detach from all process then terminate them");
python::def( "loadDump", &loadDump, python::def( "loadDump", &loadDump,
"Load crash dump"); "Load crash dump");
python::def( "isDumpAnalyzing", &isDumpAnalyzing, python::def( "isDumpAnalyzing", &isDumpAnalyzing,

View File

@ -166,7 +166,39 @@ void terminateProcess( ULONG processId )
hres = g_dbgEng->client->DetachCurrentProcess(); hres = g_dbgEng->client->DetachCurrentProcess();
if ( FAILED( hres ) ) if ( FAILED( hres ) )
throw DbgException( "IDebugClient::DetachCurrentProcess failed" ); throw DbgException( "IDebugClient::DetachCurrentProcess", hres );
}
///////////////////////////////////////////////////////////////////////////////
void detachAllProcesses()
{
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
HRESULT hres;
hres = g_dbgEng->client->DetachProcesses();
if ( FAILED(hres) )
throw DbgException( "IDebugClient::DetachProcesses", hres );
}
///////////////////////////////////////////////////////////////////////////////
void terminateAllProcesses()
{
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
HRESULT hres;
hres = g_dbgEng->client->TerminateProcesses();
if ( FAILED(hres) )
throw DbgException( "IDebugClient::TerminateProcesses", hres );
hres = g_dbgEng->client->DetachProcesses();
if ( FAILED(hres) )
throw DbgException( "IDebugClient::DetachProcesses", hres );
} }