[Lldb-commits] [lldb] r145920 - in /lldb/trunk/source/Plugins/Process/gdb-remote: ProcessGDBRemote.cpp ProcessGDBRemote.h
Greg Clayton
gclayton at apple.com
Mon Dec 5 20:51:14 PST 2011
Author: gclayton
Date: Mon Dec 5 22:51:14 2011
New Revision: 145920
URL: http://llvm.org/viewvc/llvm-project?rev=145920&view=rev
Log:
<rdar://problem/10487848>
Protect a member variable from being modified by multiple threads.
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=145920&r1=145919&r2=145920&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Dec 5 22:51:14 2011
@@ -123,6 +123,7 @@
m_gdb_comm(false),
m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
m_last_stop_packet (),
+ m_last_stop_packet_mutex (Mutex::eMutexTypeNormal),
m_register_info (),
m_async_broadcaster ("lldb.process.gdb-remote.async-broadcaster"),
m_async_thread (LLDB_INVALID_HOST_THREAD),
@@ -1548,7 +1549,7 @@
if (packet_cmd == 'W' || packet_cmd == 'X')
{
- m_last_stop_packet = response;
+ SetLastStopPacket (response);
SetExitStatus(response.GetHexU8(), NULL);
}
}
@@ -2353,12 +2354,12 @@
case eStateStopped:
case eStateCrashed:
case eStateSuspended:
- process->m_last_stop_packet = response;
+ process->SetLastStopPacket (response);
process->SetPrivateState (stop_state);
break;
case eStateExited:
- process->m_last_stop_packet = response;
+ process->SetLastStopPacket (response);
response.SetFilePos(1);
process->SetExitStatus(response.GetHexU8(), NULL);
done = true;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=145920&r1=145919&r2=145920&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Mon Dec 5 22:51:14 2011
@@ -271,6 +271,12 @@
return m_gdb_comm;
}
+ void
+ SetLastStopPacket (const StringExtractorGDBRemote &response)
+ {
+ lldb_private::Mutex::Locker locker (m_last_stop_packet_mutex);
+ m_last_stop_packet = response;
+ }
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -284,6 +290,7 @@
GDBRemoteCommunicationClient m_gdb_comm;
lldb::pid_t m_debugserver_pid;
StringExtractorGDBRemote m_last_stop_packet;
+ lldb_private::Mutex m_last_stop_packet_mutex;
GDBRemoteDynamicRegisterInfo m_register_info;
lldb_private::Broadcaster m_async_broadcaster;
lldb::thread_t m_async_thread;
More information about the lldb-commits
mailing list