Add Continued event and clear variable references when this event happens
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 24 Jan 2018 13:51:16 +0000 (16:51 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 24 Jan 2018 13:51:16 +0000 (16:51 +0300)
src/debug/netcoredbg/debugger.h
src/debug/netcoredbg/manageddebugger.cpp
src/debug/netcoredbg/miprotocol.cpp

index dd73aaf..ed01f9a 100644 (file)
@@ -304,6 +304,8 @@ public:
     HRESULT GetScopes(ICorDebugProcess *pProcess, uint64_t frameId, std::vector<Scope> &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;
index 1d7b3f8..b79ce0c 100644 (file)
@@ -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()
index 684c24d..23166bc 100644 (file)
@@ -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 = "";