From b2d78a796210d1d57f29575e4893b70222a1e37a Mon Sep 17 00:00:00 2001 From: "SND\\EreTIk_cp" Date: Mon, 5 Mar 2012 13:34:27 +0000 Subject: [PATCH] [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 --- pykd/inteventhandler.cpp | 26 ++++++++++++++++++++------ test/scripts/ehexcepttest.py | 3 ++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/pykd/inteventhandler.cpp b/pykd/inteventhandler.cpp index 7502cc1..93647b0 100644 --- a/pykd/inteventhandler.cpp +++ b/pykd/inteventhandler.cpp @@ -91,14 +91,28 @@ HRESULT InternalDbgEventHandler::Breakpoint(IDebugBreakpoint *bp) BpCallbackMapIml::iterator it = m_bpCallbacks.m_map.find(Id); if (it != m_bpCallbacks.m_map.end()) { - try { + python::object resObj; + { PyThread_StateSave pyThreadSave( m_parentClient->getThreadState() ); - hres = python::extract( it->second(Id) ); - return hres; - } - catch (const python::error_already_set &) { - // TODO: some logging, alerting... + try { + resObj = it->second(Id); + + python::extract getRetCode( resObj ); + if (getRetCode.check()) + return getRetCode; + } + catch (const python::error_already_set &) { + // 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; diff --git a/test/scripts/ehexcepttest.py b/test/scripts/ehexcepttest.py index 4514223..5bd8bcd 100644 --- a/test/scripts/ehexcepttest.py +++ b/test/scripts/ehexcepttest.py @@ -54,7 +54,6 @@ bpHandlerTestResult = BpHandlerTestResult() def codeBpHandler(bpId): """ Handler of software breakpoint """ bpHandlerTestResult.wasCodeBp = bpId - return pykd.DEBUG_STATUS_NO_CHANGE def dataBpHandler(bpId): """ Handler of hardware breakpoint """ @@ -85,6 +84,8 @@ class EhExceptionBreakpointTest(unittest.TestCase): # breakpoint so hardware breakpoints cannot be set. # Go to the executable's entry point and set it then. + # raw_input("Press ....") + breakExceptionHandler = BreakExceptionHandler( testClient ) while not breakExceptionHandler.wasSecondChance: testClient.go()