Jump to content
  • Advertisement
Sign in to follow this  
Roxypinky

Multithread & Debugger Engine

This topic is 2932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All,

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

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!