[0.1.x] ~ability to return "None" from bp-handler

git-svn-id: https://pykd.svn.codeplex.com/svn@74730 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\EreTIk_cp 2012-03-05 13:34:27 +00:00 committed by Mikhail I. Izmestev
parent 4033f95230
commit b2d78a7962
2 changed files with 22 additions and 7 deletions

View File

@ -91,15 +91,29 @@ HRESULT InternalDbgEventHandler::Breakpoint(IDebugBreakpoint *bp)
BpCallbackMapIml::iterator it = m_bpCallbacks.m_map.find(Id); BpCallbackMapIml::iterator it = m_bpCallbacks.m_map.find(Id);
if (it != m_bpCallbacks.m_map.end()) if (it != m_bpCallbacks.m_map.end())
{ {
try { python::object resObj;
{
PyThread_StateSave pyThreadSave( m_parentClient->getThreadState() ); PyThread_StateSave pyThreadSave( m_parentClient->getThreadState() );
hres = python::extract<HRESULT>( it->second(Id) ); try {
return hres; resObj = it->second(Id);
python::extract<HRESULT> getRetCode( resObj );
if (getRetCode.check())
return getRetCode;
} }
catch (const python::error_already_set &) { catch (const python::error_already_set &) {
// TODO: some logging, alerting... // TODO: some logging, alerting...
return DEBUG_STATUS_BREAK;
} }
} }
if (resObj.is_none())
return DEBUG_STATUS_NO_CHANGE;
// TODO: python code return invalid value
// some logging, alerting...
return DEBUG_STATUS_BREAK;
}
} }
return DEBUG_STATUS_NO_CHANGE; return DEBUG_STATUS_NO_CHANGE;
} }

View File

@ -54,7 +54,6 @@ bpHandlerTestResult = BpHandlerTestResult()
def codeBpHandler(bpId): def codeBpHandler(bpId):
""" Handler of software breakpoint """ """ Handler of software breakpoint """
bpHandlerTestResult.wasCodeBp = bpId bpHandlerTestResult.wasCodeBp = bpId
return pykd.DEBUG_STATUS_NO_CHANGE
def dataBpHandler(bpId): def dataBpHandler(bpId):
""" Handler of hardware breakpoint """ """ Handler of hardware breakpoint """
@ -85,6 +84,8 @@ class EhExceptionBreakpointTest(unittest.TestCase):
# breakpoint so hardware breakpoints cannot be set. # breakpoint so hardware breakpoints cannot be set.
# Go to the executable's entry point and set it then. # Go to the executable's entry point and set it then.
# raw_input("Press <ENTER>....")
breakExceptionHandler = BreakExceptionHandler( testClient ) breakExceptionHandler = BreakExceptionHandler( testClient )
while not breakExceptionHandler.wasSecondChance: while not breakExceptionHandler.wasSecondChance:
testClient.go() testClient.go()