[0.2.x] fixed : issue ( dbgCommand("a") hangs up )

git-svn-id: https://pykd.svn.codeplex.com/svn@83097 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-03-28 15:56:31 +00:00 committed by Mikhail I. Izmestev
parent e1dade0a03
commit f6c7926ad6
2 changed files with 62 additions and 1 deletions

View File

@ -1543,6 +1543,37 @@ HRESULT STDMETHODCALLTYPE DebugEngine::ChangeEngineState(
///////////////////////////////////////////////////////////////////////////////
HRESULT STDMETHODCALLTYPE DebugEngine::StartInput(
__in ULONG BufferSize )
{
std::string s = "";
{
PyThread_StateSave pyThreadSave( g_dbgEng->pystate );
python::object ret = python::eval( "raw_input(\"input>\")" );
s = python::extract<std::string>( ret );
}
g_dbgEng->control->ReturnInput ( s.c_str() );
//python::object sys = python::import( "sys" );
//python::object sysstdin = sys.attr("stdin");
//sys.attr("stdin") = python::object( DbgIn() );
return S_OK;
}
///////////////////////////////////////////////////////////////////////////////
HRESULT STDMETHODCALLTYPE DebugEngine::EndInput()
{
return S_OK;
}
///////////////////////////////////////////////////////////////////////////////
DebugEngine::DbgEngBind* DebugEngine::operator->()
{
if ( m_bind.get() != NULL )
@ -1564,6 +1595,8 @@ DebugEngine::DbgEngBind* DebugEngine::operator->()
main_namespace["globalEventHandler"] = EventHandlerPtr( new EventHandlerImpl() );
client->SetInputCallbacks( this );
return m_bind.get();
}

View File

@ -12,7 +12,7 @@ namespace pykd {
///////////////////////////////////////////////////////////////////////////////////
class DebugEngine : private DebugBaseEventCallbacks
class DebugEngine : private DebugBaseEventCallbacks, private IDebugInputCallbacks
{
public:
@ -43,6 +43,28 @@ public:
};
// IUnknown impls
// IUnknown.
STDMETHOD(QueryInterface)(
__in REFIID InterfaceId,
__out PVOID* Interface
)
{
*Interface = NULL;
if (IsEqualIID(InterfaceId, __uuidof(IUnknown)) ||
IsEqualIID(InterfaceId, __uuidof(IDebugEventCallbacks)) ||
IsEqualIID(InterfaceId,__uuidof(IDebugInputCallbacks))
)
{
*Interface = this;
return S_OK;
}
else
{
return E_NOINTERFACE;
}
}
STDMETHOD_(ULONG, AddRef)() { return 1; }
STDMETHOD_(ULONG, Release)() { return 1; }
@ -84,6 +106,12 @@ public:
__in ULONG Flags,
__in ULONG64 Argument );
STDMETHOD(StartInput)(
__in ULONG BufferSize );
STDMETHOD(EndInput)();
DbgEngBind* operator->();
void registerCallbacks( const DEBUG_EVENT_CALLBACK *callbacks );