From c1c19a6f0266f77c6177f5f54c9955be5abc93d8 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 19 Apr 2012 16:57:50 +0000 Subject: In debug mode, assert when we fail to get the sequence mutex. We need to remove as many places where this can happen as possible. llvm-svn: 155138 --- .../gdb-remote/GDBRemoteRegisterContext.cpp | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp') diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 7ace1ebe477..70ffacbcc4e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -245,6 +245,12 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE 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 register."); +#else if (log) { if (log->GetVerbose()) @@ -258,6 +264,7 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE log->Printf("error: failed to get packet sequence mutex, not sending read register for \"%s\"", reg_info->name); } } +#endif } // Make sure we got a valid register value after reading it @@ -441,6 +448,12 @@ 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."); +#else if (log) { if (log->GetVerbose()) @@ -452,6 +465,7 @@ 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; @@ -511,6 +525,12 @@ 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."); +#else if (log) { if (log->GetVerbose()) @@ -522,6 +542,7 @@ 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(); @@ -644,12 +665,14 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data else { LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); - if (log) + if (1 /* log */) { - if (log->GetVerbose()) + if (1 /*log->GetVerbose() */) { StreamString strm; gdb_comm.DumpHistory(strm); + Host::SetCrashDescription (strm.GetData()); + assert (!"Didn't get sequence mutex."); log->Printf("error: failed to get packet sequence mutex, not sending write all registers:\n%s", strm.GetData()); } else -- cgit v1.2.3