lldb::StopInfoSP ThreadMemory::GetPrivateStopReason () { ProcessSP process_sp (GetProcess()); if (process_sp) { const uint32_t process_stop_id = process_sp->GetStopID(); if (m_thread_stop_reason_stop_id != process_stop_id || (m_actual_stop_info_sp && !m_actual_stop_info_sp->IsValid())) { // If GetGDBProcess().SetThreadStopInfo() doesn't find a stop reason // for this thread, then m_actual_stop_info_sp will not ever contain // a valid stop reason and the "m_actual_stop_info_sp->IsValid() == false" // check will never be able to tell us if we have the correct stop info // for this thread and we will continually send qThreadStopInfo packets // down to the remote GDB server, so we need to keep our own notion // of the stop ID that m_actual_stop_info_sp is valid for (even if it // contains nothing). We use m_thread_stop_reason_stop_id for this below. m_thread_stop_reason_stop_id = process_stop_id; m_actual_stop_info_sp.reset(); OperatingSystem *os = process_sp->GetOperatingSystem (); if (os) m_actual_stop_info_sp = os->CreateThreadStopReason (this); } } return m_actual_stop_info_sp; }
bool ThreadMemory::CalculateStopInfo () { if (m_backing_thread_sp) { lldb::StopInfoSP backing_stop_info_sp (m_backing_thread_sp->GetPrivateStopInfo()); if (backing_stop_info_sp && backing_stop_info_sp->IsValidForOperatingSystemThread(*this)) { backing_stop_info_sp->SetThread (shared_from_this()); SetStopInfo (backing_stop_info_sp); return true; } } else { ProcessSP process_sp (GetProcess()); if (process_sp) { OperatingSystem *os = process_sp->GetOperatingSystem (); if (os) { SetStopInfo (os->CreateThreadStopReason (this)); return true; } } } return false; }