bool
ThreadPlanCallFunction::BreakpointsExplainStop()
{
    StopInfoSP stop_info_sp = GetPrivateStopInfo ();
    
    if (stop_info_sp->GetStopReason() != eStopReasonBreakpoint)
        return false;

    if (m_trap_exceptions)
    {
        if ((m_cxx_language_runtime &&
                m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))
           ||(m_objc_language_runtime &&
                m_objc_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp)))
        {
            Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
            if (log)
                log->Printf ("ThreadPlanCallFunction::BreakpointsExplainStop - Hit an exception breakpoint, setting plan complete.");
            
            SetPlanComplete(false);
            
            // If the user has set the ObjC language breakpoint, it would normally get priority over our internal
            // catcher breakpoint, but in this case we can't let that happen, so force the ShouldStop here.
            stop_info_sp->OverrideShouldStop (true);
            return true;
        }
    }
    if (m_error_backstop_bp_sp)
    {
        ProcessSP process_sp (m_thread.CalculateProcess());
        if (process_sp)
        {
            uint64_t break_site_id = stop_info_sp->GetValue();
            if (process_sp->GetBreakpointSiteList().BreakpointSiteContainsBreakpoint (break_site_id,
                                                                                      m_error_backstop_bp_sp->GetID()))
            {
                // Our expression threw an uncaught exception.  That will happen in REPL & Playground, though not in
                // the regular expression parser.  In that case, we should fetch the actual return value from the
                // argument passed to this function, and set that as the return value.
                SetPlanComplete(true);
                StackFrameSP frame_sp = m_thread.GetStackFrameAtIndex(0);
                PersistentExpressionState *persistent_state = GetTarget().GetPersistentExpressionStateForLanguage(eLanguageTypeSwift);
                const bool is_error = true;
                ConstString persistent_variable_name (persistent_state->GetNextPersistentVariableName(is_error));
                m_return_valobj_sp = SwiftLanguageRuntime::CalculateErrorValueFromFirstArgument(frame_sp,
                                                                                                persistent_variable_name);
                
                DataExtractor data;
                Error data_error;
                size_t data_size = m_return_valobj_sp->GetStaticValue()->GetData(data, data_error);
                
                if (data_size == data.GetAddressByteSize())
                {
                    lldb::offset_t offset = 0;
                    lldb::addr_t addr = data.GetAddress(&offset);
                    
                    SwiftLanguageRuntime::RegisterGlobalError(GetTarget(), persistent_variable_name, addr);
                }
                
                m_hit_error_backstop = true;
                return true;
            }
        }
    }
    
    return false;
}