diff options
author | Greg Clayton <gclayton@apple.com> | 2013-05-01 21:54:04 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-05-01 21:54:04 +0000 |
commit | 160c9d81e07fec2d6299a9f31bb004f1b97419a6 (patch) | |
tree | 01aef16f7f4a45a2eb3c37b5083eda3c8e9cc429 /lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp | |
parent | 5ed5181178f256f99954f2662547658a49335088 (diff) | |
download | llvm-160c9d81e07fec2d6299a9f31bb004f1b97419a6.zip llvm-160c9d81e07fec2d6299a9f31bb004f1b97419a6.tar.gz llvm-160c9d81e07fec2d6299a9f31bb004f1b97419a6.tar.bz2 |
<rdar://problem/13700260>
<rdar://problem/13723772>
Modified the lldb_private::Thread to work much better with the OperatingSystem plug-ins. Operating system plug-ins can now return have a "core" key/value pair in each thread dictionary for the OperatingSystemPython plug-ins which allows the core threads to be contained with memory threads. It also allows these memory threads to be stepped, resumed, and controlled just as if they were the actual backing threads themselves.
A few things are introduced:
- lldb_private::Thread now has a GetProtocolID() method which returns the thread protocol ID for a given thread. The protocol ID (Thread::GetProtocolID()) is usually the same as the thread id (Thread::GetID()), but it can differ when a memory thread has its own id, but is backed by an actual API thread.
- Cleaned up the Thread::WillResume() code to do the mandatory parts in Thread::ShouldResume(), and let the thread subclasses override the Thread::WillResume() which is now just a notification.
- Cleaned up ClearStackFrames() implementations so that fewer thread subclasses needed to override them
- Changed the POSIXThread class a bit since it overrode Thread::WillResume(). It is doing the wrong thing by calling "Thread::SetResumeState()" on its own, this shouldn't be done by thread subclasses, but the current code might rely on it so I left it in with a TODO comment with an explanation.
llvm-svn: 180886
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp index f1084d6..321fe8d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -80,24 +80,14 @@ ThreadGDBRemote::GetQueueName () return NULL; } -bool +void ThreadGDBRemote::WillResume (StateType resume_state) { - // Call the Thread::WillResume first. If we stop at a signal, the stop info - // class for signal will set the resume signal that we need below. The signal - // stuff obeys the Process::UnixSignal defaults. - // If the thread's WillResume returns false, that means that we aren't going to actually resume, - // in which case we should not do the rest of our "resume" work. - - if (!Thread::WillResume(resume_state)) - return false; - - ClearStackFrames(); - int signo = GetResumeSignal(); + const lldb::user_id_t tid = GetProtocolID(); Log *log(lldb_private::GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); if (log) - log->Printf ("Resuming thread: %4.4" PRIx64 " with state: %s.", GetID(), StateAsCString(resume_state)); + log->Printf ("Resuming thread: %4.4" PRIx64 " with state: %s.", tid, StateAsCString(resume_state)); ProcessSP process_sp (GetProcess()); if (process_sp) @@ -112,24 +102,22 @@ ThreadGDBRemote::WillResume (StateType resume_state) case eStateRunning: if (gdb_process->GetUnixSignals().SignalIsValid (signo)) - gdb_process->m_continue_C_tids.push_back(std::make_pair(GetID(), signo)); + gdb_process->m_continue_C_tids.push_back(std::make_pair(tid, signo)); else - gdb_process->m_continue_c_tids.push_back(GetID()); + gdb_process->m_continue_c_tids.push_back(tid); break; case eStateStepping: if (gdb_process->GetUnixSignals().SignalIsValid (signo)) - gdb_process->m_continue_S_tids.push_back(std::make_pair(GetID(), signo)); + gdb_process->m_continue_S_tids.push_back(std::make_pair(tid, signo)); else - gdb_process->m_continue_s_tids.push_back(GetID()); + gdb_process->m_continue_s_tids.push_back(tid); break; default: break; } - return true; } - return false; } void @@ -147,16 +135,6 @@ ThreadGDBRemote::RefreshStateAfterStop() GetRegisterContext()->InvalidateIfNeeded (force); } -void -ThreadGDBRemote::ClearStackFrames () -{ - Unwind *unwinder = GetUnwinder (); - if (unwinder) - unwinder->Clear(); - Thread::ClearStackFrames(); -} - - bool ThreadGDBRemote::ThreadIDIsValid (lldb::tid_t thread) { @@ -245,7 +223,7 @@ ThreadGDBRemote::GetPrivateStopReason () StringExtractorGDBRemote stop_packet; ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get()); - if (gdb_process->GetGDBRemote().GetThreadStopInfo(GetID(), stop_packet)) + if (gdb_process->GetGDBRemote().GetThreadStopInfo(GetProtocolID(), stop_packet)) gdb_process->SetThreadStopInfo (stop_packet); } } |