diff options
author | Greg Clayton <gclayton@apple.com> | 2012-04-13 21:24:18 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-04-13 21:24:18 +0000 |
commit | d451c1a8432f038c42697ae8ed80a4a16d7489d9 (patch) | |
tree | 6844012bb7ad30ec4bb5caa39b98ac97579121cb /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | |
parent | f4db4b2cb4a639f0906abb8602cec49f1dc46de6 (diff) | |
download | bcm5719-llvm-d451c1a8432f038c42697ae8ed80a4a16d7489d9.tar.gz bcm5719-llvm-d451c1a8432f038c42697ae8ed80a4a16d7489d9.zip |
Added the thread ID (tid) to each packet history item and the packet history now always dumps to a lldb_private::Stream.
Enable logging the packet history when registers fail to read due to not getting the sequence mutex if "--verbose" is enabled on the log channel for the "gdb-remote" log category.
This will help us track down some issues.
llvm-svn: 154704
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 0d39e98f428..a6d2d114da9 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -46,6 +46,41 @@ GDBRemoteCommunication::History::~History () } void +GDBRemoteCommunication::History::AddPacket (char packet_char, + PacketType type, + uint32_t bytes_transmitted) +{ + const size_t size = m_packets.size(); + if (size > 0) + { + const uint32_t idx = GetNextIndex(); + m_packets[idx].packet.assign (1, packet_char); + m_packets[idx].type = type; + m_packets[idx].bytes_transmitted = bytes_transmitted; + m_packets[idx].packet_idx = m_total_packet_count; + m_packets[idx].tid = Host::GetCurrentThreadID(); + } +} + +void +GDBRemoteCommunication::History::AddPacket (const std::string &src, + uint32_t src_len, + PacketType type, + uint32_t bytes_transmitted) +{ + const size_t size = m_packets.size(); + if (size > 0) + { + const uint32_t idx = GetNextIndex(); + m_packets[idx].packet.assign (src, 0, src_len); + m_packets[idx].type = type; + m_packets[idx].bytes_transmitted = bytes_transmitted; + m_packets[idx].packet_idx = m_total_packet_count; + m_packets[idx].tid = Host::GetCurrentThreadID(); + } +} + +void GDBRemoteCommunication::History::Dump (lldb_private::Stream &strm) const { const uint32_t size = GetNumPacketsInHistory (); @@ -57,8 +92,9 @@ GDBRemoteCommunication::History::Dump (lldb_private::Stream &strm) const const Entry &entry = m_packets[idx]; if (entry.type == ePacketTypeInvalid || entry.packet.empty()) break; - strm.Printf ("history[%u] <%4u> %s packet: %s\n", + strm.Printf ("history[%u] tid=0x%4.4llx <%4u> %s packet: %s\n", entry.packet_idx, + entry.tid, entry.bytes_transmitted, (entry.type == ePacketTypeSend) ? "send" : "read", entry.packet.c_str()); @@ -80,8 +116,9 @@ GDBRemoteCommunication::History::Dump (lldb_private::Log *log) const const Entry &entry = m_packets[idx]; if (entry.type == ePacketTypeInvalid || entry.packet.empty()) break; - log->Printf ("history[%u] <%4u> %s packet: %s", + log->Printf ("history[%u] tid=0x%4.4llx <%4u> %s packet: %s", entry.packet_idx, + entry.tid, entry.bytes_transmitted, (entry.type == ePacketTypeSend) ? "send" : "read", entry.packet.c_str()); @@ -598,12 +635,7 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *debugserver_url, } void -GDBRemoteCommunication::DumpHistory(const char *path) +GDBRemoteCommunication::DumpHistory(Stream &strm) { - StreamFile strm; - Error error (strm.GetFile().Open(path, File::eOpenOptionWrite | File::eOpenOptionCanCreate)); - if (error.Success()) - m_history.Dump (strm); - else - fprintf (stderr, "error: unable to open '%s' -- %s\n", path, error.AsCString()); + m_history.Dump (strm); } |