mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +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() );
|
sys.attr("stdin") = python::object( dbgClient->din() );
|
||||||
|
|
||||||
// èìïîðòèðóåì ìîäóëü îáðàáîòêè èñêëþ÷åíèé ( íóæåí äëÿ âûâîäà traceback à )
|
// èìïîðòèðóåì ìîäóëü îáðàáîòêè èñêëþ÷åíèé ( íóæåí äëÿ âûâîäà traceback à )
|
||||||
boost::python::object tracebackModule = python::import("traceback");
|
python::object tracebackModule = python::import("traceback");
|
||||||
|
|
||||||
// ðàçáîð ïàðàìåòðîâ
|
// ðàçáîð ïàðàìåòðîâ
|
||||||
typedef boost::escaped_list_separator<char> char_separator_t;
|
typedef boost::escaped_list_separator<char> char_separator_t;
|
||||||
@ -215,9 +215,12 @@ py( PDEBUG_CLIENT4 client, PCSTR args )
|
|||||||
HRESULT
|
HRESULT
|
||||||
CALLBACK
|
CALLBACK
|
||||||
pycmd( PDEBUG_CLIENT4 client, PCSTR args )
|
pycmd( PDEBUG_CLIENT4 client, PCSTR args )
|
||||||
|
{
|
||||||
|
if ( g_dbgClient->client() != client )
|
||||||
{
|
{
|
||||||
DebugClientPtr dbgClient = DebugClient::createDbgClient( client );
|
DebugClientPtr dbgClient = DebugClient::createDbgClient( client );
|
||||||
DebugClientPtr oldClient = DebugClient::setDbgClientCurrent( dbgClient );
|
DebugClient::setDbgClientCurrent( dbgClient );
|
||||||
|
}
|
||||||
|
|
||||||
WindbgGlobalSession::RestorePyState();
|
WindbgGlobalSession::RestorePyState();
|
||||||
|
|
||||||
@ -241,18 +244,20 @@ pycmd( PDEBUG_CLIENT4 client, PCSTR args )
|
|||||||
WindbgGlobalSession::global().ptr(),
|
WindbgGlobalSession::global().ptr(),
|
||||||
WindbgGlobalSession::global().ptr()
|
WindbgGlobalSession::global().ptr()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// âûõîä èç èíòåðïðåòàòîðà ïðîèñõîäèò ÷åðåç èñêëþ÷åíèå raise SystemExit(code)
|
||||||
|
// êîòîðîå ïîòîì ìîæåò ïîìåøàòü èñïîëíåíèþ callback îâ
|
||||||
|
PyErr_Clear();
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
dbgClient->eprintln( L"unexpected error" );
|
//dbgClient->eprintln( L"unexpected error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
client->SetOutputMask( mask );
|
client->SetOutputMask( mask );
|
||||||
|
|
||||||
WindbgGlobalSession::SavePyState();
|
WindbgGlobalSession::SavePyState();
|
||||||
|
|
||||||
DebugClient::setDbgClientCurrent( oldClient );
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,26 +90,24 @@ HRESULT InternalDbgEventHandler::Breakpoint(IDebugBreakpoint *bp)
|
|||||||
boost::recursive_mutex::scoped_lock mapBpLock(*m_bpCallbacks.m_lock);
|
boost::recursive_mutex::scoped_lock mapBpLock(*m_bpCallbacks.m_lock);
|
||||||
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())
|
||||||
{
|
|
||||||
python::object resObj;
|
|
||||||
{
|
{
|
||||||
PyThread_StateSave pyThreadSave( m_parentClient->getThreadState() );
|
PyThread_StateSave pyThreadSave( m_parentClient->getThreadState() );
|
||||||
|
|
||||||
try {
|
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 );
|
python::extract<HRESULT> getRetCode( resObj );
|
||||||
if (getRetCode.check())
|
if (getRetCode.check())
|
||||||
return getRetCode;
|
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;
|
return DEBUG_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (resObj.is_none())
|
|
||||||
return DEBUG_STATUS_NO_CHANGE;
|
|
||||||
|
|
||||||
// TODO: python code return invalid value
|
// TODO: python code return invalid value
|
||||||
// some logging, alerting...
|
// some logging, alerting...
|
||||||
return DEBUG_STATUS_BREAK;
|
return DEBUG_STATUS_BREAK;
|
||||||
|
@ -103,6 +103,8 @@ class TypedVarTest( unittest.TestCase ):
|
|||||||
def testBitField(self):
|
def testBitField(self):
|
||||||
tv = target.module.typedVar("g_structWithBits")
|
tv = target.module.typedVar("g_structWithBits")
|
||||||
self.assertEqual( 4, tv.m_bit0_4 )
|
self.assertEqual( 4, tv.m_bit0_4 )
|
||||||
|
self.assertEqual( 1, tv.m_bit5 )
|
||||||
|
self.assertEqual( 3, tv.m_bit6_7 )
|
||||||
|
|
||||||
def testTypedVarList(self):
|
def testTypedVarList(self):
|
||||||
tvl = target.module.typedVarList( target.module.g_listHead, "listStruct", "listEntry" )
|
tvl = target.module.typedVarList( target.module.g_listHead, "listStruct", "listEntry" )
|
||||||
|
Loading…
Reference in New Issue
Block a user