Refactor printing process exit info
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Thu, 11 Jan 2018 20:47:17 +0000 (23:47 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Thu, 11 Jan 2018 20:47:17 +0000 (23:47 +0300)
src/debug/netcoredbg/commands.cpp
src/debug/netcoredbg/debugger.h
src/debug/netcoredbg/main.cpp
src/debug/netcoredbg/protocol.h

index e743376..d382bc5 100644 (file)
@@ -394,6 +394,12 @@ HRESULT Debugger::EmitStoppedEvent(StoppedEvent event)
     }
 }
 
+HRESULT Debugger::EmitExitedEvent(ExitedEvent event)
+{
+    Debugger::Printf("*stopped,reason=\"exited\",exit-code=\"%i\"\n", event.exitCode);
+    return S_OK;
+}
+
 HRESULT Debugger::HandleCommand(std::string command,
                                 const std::vector<std::string> &args,
                                 std::string &output)
index 1ba3250..62615f6 100644 (file)
@@ -55,8 +55,8 @@ class Debugger
                                std::string &output, StepType stepType);
 
     HRESULT EmitStoppedEvent(StoppedEvent event);
+    HRESULT EmitExitedEvent(ExitedEvent event);
 
-    
 public:
     static HRESULT EmitBreakpointEvent(BreakpointEvent event);
 
index 6b2151a..b882b2f 100644 (file)
@@ -490,7 +490,7 @@ public:
             /* [in] */ ICorDebugProcess *pProcess)
         {
             NotifyEvalComplete(nullptr, nullptr);
-            Debugger::Printf("*stopped,reason=\"exited\",exit-code=\"%i\"\n", 0);
+            m_debugger->EmitExitedEvent(ExitedEvent(0));
             NotifyProcessExited();
             return S_OK;
         }
index aef50dc..7321278 100644 (file)
@@ -101,3 +101,10 @@ struct BreakpointEvent
 
     BreakpointEvent(BreakpointReason reason, Breakpoint breakpoint) : reason(reason), breakpoint(breakpoint) {}
 };
+
+struct ExitedEvent
+{
+    int exitCode;
+
+    ExitedEvent(int exitCode) : exitCode(exitCode) {}
+};