Author: hans Date: Tue Aug 11 16:02:29 2015 New Revision: 244664 URL: http://llvm.org/viewvc/llvm-project?rev=244664&view=rev Log: 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 ------------------------------------------------------------------------ Modified: lldb/branches/release_37/ (props changed) lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Propchange: lldb/branches/release_37/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Aug 11 16:02:29 2015 @@ -1,3 +1,3 @@ /lldb/branches/apple/python-GIL:156467-162159 /lldb/branches/iohandler:198360-200250 -/lldb/trunk:242306,242381,242525,242529,243618 +/lldb/trunk:242306,242381,242525,242529,243091,243618 Modified: lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=244664&r1=244663&r2=244664&view=diff ============================================================================== --- lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/branches/release_37/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Aug 11 16:02:29 2015 @@ -371,7 +371,7 @@ ProcessGDBRemote::ProcessGDBRemote(Targe 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 (Str } } + 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 (Str 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; _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits