summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-06-08 22:50:40 +0000
committerJim Ingham <jingham@apple.com>2012-06-08 22:50:40 +0000
commit4ceb928f022d16ba7db1521bd2e8722dd41ec1c4 (patch)
treecb66cc83d3be5dad4c2f0b83abeabf220d78714a /lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
parentd8d56694352c972bfb1e13bdc562b3d27b29f4ea (diff)
downloadbcm5719-llvm-4ceb928f022d16ba7db1521bd2e8722dd41ec1c4.tar.gz
bcm5719-llvm-4ceb928f022d16ba7db1521bd2e8722dd41ec1c4.zip
Change the Mutex::Locker class so that it takes the Mutex object and locks it, rather
than being given the pthread_mutex_t from the Mutex and locks that. That allows us to track ownership of the Mutex better. Used this to switch the LLDB_CONFIGURATION_DEBUG enabled assert when we can't get the gdb-remote sequence mutex to assert when the thread that had the mutex releases it. This is generally more useful information than saying just who failed to get it (since the code that had it locked often had released it by the time the assert fired.) llvm-svn: 158240
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp29
1 files changed, 4 insertions, 25 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index 9eec09d0b5c..4247add8554 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -183,7 +183,7 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE
if (!m_reg_valid[reg])
{
Mutex::Locker locker;
- if (gdb_comm.GetSequenceMutex (locker))
+ if (gdb_comm.GetSequenceMutex (locker, "Didn't get sequence mutex for read register."))
{
const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported();
ProcessSP process_sp (m_thread.GetProcess());
@@ -357,7 +357,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo *
m_reg_data.GetByteOrder())) // dst byte order
{
Mutex::Locker locker;
- if (gdb_comm.GetSequenceMutex (locker))
+ if (gdb_comm.GetSequenceMutex (locker, "Didn't get sequence mutex for write register."))
{
const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported();
ProcessSP process_sp (m_thread.GetProcess());
@@ -445,12 +445,6 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo *
else
{
LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS));
-#if LLDB_CONFIGURATION_DEBUG
- StreamString strm;
- gdb_comm.DumpHistory(strm);
- Host::SetCrashDescription (strm.GetData());
- assert (!"Didn't get sequence mutex for write register.");
-#else
if (log)
{
if (log->GetVerbose())
@@ -462,7 +456,6 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo *
else
log->Printf("error: failed to get packet sequence mutex, not sending write register for \"%s\"", reg_info->name);
}
-#endif
}
}
return false;
@@ -484,7 +477,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
StringExtractorGDBRemote response;
Mutex::Locker locker;
- if (gdb_comm.GetSequenceMutex (locker))
+ if (gdb_comm.GetSequenceMutex (locker, "Didn't get sequence mutex for read all registers."))
{
char packet[32];
const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported();
@@ -522,12 +515,6 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
else
{
LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS));
-#if LLDB_CONFIGURATION_DEBUG
- StreamString strm;
- gdb_comm.DumpHistory(strm);
- Host::SetCrashDescription (strm.GetData());
- assert (!"Didn't get sequence mutex for read all registers.");
-#else
if (log)
{
if (log->GetVerbose())
@@ -539,7 +526,6 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
else
log->Printf("error: failed to get packet sequence mutex, not sending read all registers");
}
-#endif
}
data_sp.reset();
@@ -563,7 +549,7 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data
StringExtractorGDBRemote response;
Mutex::Locker locker;
- if (gdb_comm.GetSequenceMutex (locker))
+ if (gdb_comm.GetSequenceMutex (locker, "Didn't get sequence mutex for write all registers."))
{
const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported();
ProcessSP process_sp (m_thread.GetProcess());
@@ -662,12 +648,6 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data
else
{
LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS));
-#if LLDB_CONFIGURATION_DEBUG
- StreamString strm;
- gdb_comm.DumpHistory(strm);
- Host::SetCrashDescription (strm.GetData());
- assert (!"Didn't get sequence mutex for write all registers.");
-#else
if (log)
{
if (log->GetVerbose())
@@ -679,7 +659,6 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data
else
log->Printf("error: failed to get packet sequence mutex, not sending write all registers");
}
-#endif
}
return false;
}
OpenPOWER on IntegriCloud