[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:
SND\EreTIk_cp 2013-05-01 12:50:44 +00:00 committed by Mikhail I. Izmestev
parent ca4d73e776
commit aee8b2b1b8
6 changed files with 22 additions and 20 deletions

View File

@ -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;

View File

@ -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" );

View File

@ -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( &currentStatus );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl::GetExecutionStatus failed" );
throw DbgException( "IDebugControl::GetExecutionStatus", hres );
} while( currentStatus != DEBUG_STATUS_BREAK && currentStatus != DEBUG_STATUS_NO_DEBUGGEE );
}

View File

@ -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 )

View File

@ -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 )

View File

@ -23,3 +23,8 @@ class KillProcess:
pykd.killProcess( self.processId )
pykd.detachProcess( self.processId )
def infGo():
"""Infinite pykd.go call"""
while True:
pykd.go()