[Lldb-commits] [lldb] r190007 - Fixed detection of 'p' packet support in debugserver,

Sean Callanan scallanan at apple.com
Wed Sep 4 16:24:15 PDT 2013


Author: spyffe
Date: Wed Sep  4 18:24:15 2013
New Revision: 190007

URL: http://llvm.org/viewvc/llvm-project?rev=190007&view=rev
Log:
Fixed detection of 'p' packet support in debugserver,
by appending the thread ID to the test packet when
debugserver requires it.

This allows register writing (and, by extension,
expressions) to work on Mac OS X.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=190007&r1=190006&r2=190007&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Sep  4 18:24:15 2013
@@ -300,14 +300,22 @@ GDBRemoteCommunicationClient::GetVContSu
 // Check if the target supports 'p' packet. It sends out a 'p'
 // packet and checks the response. A normal packet will tell us
 // that support is available.
+//
+// Takes a valid thread ID because p needs to apply to a thread.
 bool
-GDBRemoteCommunicationClient::GetpPacketSupported ()
+GDBRemoteCommunicationClient::GetpPacketSupported (lldb::tid_t tid)
 {
     if (m_supports_p == eLazyBoolCalculate)
     {
         StringExtractorGDBRemote response;
         m_supports_p = eLazyBoolNo;
-        if (SendPacketAndWaitForResponse("p0", response, false))
+        char packet[256];
+        if (GetThreadSuffixSupported())
+            snprintf(packet, sizeof(packet), "p0;thread:%" PRIx64 ";", tid);
+        else
+            snprintf(packet, sizeof(packet), "p0");
+        
+        if (SendPacketAndWaitForResponse(packet, response, false))
         {
             if (response.IsNormalResponse())
                 m_supports_p = eLazyBoolYes;

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=190007&r1=190006&r2=190007&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Wed Sep  4 18:24:15 2013
@@ -228,7 +228,7 @@ public:
     GetVContSupported (char flavor);
 
     bool
-    GetpPacketSupported ();
+    GetpPacketSupported (lldb::tid_t tid);
 
     bool
     GetVAttachOrWaitSupported ();

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=190007&r1=190006&r2=190007&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Wed Sep  4 18:24:15 2013
@@ -177,7 +177,7 @@ ThreadGDBRemote::CreateRegisterContextFo
         {
             ProcessGDBRemote *gdb_process = static_cast<ProcessGDBRemote *>(process_sp.get());
             // read_all_registers_at_once will be true if 'p' packet is not supported.
-            bool read_all_registers_at_once = !gdb_process->GetGDBRemote().GetpPacketSupported ();
+            bool read_all_registers_at_once = !gdb_process->GetGDBRemote().GetpPacketSupported (GetID());
             reg_ctx_sp.reset (new GDBRemoteRegisterContext (*this, concrete_frame_idx, gdb_process->m_register_info, read_all_registers_at_once));
         }
     }





More information about the lldb-commits mailing list