mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 12:53:23 +08:00
[0.1.x] fixed : issue #10532 ( breakpoint callback is not called after quit from !pycmd )
git-svn-id: https://pykd.svn.codeplex.com/svn@75293 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
761ea0dcd3
commit
322f1a39a6
@ -125,7 +125,7 @@ py( PDEBUG_CLIENT4 client, PCSTR args )
|
||||
sys.attr("stdin") = python::object( dbgClient->din() );
|
||||
|
||||
// èìïîðòèðóåì ìîäóëü îáðàáîòêè èñêëþ÷åíèé ( íóæåí äëÿ âûâîäà traceback à )
|
||||
boost::python::object tracebackModule = python::import("traceback");
|
||||
python::object tracebackModule = python::import("traceback");
|
||||
|
||||
// ðàçáîð ïàðàìåòðîâ
|
||||
typedef boost::escaped_list_separator<char> char_separator_t;
|
||||
@ -216,8 +216,11 @@ HRESULT
|
||||
CALLBACK
|
||||
pycmd( PDEBUG_CLIENT4 client, PCSTR args )
|
||||
{
|
||||
if ( g_dbgClient->client() != client )
|
||||
{
|
||||
DebugClientPtr dbgClient = DebugClient::createDbgClient( client );
|
||||
DebugClientPtr oldClient = DebugClient::setDbgClientCurrent( dbgClient );
|
||||
DebugClient::setDbgClientCurrent( dbgClient );
|
||||
}
|
||||
|
||||
WindbgGlobalSession::RestorePyState();
|
||||
|
||||
@ -241,18 +244,20 @@ pycmd( PDEBUG_CLIENT4 client, PCSTR args )
|
||||
WindbgGlobalSession::global().ptr(),
|
||||
WindbgGlobalSession::global().ptr()
|
||||
);
|
||||
|
||||
// âûõîä èç èíòåðïðåòàòîðà ïðîèñõîäèò ÷åðåç èñêëþ÷åíèå raise SystemExit(code)
|
||||
// êîòîðîå ïîòîì ìîæåò ïîìåøàòü èñïîëíåíèþ callback îâ
|
||||
PyErr_Clear();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
dbgClient->eprintln( L"unexpected error" );
|
||||
//dbgClient->eprintln( L"unexpected error" );
|
||||
}
|
||||
|
||||
client->SetOutputMask( mask );
|
||||
|
||||
WindbgGlobalSession::SavePyState();
|
||||
|
||||
DebugClient::setDbgClientCurrent( oldClient );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -90,26 +90,24 @@ HRESULT InternalDbgEventHandler::Breakpoint(IDebugBreakpoint *bp)
|
||||
boost::recursive_mutex::scoped_lock mapBpLock(*m_bpCallbacks.m_lock);
|
||||
BpCallbackMapIml::iterator it = m_bpCallbacks.m_map.find(Id);
|
||||
if (it != m_bpCallbacks.m_map.end())
|
||||
{
|
||||
python::object resObj;
|
||||
{
|
||||
PyThread_StateSave pyThreadSave( m_parentClient->getThreadState() );
|
||||
|
||||
try {
|
||||
resObj = it->second(Id);
|
||||
|
||||
python::object resObj = it->second(Id);
|
||||
|
||||
if (resObj.is_none())
|
||||
return DEBUG_STATUS_NO_CHANGE;
|
||||
|
||||
python::extract<HRESULT> getRetCode( resObj );
|
||||
if (getRetCode.check())
|
||||
return getRetCode;
|
||||
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;
|
||||
|
@ -103,6 +103,8 @@ class TypedVarTest( unittest.TestCase ):
|
||||
def testBitField(self):
|
||||
tv = target.module.typedVar("g_structWithBits")
|
||||
self.assertEqual( 4, tv.m_bit0_4 )
|
||||
self.assertEqual( 1, tv.m_bit5 )
|
||||
self.assertEqual( 3, tv.m_bit6_7 )
|
||||
|
||||
def testTypedVarList(self):
|
||||
tvl = target.module.typedVarList( target.module.g_listHead, "listStruct", "listEntry" )
|
||||
|
Loading…
Reference in New Issue
Block a user