mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.1.x] ~ python thread state restore for create process and load dump
git-svn-id: https://pykd.svn.codeplex.com/svn@75087 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
7eb1b48220
commit
1503c4e7f6
@ -169,10 +169,9 @@ void DebugClient::loadDump( const std::wstring &fileName )
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugClient4::OpenDumpFileWide failed" );
|
||||
|
||||
hres = m_control->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE);
|
||||
hres = safeWaitForEvent();
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
||||
|
||||
}
|
||||
|
||||
void loadDump( const std::wstring &fileName ) {
|
||||
@ -202,7 +201,7 @@ void DebugClient::startProcess( const std::wstring &processName )
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugClient4::CreateProcessWide failed" );
|
||||
|
||||
hres = m_control->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE);
|
||||
hres = safeWaitForEvent();
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
||||
}
|
||||
@ -366,7 +365,6 @@ void DebugClient::setExecutionStatus( ULONG status )
|
||||
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::SetExecutionStatus failed" );
|
||||
|
||||
}
|
||||
|
||||
void setExecutionStatus( ULONG status )
|
||||
@ -376,15 +374,17 @@ void setExecutionStatus( ULONG status )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
HRESULT DebugClient::safeWaitForEvent(ULONG timeout /*= INFINITE*/, ULONG flags /*= DEBUG_WAIT_DEFAULT*/)
|
||||
{
|
||||
PyThread_StateRestore pyThreadRestore( m_pyThreadState );
|
||||
return m_control->WaitForEvent( flags, timeout );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void DebugClient::waitForEvent()
|
||||
{
|
||||
HRESULT hres;
|
||||
|
||||
do {
|
||||
PyThread_StateRestore pyThreadRestore( m_pyThreadState );
|
||||
hres = m_control->WaitForEvent( 0, INFINITE );
|
||||
|
||||
} while( false );
|
||||
HRESULT hres = safeWaitForEvent();
|
||||
|
||||
if ( FAILED( hres ) )
|
||||
{
|
||||
|
@ -352,6 +352,8 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
HRESULT safeWaitForEvent(ULONG timeout = INFINITE, ULONG flags = DEBUG_WAIT_DEFAULT);
|
||||
|
||||
template<typename T>
|
||||
python::list
|
||||
loadArray( ULONG64 offset, ULONG count, bool phyAddr );
|
||||
|
Loading…
Reference in New Issue
Block a user