From a36f84d28d36e0bdeefff494900a72f865f4456b Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Wed, 24 Jan 2018 16:51:16 +0300 Subject: [PATCH] Add Continued event and clear variable references when this event happens --- src/debug/netcoredbg/debugger.h | 4 ++++ src/debug/netcoredbg/manageddebugger.cpp | 15 ++++++++++++--- src/debug/netcoredbg/miprotocol.cpp | 4 ++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/debug/netcoredbg/debugger.h b/src/debug/netcoredbg/debugger.h index dd73aaf..ed01f9a 100644 --- a/src/debug/netcoredbg/debugger.h +++ b/src/debug/netcoredbg/debugger.h @@ -304,6 +304,8 @@ public: HRESULT GetScopes(ICorDebugProcess *pProcess, uint64_t frameId, std::vector &scopes); HRESULT Evaluate(ICorDebugProcess *pProcess, uint64_t frameId, const std::string &expression, Variable &variable); + + void Clear() { m_variables.clear(); m_nextVariableReference = 1; } }; class Debugger @@ -458,6 +460,7 @@ public: virtual void EmitStoppedEvent(StoppedEvent event) = 0; virtual void EmitExitedEvent(ExitedEvent event) = 0; virtual void EmitTerminatedEvent() = 0; + virtual void EmitContinuedEvent() = 0; virtual void EmitThreadEvent(ThreadEvent event) = 0; virtual void EmitModuleEvent(ModuleEvent event) = 0; virtual void EmitOutputEvent(OutputEvent event) = 0; @@ -488,6 +491,7 @@ public: void EmitStoppedEvent(StoppedEvent event) override; void EmitExitedEvent(ExitedEvent event) override; void EmitTerminatedEvent() override {}; + void EmitContinuedEvent() override; void EmitThreadEvent(ThreadEvent event) override; void EmitModuleEvent(ModuleEvent event) override; void EmitOutputEvent(OutputEvent event) override; diff --git a/src/debug/netcoredbg/manageddebugger.cpp b/src/debug/netcoredbg/manageddebugger.cpp index 1d7b3f8..b79ce0c 100644 --- a/src/debug/netcoredbg/manageddebugger.cpp +++ b/src/debug/netcoredbg/manageddebugger.cpp @@ -757,15 +757,24 @@ HRESULT ManagedDebugger::StepCommand(int threadId, StepType stepType) IfFailRet(m_pProcess->GetThread(threadId, &pThread)); DisableAllSteppers(m_pProcess); IfFailRet(SetupStep(pThread, stepType)); - IfFailRet(m_pProcess->Continue(0)); - return S_OK; + + m_variables.Clear(); + Status = m_pProcess->Continue(0); + if (SUCCEEDED(Status)) + m_protocol->EmitContinuedEvent(); + return Status; } HRESULT ManagedDebugger::Continue() { if (!m_pProcess) return E_FAIL; - return m_pProcess->Continue(0); + + m_variables.Clear(); + HRESULT Status = m_pProcess->Continue(0); + if (SUCCEEDED(Status)) + m_protocol->EmitContinuedEvent(); + return Status; } HRESULT ManagedDebugger::Pause() diff --git a/src/debug/netcoredbg/miprotocol.cpp b/src/debug/netcoredbg/miprotocol.cpp index 684c24d..23166bc 100644 --- a/src/debug/netcoredbg/miprotocol.cpp +++ b/src/debug/netcoredbg/miprotocol.cpp @@ -479,6 +479,10 @@ void MIProtocol::EmitExitedEvent(ExitedEvent event) MIProtocol::Printf("*stopped,reason=\"exited\",exit-code=\"%i\"\n", event.exitCode); } +void MIProtocol::EmitContinuedEvent() +{ +} + void MIProtocol::EmitThreadEvent(ThreadEvent event) { const char *reasonText = ""; -- 2.7.4