diff options
author | Greg Clayton <gclayton@apple.com> | 2011-05-20 23:38:13 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-05-20 23:38:13 +0000 |
commit | adc00cb2ba7b0dc51dab45b4440f504e6e049369 (patch) | |
tree | 4ab51d3b2fc83db800f2c84961516451ab842b9c /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | d7ee0fcac992a0eced1902b643c1eca91aba565e (diff) | |
download | bcm5719-llvm-adc00cb2ba7b0dc51dab45b4440f504e6e049369.tar.gz bcm5719-llvm-adc00cb2ba7b0dc51dab45b4440f504e6e049369.zip |
Centralize the code that gathers the thread ID list from the remote GDB
server so that it happens in command sequence where no other packets can
sneak between.
llvm-svn: 131769
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 58799f7011a..5cfc52a6675 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1052,37 +1052,26 @@ ProcessGDBRemote::UpdateThreadListIfNeeded () ThreadList curr_thread_list (this); curr_thread_list.SetStopID(stop_id); - Error err; - StringExtractorGDBRemote response; - for (m_gdb_comm.SendPacketAndWaitForResponse("qfThreadInfo", response, false); - response.IsNormalResponse(); - m_gdb_comm.SendPacketAndWaitForResponse("qsThreadInfo", response, false)) + std::vector<lldb::tid_t> thread_ids; + bool sequence_mutex_unavailable = false; + const size_t num_thread_ids = m_gdb_comm.GetCurrentThreadIDs (thread_ids, sequence_mutex_unavailable); + if (num_thread_ids > 0) { - char ch = response.GetChar(); - if (ch == 'l') - break; - if (ch == 'm') + for (size_t i=0; i<num_thread_ids; ++i) { - do - { - tid_t tid = response.GetHexMaxU32(false, LLDB_INVALID_THREAD_ID); - - if (tid != LLDB_INVALID_THREAD_ID) - { - ThreadSP thread_sp (GetThreadList().FindThreadByID (tid, false)); - if (!thread_sp) - thread_sp.reset (new ThreadGDBRemote (*this, tid)); - curr_thread_list.AddThread(thread_sp); - } - - ch = response.GetChar(); - } while (ch == ','); + tid_t tid = thread_ids[i]; + ThreadSP thread_sp (GetThreadList().FindThreadByID (tid, false)); + if (!thread_sp) + thread_sp.reset (new ThreadGDBRemote (*this, tid)); + curr_thread_list.AddThread(thread_sp); } } - m_thread_list = curr_thread_list; - - SetThreadStopInfo (m_last_stop_packet); + if (sequence_mutex_unavailable == false) + { + m_thread_list = curr_thread_list; + SetThreadStopInfo (m_last_stop_packet); + } } return GetThreadList().GetSize(false); } |