diff options
author | Greg Clayton <gclayton@apple.com> | 2013-05-04 01:38:48 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-05-04 01:38:48 +0000 |
commit | 1b7746e383ca68d09974947eeca6c17bb132a46a (patch) | |
tree | 53186b955d465615e149dbb60b4c29ca17135d8b /lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp | |
parent | cd410d04dbeb373f0762b167b2a202746e8a8eaf (diff) | |
download | bcm5719-llvm-1b7746e383ca68d09974947eeca6c17bb132a46a.tar.gz bcm5719-llvm-1b7746e383ca68d09974947eeca6c17bb132a46a.zip |
After recent OperatingsSystem plug-in changes, the lldb_private::Process and lldb_private::Thread subclasses were changed and the API was not respected properly.
This checkin aims to fix this. The process now has two thread lists: a real thread list for threads that are created by the lldb_private::Process subclass, and the user visible threads. The user visible threads are the same as the real threas when no OS plug-in in used. But when an OS plug-in is used, the user thread can be a combination of real and "memory" threads. Real threads can be placed inside of memory threads so that a thread appears to be different, but is still controlled by the actual real thread. When the thread list needs updating, the lldb_private::Process class will call the: lldb_private::Process::UpdateThreadList() function with the old real thread list, and the function is expected to fill in the new real thread list with the current state of the process. After this function, the process will check if there is an OS plug-in being used, and if so, it will give the old user thread list, the new real thread list and the OS plug-in will create the new user thread list from both of these lists. If there is no OS plug-in, the real thread list is the user thread list.
These changes keep the lldb_private::Process subclasses clean and no changes are required.
llvm-svn: 181091
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index 321fe8d819a..40b367c3993 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -204,27 +204,46 @@ ThreadGDBRemote::GetPrivateStopReason () 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 (m_thread_stop_reason_stop_id == process_stop_id) + { + // Our stop info is up to date even if it is empty... + return m_actual_stop_info_sp; + } + + if (m_actual_stop_info_sp && m_actual_stop_info_sp->IsValid()) + { + // The stop info is up to date, reset it so everything updates + SetStopInfo (m_actual_stop_info_sp); + } + else { if (IsStillAtLastBreakpointHit()) - return m_actual_stop_info_sp; - - // 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(); - - StringExtractorGDBRemote stop_packet; - ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get()); - if (gdb_process->GetGDBRemote().GetThreadStopInfo(GetProtocolID(), stop_packet)) - gdb_process->SetThreadStopInfo (stop_packet); + { + SetStopInfo(m_actual_stop_info_sp); + } + else + { + // 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_actual_stop_info_sp.reset(); + + StringExtractorGDBRemote stop_packet; + ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get()); + if (gdb_process->GetGDBRemote().GetThreadStopInfo(GetProtocolID(), stop_packet)) + { + gdb_process->SetThreadStopInfo (stop_packet); + } + else + { + SetStopInfo (StopInfoSP()); + } + } } } return m_actual_stop_info_sp; |