mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-18 01:53:22 +08:00
[0.2.x] ~recovered WaitEventException
git-svn-id: https://pykd.svn.codeplex.com/svn@83541 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
ca4d73e776
commit
aee8b2b1b8
@ -89,6 +89,9 @@ std::string DiaException::makeFullDesc(const std::string &desc, HRESULT hres, ID
|
||||
_CASE_DIA_ERROR(SYMSRV_CACHE_FULL);
|
||||
|
||||
#undef _CASE_DIA_ERROR
|
||||
|
||||
case S_FALSE: sstream << ": S_FALSE" << std::endl; break;
|
||||
|
||||
default:
|
||||
{
|
||||
PCHAR errMessage = NULL;
|
||||
|
@ -655,7 +655,7 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
|
||||
pykd::exception<DbgException>( "BaseException", "Pykd base exception class" );
|
||||
pykd::exception<MemoryException,DbgException>( "MemoryException", "Target memory access exception class" );
|
||||
//pykd::exception<WaitEventException,DbgException>( "WaitEventException", "Debug interface access exception" );
|
||||
pykd::exception<WaitEventException,DbgException>( "WaitEventException", "None of the targets could generate events" );
|
||||
pykd::exception<WrongEventTypeException,DbgException>( "WrongEventTypeException", "Unknown last event type" );
|
||||
pykd::exception<SymbolException,DbgException>( "SymbolException", "Symbol exception" );
|
||||
//pykd::exception<pyDia::Exception,SymbolException>( "DiaException", "Debug interface access exception" );
|
||||
|
@ -110,12 +110,16 @@ void debugGo()
|
||||
do {
|
||||
hres = g_dbgEng->control->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE);
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::WaitForEvent failed" );
|
||||
{
|
||||
if (E_UNEXPECTED == hres)
|
||||
throw WaitEventException();
|
||||
throw DbgException( "IDebugControl::WaitForEvent", hres );
|
||||
}
|
||||
|
||||
hres = g_dbgEng->control->GetExecutionStatus( ¤tStatus );
|
||||
|
||||
if ( FAILED( hres ) )
|
||||
throw DbgException( "IDebugControl::GetExecutionStatus failed" );
|
||||
throw DbgException( "IDebugControl::GetExecutionStatus", hres );
|
||||
|
||||
} while( currentStatus != DEBUG_STATUS_BREAK && currentStatus != DEBUG_STATUS_NO_DEBUGGEE );
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class StatusChangeHandler(pykd.eventHandler):
|
||||
self.breakCount = 0
|
||||
self.goCount = 0
|
||||
self.noDebuggee = 0
|
||||
|
||||
|
||||
def onExecutionStatusChange(self, executionStatus):
|
||||
if executionStatus == pykd.executionStatus.Break:
|
||||
self.breakCount += 1
|
||||
@ -29,20 +29,13 @@ class EhStatusTest(unittest.TestCase):
|
||||
"""Start new process and track exceptions"""
|
||||
_locProcessId = pykd.startProcess( target.appPath + " -testChangeStatus" )
|
||||
with testutils.ContextCallIt( testutils.KillProcess(_locProcessId) ) as killStartedProcess :
|
||||
|
||||
|
||||
pykd.go() #skip initial break
|
||||
|
||||
|
||||
statusChangeHandler = StatusChangeHandler()
|
||||
|
||||
try:
|
||||
|
||||
while True:
|
||||
pykd.go()
|
||||
except pykd.BaseException:
|
||||
pass
|
||||
|
||||
|
||||
self.assertRaises(pykd.WaitEventException, testutils.infGo)
|
||||
|
||||
self.assertEqual( 2, statusChangeHandler.breakCount )
|
||||
self.assertEqual( 1, statusChangeHandler.noDebuggee )
|
||||
self.assertEqual( statusChangeHandler.breakCount + statusChangeHandler.noDebuggee , statusChangeHandler.goCount )
|
||||
|
@ -40,9 +40,6 @@ class EhSymbolsTest(unittest.TestCase):
|
||||
pykd.dbgCommand(".reload /u")
|
||||
self.assertTrue( symbolsStateHandler.unloadAllModulesTrigged )
|
||||
|
||||
try:
|
||||
while True:
|
||||
pykd.go()
|
||||
except pykd.BaseException:
|
||||
pass
|
||||
self.assertRaises(pykd.WaitEventException, testutils.infGo)
|
||||
|
||||
self.assertTrue( "iphlpapi" in symbolsStateHandler.modNames )
|
||||
|
@ -23,3 +23,8 @@ class KillProcess:
|
||||
pykd.killProcess( self.processId )
|
||||
pykd.detachProcess( self.processId )
|
||||
|
||||
def infGo():
|
||||
"""Infinite pykd.go call"""
|
||||
while True:
|
||||
pykd.go()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user