I'm using the debugger engine to track when a local process crashes and force minidump and produce a crash report. All is good and work when I use only a single thread to do all the work but when I move the events loop to a separate thread, the debugger engine stop calling my event callback.
I tried to move the code that sets the event callbacks from my initialization code to the same thread but that didn't work either.
Any ideas?
bool gDebugger_PC::AttachToTarget(unsigned long processId, bool nonInvasive, bool noSuspend){ __ASSERT(m_dbgClient && m_dbgSymbols && m_dbgControl && m_dbgSysObjects); HRESULT hr; unsigned long attachFlags = 0; // Figure out which flags to use [...] // Attach to the target if (FAILED(hr = m_dbgClient->AttachProcess(0, processId, attachFlags))) { // [TTY Output Code ...] return false; }/*===> IF I LEAVE THE EVENT LOOP HERE, ALL IS GOOD AND EVERYBODY IS HAPPY */ /*while (true) m_dbgControl->WaitForEvent(0, WAIT_FOR_EVENT_TIMEOUT);*/ // The debug engine will finish attaching to the target process once an event has been processed. // Creating the event thread ::CreateThread(0, 0, EventsThreadEntry, (void *) this, 0, &m_eventThreadId); // [TTY Output Code ...] return true;}void gDebugger_PC::EventsThread(){ /*===> TRYING TO SET THE EVENT CALLBACKS IN THE SAME THREAD DOESN'T WORK if (FAILED(m_dbgClient->SetEventCallbacks((PDEBUG_EVENT_CALLBACKS) this))) // [TTY Output Code ...] */ while (true) m_dbgControl->WaitForEvent(0, WAIT_FOR_EVENT_TIMEOUT);}DWORD WINAPI gDebugger_PC::EventsThreadEntry(LPVOID param){ ((gDebugger_PC *) param)->EventsThread(); return 0;}
Thanks,
-Roxy