mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-29 11:53:23 +08:00
[0.2.x] fixed : issue #11651 ( dbgCommand("a") hangs up )
git-svn-id: https://pykd.svn.codeplex.com/svn@83097 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
e1dade0a03
commit
f6c7926ad6
pykd/win
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user