return S_OK;
}
+HRESULT Debugger::EmitThreadEvent(ThreadEvent event)
+{
+ const char *reasonText = "";
+ switch(event.reason)
+ {
+ case ThreadStarted:
+ reasonText = "thread-created";
+ break;
+ case ThreadExited:
+ reasonText = "thread-exited";
+ break;
+ }
+ Debugger::Printf("=%s,id=\"%i\"\n", reasonText, event.threadId);
+ return S_OK;
+}
+
HRESULT Debugger::HandleCommand(std::string command,
const std::vector<std::string> &args,
std::string &output)
HRESULT EmitStoppedEvent(StoppedEvent event);
HRESULT EmitExitedEvent(ExitedEvent event);
+ HRESULT EmitThreadEvent(ThreadEvent event);
public:
static HRESULT EmitBreakpointEvent(BreakpointEvent event);
{
DWORD threadId = 0;
thread->GetID(&threadId);
- Debugger::Printf("=thread-created,id=\"%i\"\n", (int)threadId);
+ m_debugger->EmitThreadEvent(ThreadEvent(ThreadStarted, threadId));
pAppDomain->Continue(0);
return S_OK;
}
/* [in] */ ICorDebugThread *thread)
{
NotifyEvalComplete(thread, nullptr);
- HandleEvent(pAppDomain, "ExitThread");
+ DWORD threadId = 0;
+ thread->GetID(&threadId);
+ m_debugger->EmitThreadEvent(ThreadEvent(ThreadExited, threadId));
+ pAppDomain->Continue(0);
return S_OK;
}
ExitedEvent(int exitCode) : exitCode(exitCode) {}
};
+
+enum ThreadReason
+{
+ ThreadStarted,
+ ThreadExited
+};
+
+struct ThreadEvent
+{
+ ThreadReason reason;
+ int threadId;
+
+ ThreadEvent(ThreadReason reason, int threadId) : reason(reason), threadId(threadId) {}
+};