RegisterContextSP ThreadMemory::GetRegisterContext () { if (!m_reg_context_sp) { ProcessSP process_sp (GetProcess()); if (process_sp) { OperatingSystem *os = process_sp->GetOperatingSystem (); if (os) m_reg_context_sp = os->CreateRegisterContextForThread (this); } } return m_reg_context_sp; }
void RegisterContextThreadMemory::UpdateRegisterContext () { ThreadSP thread_sp (m_thread_wp.lock()); if (thread_sp) { ProcessSP process_sp (thread_sp->GetProcess()); if (process_sp) { const uint32_t stop_id = process_sp->GetModID().GetStopID(); if (m_stop_id != stop_id) { m_stop_id = stop_id; m_reg_ctx_sp.reset(); } if (!m_reg_ctx_sp) { ThreadSP backing_thread_sp (thread_sp->GetBackingThread()); if (backing_thread_sp) { m_reg_ctx_sp = backing_thread_sp->GetRegisterContext(); } else { OperatingSystem *os = process_sp->GetOperatingSystem (); if (os->IsOperatingSystemPluginThread (thread_sp)) m_reg_ctx_sp = os->CreateRegisterContextForThread (thread_sp.get(), LLDB_INVALID_ADDRESS); } } } else { m_reg_ctx_sp.reset(); } } else { m_reg_ctx_sp.reset(); } }