summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2015-08-11 21:02:29 +0000
committerHans Wennborg <hans@hanshq.net>2015-08-11 21:02:29 +0000
commitc6919371b8d5ac232bd6216d4d873a1553d1c781 (patch)
treeabbd129e543b33332e2ea1b9a6417b18ad94ee9a
parent9c21f46d51b079391976d798bb79fae1317e9422 (diff)
Merging r243091:
------------------------------------------------------------------------ r243091 | bhushan.attarde | 2015-07-23 21:06:20 -0700 (Thu, 23 Jul 2015) | 10 lines 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 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/lldb/branches/release_37@244664 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index ce446316c..fc34c3e4d 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/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),
@@ -2447,6 +2447,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,
@@ -2461,19 +2473,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;