mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[pykd] added : attachProcess routine ( attach debugger to the exsisting process )
git-svn-id: https://pykd.svn.codeplex.com/svn@69148 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
d01c8d0436
commit
02b54e10da
@ -16,15 +16,13 @@ bool dbgStarted = false;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool
|
||||
void
|
||||
dbgLoadDump( const std::wstring &fileName )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
try {
|
||||
|
||||
if ( dbgStarted || isWindbgExt() )
|
||||
return false;
|
||||
throw DbgException( "debugger is alread attached" );
|
||||
|
||||
g_dbgClient.startEventsMgr();
|
||||
|
||||
@ -38,31 +36,17 @@ dbgLoadDump( const std::wstring &fileName )
|
||||
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
||||
|
||||
dbgStarted = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch( std::exception& )
|
||||
{
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool
|
||||
void
|
||||
startProcess( const std::wstring &processName )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
try {
|
||||
|
||||
if ( dbgStarted || isWindbgExt() )
|
||||
return false;
|
||||
throw DbgException( "debugger is alread attached" );
|
||||
|
||||
g_dbgClient.startEventsMgr();
|
||||
|
||||
@ -88,20 +72,20 @@ startProcess( const std::wstring &processName )
|
||||
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
||||
|
||||
dbgStarted = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
attachProcess( ULONG processId )
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
hres = dbgExt->client->AttachProcess( 0, processId, 0 );
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugClient::AttachProcess failed" );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -4,10 +4,13 @@
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool
|
||||
void
|
||||
dbgLoadDump( const std::wstring &dumpName );
|
||||
|
||||
bool
|
||||
void
|
||||
startProcess( const std::wstring &processName );
|
||||
|
||||
void
|
||||
attachProcess( ULONG processId );
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -91,6 +91,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Load crash dump (only for console)");
|
||||
boost::python::def( "startProcess", &startProcess,
|
||||
"Start process for debugging (only for console)");
|
||||
boost::python::def( "attachProcess", &attachProcess,
|
||||
"Attach debugger to the exsisting process" );
|
||||
boost::python::def( "dbgCommand", &dbgCommand,
|
||||
"Execute debugger command. For example: dbgCommand( \"lmvm nt\" )" );
|
||||
boost::python::def( "isValid", &isOffsetValid,
|
||||
|
Loading…
Reference in New Issue
Block a user