MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / DoBreak

Method DoBreak

src/hx/Debugger.cpp:275–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273
274
275 void DoBreak(DebugStatus status, int breakpoint, const String *criticalErrorDescription)
276 {
277 // Update status
278 mStatus = status;
279 mBreakpoint = breakpoint;
280 if (criticalErrorDescription)
281 mCriticalError = criticalErrorDescription->makePermanent();
282
283 // This thread cannot stop while making the callback
284 mCanStop = false;
285
286 mWaitMutex.lock();
287 mWaiting = true;
288 mWaitMutex.unlock();
289
290 // Call the handler to announce the status.
291 StackFrame *frame = mStackContext->getCurrentStackFrame();
292 // Record this before g_eventNotificationHandler is run, since it might change in there
293 mStackContext->mDebugger->mStepLevel = mStackContext->getDepth();
294 g_eventNotificationHandler
295 (mThreadNumber, THREAD_STOPPED, mStackContext->mDebugger->mStepLevel,
296 String(frame->position->className), String(frame->position->functionName),
297 String(frame->position->fileName), frame->lineNumber);
298
299 if (mWaiting)
300 {
301 // Wait until the debugger thread sets mWaiting to false and signals
302 // the semaphore
303 mWaitMutex.lock();
304
305 while (mWaiting) {
306 mWaitMutex.unlock();
307 hx::EnterGCFreeZone();
308 mWaitSemaphore.Wait();
309 hx::ExitGCFreeZone();
310 mWaitMutex.lock();
311 }
312
313 mWaitMutex.unlock();
314 }
315
316 // Save the breakpoint status in the call stack so that queries for
317 // thread info will know the current status of the thread
318 mStatus = DBG_STATUS_RUNNING;
319 mBreakpoint = -1;
320
321 // Announce the new status
322 Dynamic handler = hx::g_eventNotificationHandler;
323 if (handler!=null())
324 handler(mThreadNumber, THREAD_STARTED);
325
326 // Can stop again
327 mCanStop = true;
328 }
329
330
331 // Wait for someone to call Continue() on this call stack. Really only

Callers 2

BreakMethod · 0.95

Calls 7

EnterGCFreeZoneFunction · 0.85
ExitGCFreeZoneFunction · 0.85
getCurrentStackFrameMethod · 0.80
getDepthMethod · 0.80
StringClass · 0.50
nullClass · 0.50
WaitMethod · 0.45

Tested by

no test coverage detected