Note that HandleBreakpoints is called immediately after a read memory barrier by the HX_STACK_LINE macro
| 558 | // Note that HandleBreakpoints is called immediately after a read memory |
| 559 | // barrier by the HX_STACK_LINE macro |
| 560 | static void HandleBreakpoints(hx::StackContext *stack) |
| 561 | { |
| 562 | // This will be set to a valid status if a stop is needed |
| 563 | DebugStatus breakStatus = DBG_STATUS_INVALID; |
| 564 | int breakpointNumber = -1; |
| 565 | |
| 566 | |
| 567 | // The debug thread never breaks |
| 568 | if (stack->mThreadId == g_debugThreadNumber) { |
| 569 | return; |
| 570 | } |
| 571 | |
| 572 | if (sExecutionTrace==exeTraceLines) |
| 573 | stack->tracePosition(); |
| 574 | |
| 575 | // Handle possible immediate break |
| 576 | if (gStepType == STEP_NONE) { |
| 577 | // No stepping |
| 578 | } |
| 579 | else if (gStepType == STEP_INTO) { |
| 580 | if ((gStepThread == -1) || |
| 581 | (gStepThread == stack->mThreadId)) { |
| 582 | breakStatus = DBG_STATUS_STOPPED_BREAK_IMMEDIATE; |
| 583 | } |
| 584 | } |
| 585 | else { |
| 586 | if ((gStepThread == -1) || |
| 587 | (gStepThread == stack->mThreadId)) { |
| 588 | if (gStepType == STEP_OVER) { |
| 589 | if (stack->getDepth() <= gStepLevel) { |
| 590 | breakStatus = DBG_STATUS_STOPPED_BREAK_IMMEDIATE; |
| 591 | } |
| 592 | } |
| 593 | else { // (gStepType == STEP_OUT) |
| 594 | if (stack->getDepth() < gStepLevel) { |
| 595 | breakStatus = DBG_STATUS_STOPPED_BREAK_IMMEDIATE; |
| 596 | } |
| 597 | } |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | // If didn't hit any immediate breakpoints, check for set breakpoints |
| 602 | if (breakStatus == DBG_STATUS_INVALID) { |
| 603 | Breakpoints *breakpoints = stack->mDebugger->mBreakpoints; |
| 604 | // If the current thread has never gotten a reference to |
| 605 | // breakpoints, get a reference to the current breakpoints |
| 606 | if (!breakpoints) { |
| 607 | gMutex.lock(); |
| 608 | // Get break points and ref it |
| 609 | breakpoints = gBreakpoints; |
| 610 | // This read memory barrier ensures that old values within |
| 611 | // gBreakpoints are not seen after gBreakpoints has been set |
| 612 | // here |
| 613 | read_memory_barrier(); |
| 614 | stack->mDebugger->mBreakpoints = breakpoints; |
| 615 | breakpoints->AddRef(); |
| 616 | gMutex.unlock(); |
| 617 | } |
nothing calls this directly
no test coverage detected