summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2015-07-24 04:06:20 +0000
committerBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2015-07-24 04:06:20 +0000
commit1e271df0412252eec259f76d5cb69af0a3482ab8 (patch)
treed3ec47e5a71702492dd625d1343ce7d9807e7de9 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parenta68a78751fb0d4eb7eb047365a66ea9becbc6a28 (diff)
downloadbcm5719-llvm-1e271df0412252eec259f76d5cb69af0a3482ab8.tar.gz
bcm5719-llvm-1e271df0412252eec259f76d5cb69af0a3482ab8.zip
Handle old style S packet correctly
SUMMARY: This patch fixes couple of issues: 1. A thread tries to lock a mutex which is already locked. 2. Updating a thread list before the stop packet is parsed so that it can get a valid thread id and allows to set the stop info correctly. Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits Differential Revision: http://reviews.llvm.org/D11449 llvm-svn: 243091
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 4207df681c1..0b31b097933 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -371,7 +371,7 @@ ProcessGDBRemote::ProcessGDBRemote(Target& target, Listener &listener) :
m_flags (0),
m_gdb_comm (),
m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
- m_last_stop_packet_mutex (Mutex::eMutexTypeNormal),
+ m_last_stop_packet_mutex (Mutex::eMutexTypeRecursive),
m_register_info (),
m_async_broadcaster (NULL, "lldb.process.gdb-remote.async-broadcaster"),
m_async_thread_state_mutex(Mutex::eMutexTypeRecursive),
@@ -2485,6 +2485,18 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
}
}
+ if (tid == LLDB_INVALID_THREAD_ID)
+ {
+ // A thread id may be invalid if the response is old style 'S' packet which does not provide the
+ // thread information. So update the thread list and choose the first one.
+ UpdateThreadIDList ();
+
+ if (!m_thread_ids.empty ())
+ {
+ tid = m_thread_ids.front ();
+ }
+ }
+
ThreadSP thread_sp = SetThreadStopInfo (tid,
expedited_register_map,
signo,
@@ -2499,19 +2511,6 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
queue_kind,
queue_serial);
- // If the response is old style 'S' packet which does not provide us with thread information
- // then update the thread list and choose the first one.
- if (!thread_sp)
- {
- UpdateThreadIDList ();
-
- if (!m_thread_ids.empty ())
- {
- Mutex::Locker locker (m_thread_list_real.GetMutex ());
- thread_sp = m_thread_list_real.FindThreadByProtocolID (m_thread_ids.front (), false);
- }
- }
-
return eStateStopped;
}
break;
OpenPOWER on IntegriCloud