[Lldb-commits] [lldb] r278916 - Remove manual packet construction from GDBRemoteRegisterContext::SetPrimordialRegister

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 17 02:12:21 PDT 2016


Author: labath
Date: Wed Aug 17 04:12:21 2016
New Revision: 278916

URL: http://llvm.org/viewvc/llvm-project?rev=278916&view=rev
Log:
Remove manual packet construction from GDBRemoteRegisterContext::SetPrimordialRegister

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp?rev=278916&r1=278915&r2=278916&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp Wed Aug 17 04:12:21 2016
@@ -325,26 +325,13 @@ GDBRemoteRegisterContext::SetPrimordialR
     StreamString packet;
     StringExtractorGDBRemote response;
     const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-    packet.Printf ("P%x=", reg_info->kinds[eRegisterKindProcessPlugin]);
-    packet.PutBytesAsRawHex8 (m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size),
-                              reg_info->byte_size,
-                              endian::InlHostByteOrder(),
-                              endian::InlHostByteOrder());
-
-    if (gdb_comm.GetThreadSuffixSupported())
-        packet.Printf (";thread:%4.4" PRIx64 ";", m_thread.GetProtocolID());
-
     // Invalidate just this register
     SetRegisterIsValid(reg, false);
-    if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
-                                              packet.GetString().size(),
-                                              response,
-                                              false) == GDBRemoteCommunication::PacketResult::Success)
-    {
-        if (response.IsOKResponse())
-            return true;
-    }
-    return false;
+
+    return gdb_comm.WriteRegister(
+        m_thread.GetProtocolID(), reg_info->kinds[eRegisterKindProcessPlugin],
+        llvm::StringRef(reinterpret_cast<const char *>(m_reg_data.PeekData(reg_info->byte_offset, reg_info->byte_size)),
+                        reg_info->byte_size));
 }
 
 void




More information about the lldb-commits mailing list