[llvm-branch-commits] [lldb] r200241 - Merged with top of tree.

Greg Clayton gclayton at apple.com
Mon Jan 27 11:24:20 PST 2014


Author: gclayton
Date: Mon Jan 27 13:24:19 2014
New Revision: 200241

URL: http://llvm.org/viewvc/llvm-project?rev=200241&view=rev
Log:
Merged with top of tree.


Modified:
    lldb/branches/iohandler/   (props changed)
    lldb/branches/iohandler/docs/lldb-gdb-remote.txt
    lldb/branches/iohandler/source/Core/DataExtractor.cpp
    lldb/branches/iohandler/source/Plugins/Process/FreeBSD/ProcessMonitor.h
    lldb/branches/iohandler/source/Plugins/Process/Linux/ProcessMonitor.cpp
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    lldb/branches/iohandler/source/Symbol/ClangASTType.cpp

Propchange: lldb/branches/iohandler/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 27 13:24:19 2014
@@ -1,2 +1,2 @@
 /lldb/branches/apple/python-GIL:156467-162159
-/lldb/trunk:198360-200024
+/lldb/trunk:198360-200240

Modified: lldb/branches/iohandler/docs/lldb-gdb-remote.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/docs/lldb-gdb-remote.txt?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/docs/lldb-gdb-remote.txt (original)
+++ lldb/branches/iohandler/docs/lldb-gdb-remote.txt Mon Jan 27 13:24:19 2014
@@ -523,8 +523,8 @@ read packet: $cputype:16777223;cpusubtyp
 
 Key value pairs are one of:
 
-cputype: is a number that is the mach-o CPU type that is being debugged
-cpusubtype: is a number that is the mach-o CPU subtype type that is being debugged
+cputype: is a number that is the mach-o CPU type that is being debugged (base 10)
+cpusubtype: is a number that is the mach-o CPU subtype type that is being debugged (base 10)
 triple: a string for the target triple (x86_64-apple-macosx) that can be used to specify arch + vendor + os in one entry
 vendor: a string for the vendor (apple), not needed if "triple" is specified
 ostype: a string for the OS being debugged (darwin, linux, freebsd), not needed if "triple" is specified
@@ -621,8 +621,8 @@ real-uid: the real user id of the proces
 real-gid: the real group id of the process
 effective-uid: the effective user id of the process
 effective-gid: the effective group id of the process
-cputype: the Mach-O CPU type of the process
-cpusubtype: the Mach-O CPU subtype of the process
+cputype: the Mach-O CPU type of the process  (base 16)
+cpusubtype: the Mach-O CPU subtype of the process  (base 16)
 ostype: is a string the represents the OS being debugged (darwin, linux, freebsd)
 vendor: is a string that represents the vendor (apple)
 endian: is one of "little", "big", or "pdp"

Modified: lldb/branches/iohandler/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Core/DataExtractor.cpp?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Core/DataExtractor.cpp (original)
+++ lldb/branches/iohandler/source/Core/DataExtractor.cpp Mon Jan 27 13:24:19 2014
@@ -46,69 +46,97 @@ using namespace lldb_private;
 static inline uint16_t 
 ReadInt16(const unsigned char* ptr, offset_t offset)
 {
-    return *(uint16_t *)(ptr + offset);
+    uint16_t value;
+    memcpy (&value, ptr + offset, 2);
+    return value;
 }
+
 static inline uint32_t
 ReadInt32 (const unsigned char* ptr, offset_t offset)
 {
-    return *(uint32_t *)(ptr + offset);
+    uint32_t value;
+    memcpy (&value, ptr + offset, 4);
+    return value;
 }
 
 static inline uint64_t 
 ReadInt64(const unsigned char* ptr, offset_t offset)
 {
-    return *(uint64_t *)(ptr + offset);
+    uint64_t value;
+    memcpy (&value, ptr + offset, 8);
+    return value;
 }
 
 static inline uint16_t
 ReadInt16(const void* ptr)
 {
-    return *(uint16_t *)(ptr);
+    uint16_t value;
+    memcpy (&value, ptr, 2);
+    return value;
 }
+
 static inline uint32_t
 ReadInt32 (const void* ptr)
 {
-    return *(uint32_t *)(ptr);
+    uint32_t value;
+    memcpy (&value, ptr, 4);
+    return value;
 }
 
 static inline uint64_t
 ReadInt64(const void* ptr)
 {
-    return *(uint64_t *)(ptr);
+    uint64_t value;
+    memcpy (&value, ptr, 8);
+    return value;
 }
 
 static inline uint16_t
 ReadSwapInt16(const unsigned char* ptr, offset_t offset)
 {
-    return llvm::ByteSwap_16(*(uint16_t *)(ptr + offset));
+    uint16_t value;
+    memcpy (&value, ptr + offset, 2);
+    return llvm::ByteSwap_16(value);
 }
 
 static inline uint32_t
 ReadSwapInt32 (const unsigned char* ptr, offset_t offset)
 {
-    return llvm::ByteSwap_32(*(uint32_t *)(ptr + offset));
+    uint32_t value;
+    memcpy (&value, ptr + offset, 4);
+    return llvm::ByteSwap_32(value);
 }
+
 static inline uint64_t 
 ReadSwapInt64(const unsigned char* ptr, offset_t offset) 
 {
-  return llvm::ByteSwap_64(*(uint64_t *)(ptr + offset));
+    uint64_t value;
+    memcpy (&value, ptr + offset, 8);
+    return llvm::ByteSwap_64(value);
 }
 
 static inline uint16_t
 ReadSwapInt16(const void* ptr)
 {
-    return llvm::ByteSwap_16(*(uint16_t *)(ptr));
+    uint16_t value;
+    memcpy (&value, ptr, 2);
+    return llvm::ByteSwap_16(value);
 }
 
 static inline uint32_t
 ReadSwapInt32 (const void* ptr)
 {
-    return llvm::ByteSwap_32(*(uint32_t *)(ptr));
+    uint32_t value;
+    memcpy (&value, ptr, 4);
+    return llvm::ByteSwap_32(value);
 }
+
 static inline uint64_t
 ReadSwapInt64(const void* ptr)
 {
-    return llvm::ByteSwap_64(*(uint64_t *)(ptr));
+    uint64_t value;
+    memcpy (&value, ptr, 8);
+    return llvm::ByteSwap_64(value);
 }
 
 #define NON_PRINTABLE_CHAR '.'
@@ -503,13 +531,17 @@ uint32_t
 DataExtractor::GetU32 (offset_t *offset_ptr) const
 {
     uint32_t val = 0;
-    const uint32_t *data = (const uint32_t *)GetData (offset_ptr, sizeof(val));
+    const uint8_t *data = (const uint8_t *)GetData (offset_ptr, sizeof(val));
     if (data)
     {
         if (m_byte_order != lldb::endian::InlHostByteOrder())
+        {
             val = ReadSwapInt32 (data);
+        }
         else
-            val = *data;
+        {
+            memcpy (&val, data, 4);
+        }
     }
     return val;
 }
@@ -562,13 +594,17 @@ uint64_t
 DataExtractor::GetU64 (offset_t *offset_ptr) const
 {
     uint64_t val = 0;
-    const uint64_t *data = (const uint64_t *)GetData (offset_ptr, sizeof(val));
+    const uint8_t *data = (const uint8_t *)GetData (offset_ptr, sizeof(val));
     if (data)
     {
         if (m_byte_order != lldb::endian::InlHostByteOrder())
+        {
             val = ReadSwapInt64 (data);
+        }
         else
-            val = *data;
+        {
+            memcpy (&val, data, 8);
+        }
     }
     return val;
 }

Modified: lldb/branches/iohandler/source/Plugins/Process/FreeBSD/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/FreeBSD/ProcessMonitor.h?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/FreeBSD/ProcessMonitor.h (original)
+++ lldb/branches/iohandler/source/Plugins/Process/FreeBSD/ProcessMonitor.h Mon Jan 27 13:24:19 2014
@@ -104,8 +104,6 @@ public:
     /// dependent) offset.
     ///
     /// This method is provided for use by RegisterContextFreeBSD derivatives.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     ReadRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name,
                       unsigned size, lldb_private::RegisterValue &value);
@@ -114,49 +112,35 @@ public:
     /// (architecture dependent) offset.
     ///
     /// This method is provided for use by RegisterContextFreeBSD derivatives.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     WriteRegisterValue(lldb::tid_t tid, unsigned offset, const char *reg_name,
                        const lldb_private::RegisterValue &value);
 
     /// Reads all general purpose registers into the specified buffer.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     ReadGPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
     /// Reads all floating point registers into the specified buffer.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     ReadFPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
     /// Reads the specified register set into the specified buffer.
     ///
     /// This method is provided for use by RegisterContextFreeBSD derivatives.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     ReadRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
 
     /// Writes all general purpose registers into the specified buffer.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     WriteGPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
     /// Writes all floating point registers into the specified buffer.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     WriteFPR(lldb::tid_t tid, void *buf, size_t buf_size);
 
     /// Writes the specified register set into the specified buffer.
     ///
     /// This method is provided for use by RegisterContextFreeBSD derivatives.
-    /// FIXME: The FreeBSD implementation of this function should use tid in order
-    ///        to enable support for debugging threaded programs.
     bool
     WriteRegisterSet(lldb::tid_t tid, void *buf, size_t buf_size, unsigned int regset);
 

Modified: lldb/branches/iohandler/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/Linux/ProcessMonitor.cpp Mon Jan 27 13:24:19 2014
@@ -1798,14 +1798,23 @@ ProcessMonitor::StopThread(lldb::tid_t t
         int ptrace_err;
         if (!GetSignalInfo(wait_pid, &info, ptrace_err))
         {
-            if (log)
+            // another signal causing a StopAllThreads may have been received
+            // before wait_pid's group-stop was processed, handle it now
+            if (ptrace_err == EINVAL)
             {
-                log->Printf ("ProcessMonitor::%s() GetSignalInfo failed.", __FUNCTION__);
+                assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP);
 
-                // This would be a particularly interesting case
-                if (ptrace_err == EINVAL)
-                    log->Printf ("ProcessMonitor::%s() in group-stop", __FUNCTION__);
+                if (log)
+                  log->Printf ("ProcessMonitor::%s() resuming from group-stop", __FUNCTION__);
+                // inferior process is in 'group-stop', so deliver SIGSTOP signal
+                if (!Resume(wait_pid, SIGSTOP)) {
+                  assert(0 && "SIGSTOP delivery failed while in 'group-stop' state");
+                }
+                continue;
             }
+
+            if (log)
+                log->Printf ("ProcessMonitor::%s() GetSignalInfo failed.", __FUNCTION__);
             return false;
         }
 
@@ -2062,7 +2071,12 @@ ProcessMonitor::ServeOperation(Operation
     for(;;)
     {
         // wait for next pending operation
-        sem_wait(&monitor->m_operation_pending);
+        if (sem_wait(&monitor->m_operation_pending))
+        {
+            if (errno == EINTR)
+                continue;
+            assert(false && "Unexpected errno from sem_wait");
+        }
 
         monitor->m_operation->Execute(monitor);
 
@@ -2082,7 +2096,12 @@ ProcessMonitor::DoOperation(Operation *o
     sem_post(&m_operation_pending);
 
     // wait for operation to complete
-    sem_wait(&m_operation_done);
+    while (sem_wait(&m_operation_done))
+    {
+        if (errno == EINTR)
+            continue;
+        assert(false && "Unexpected errno from sem_wait");
+    }
 }
 
 size_t

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Jan 27 13:24:19 2014
@@ -669,6 +669,7 @@ GDBRemoteCommunication::StartDebugserver
         debugserver_args.AppendArgument("--setsid");
 
         char named_pipe_path[PATH_MAX];
+        named_pipe_path[0] = '\0';
 
         bool listen = false;
         if (host_and_port[0])
@@ -703,11 +704,7 @@ GDBRemoteCommunication::StartDebugserver
                         debugserver_args.AppendArgument("--named-pipe");
                         debugserver_args.AppendArgument(named_pipe_path);
                     }
-                    else
-                        named_pipe_path[0] = '\0';
                 }
-                else
-                    named_pipe_path[0] = '\0';
             }
             else
             {
@@ -716,8 +713,6 @@ GDBRemoteCommunication::StartDebugserver
         }
         else
         {
-            named_pipe_path[0] = '\0';
-        
             // No host and port given, so lets listen on our end and make the debugserver
             // connect to us..
             error = StartListenThread ("localhost", 0);

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Mon Jan 27 13:24:19 2014
@@ -45,7 +45,8 @@ public:
         ErrorReplyTimeout,  // Timed out waiting for reply
         ErrorReplyInvalid,  // Got a reply but it wasn't valid for the packet that was sent
         ErrorReplyAck,      // Sending reply ack failed
-        ErrorDisconnected   // We were disconnected
+        ErrorDisconnected,  // We were disconnected
+        ErrorNoSequenceLock // We couldn't get the sequence lock for a multi-packet request
     };
     //------------------------------------------------------------------
     // Constructors and Destructors

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Mon Jan 27 13:24:19 2014
@@ -66,6 +66,9 @@ GDBRemoteCommunicationClient::GDBRemoteC
     m_prepare_for_reg_writing_reply (eLazyBoolCalculate),
     m_supports_p (eLazyBoolCalculate),
     m_supports_QSaveRegisterState (eLazyBoolCalculate),
+    m_supports_qXfer_libraries_read (eLazyBoolCalculate),
+    m_supports_qXfer_libraries_svr4_read (eLazyBoolCalculate),
+    m_supports_augmented_libraries_svr4_read (eLazyBoolCalculate),
     m_supports_qProcessInfoPID (true),
     m_supports_qfProcessInfo (true),
     m_supports_qUserName (true),
@@ -96,7 +99,8 @@ GDBRemoteCommunicationClient::GDBRemoteC
     m_os_build (),
     m_os_kernel (),
     m_hostname (),
-    m_default_packet_timeout (0)
+    m_default_packet_timeout (0),
+    m_max_packet_size (0)
 {
 }
 
@@ -149,6 +153,46 @@ GDBRemoteCommunicationClient::HandshakeW
 }
 
 bool
+GDBRemoteCommunicationClient::GetAugmentedLibrariesSVR4ReadSupported ()
+{
+    if (m_supports_augmented_libraries_svr4_read == eLazyBoolCalculate)
+    {
+        GetRemoteQSupported();
+    }
+    return (m_supports_augmented_libraries_svr4_read == eLazyBoolYes);
+}
+
+bool
+GDBRemoteCommunicationClient::GetQXferLibrariesSVR4ReadSupported ()
+{
+    if (m_supports_qXfer_libraries_svr4_read == eLazyBoolCalculate)
+    {
+        GetRemoteQSupported();
+    }
+    return (m_supports_qXfer_libraries_svr4_read == eLazyBoolYes);
+}
+
+bool
+GDBRemoteCommunicationClient::GetQXferLibrariesReadSupported ()
+{
+    if (m_supports_qXfer_libraries_read == eLazyBoolCalculate)
+    {
+        GetRemoteQSupported();
+    }
+    return (m_supports_qXfer_libraries_read == eLazyBoolYes);
+}
+
+uint64_t
+GDBRemoteCommunicationClient::GetRemoteMaxPacketSize()
+{
+    if (m_max_packet_size == 0)
+    {
+        GetRemoteQSupported();
+    }
+    return m_max_packet_size;
+}
+
+bool
 GDBRemoteCommunicationClient::QueryNoAckModeSupported ()
 {
     if (m_supports_not_sending_acks == eLazyBoolCalculate)
@@ -245,6 +289,9 @@ GDBRemoteCommunicationClient::ResetDisco
     m_supports_memory_region_info = eLazyBoolCalculate;
     m_prepare_for_reg_writing_reply = eLazyBoolCalculate;
     m_attach_or_wait_reply = eLazyBoolCalculate;
+    m_supports_qXfer_libraries_read = eLazyBoolCalculate;
+    m_supports_qXfer_libraries_svr4_read = eLazyBoolCalculate;
+    m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate;
 
     m_supports_qProcessInfoPID = true;
     m_supports_qfProcessInfo = true;
@@ -260,8 +307,50 @@ GDBRemoteCommunicationClient::ResetDisco
     m_supports_QEnvironmentHexEncoded = true;
     m_host_arch.Clear();
     m_process_arch.Clear();
+
+    m_max_packet_size = 0;
 }
 
+void
+GDBRemoteCommunicationClient::GetRemoteQSupported ()
+{
+    // Clear out any capabilities we expect to see in the qSupported response
+    m_supports_qXfer_libraries_svr4_read = eLazyBoolNo;
+    m_supports_qXfer_libraries_read = eLazyBoolNo;
+    m_supports_augmented_libraries_svr4_read = eLazyBoolNo;
+    m_max_packet_size = UINT64_MAX;  // It's supposed to always be there, but if not, we assume no limit
+
+    StringExtractorGDBRemote response;
+    if (SendPacketAndWaitForResponse("qSupported",
+                                     response,
+                                     /*send_async=*/false) == PacketResult::Success)
+    {
+        const char *response_cstr = response.GetStringRef().c_str();
+        if (::strstr (response_cstr, "qXfer:libraries-svr4:read+"))
+            m_supports_qXfer_libraries_svr4_read = eLazyBoolYes;
+        if (::strstr (response_cstr, "augmented-libraries-svr4-read"))
+        {
+            m_supports_qXfer_libraries_svr4_read = eLazyBoolYes;  // implied
+            m_supports_augmented_libraries_svr4_read = eLazyBoolYes;
+        }
+        if (::strstr (response_cstr, "qXfer:libraries:read+"))
+            m_supports_qXfer_libraries_read = eLazyBoolYes;
+
+        const char *packet_size_str = ::strstr (response_cstr, "PacketSize=");
+        if (packet_size_str)
+        {
+            StringExtractorGDBRemote packet_response(packet_size_str + strlen("PacketSize="));
+            m_max_packet_size = packet_response.GetHexMaxU64(/*little_endian=*/false, UINT64_MAX);
+            if (m_max_packet_size == 0)
+            {
+                m_max_packet_size = UINT64_MAX;  // Must have been a garbled response
+                Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
+                if (log)
+                    log->Printf ("Garbled PacketSize spec in qSupported response");
+            }
+        }
+    }
+}
 
 bool
 GDBRemoteCommunicationClient::GetThreadSuffixSupported ()
@@ -364,6 +453,62 @@ GDBRemoteCommunicationClient::GetpPacket
 }
 
 GDBRemoteCommunicationClient::PacketResult
+GDBRemoteCommunicationClient::SendPacketsAndConcatenateResponses
+(
+    const char *payload_prefix,
+    std::string &response_string
+)
+{
+    Mutex::Locker locker;
+    if (!GetSequenceMutex(locker,
+                          "ProcessGDBRemote::SendPacketsAndConcatenateResponses() failed due to not getting the sequence mutex"))
+    {
+        Log *log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS));
+        if (log)
+            log->Printf("error: failed to get packet sequence mutex, not sending packets with prefix '%s'",
+                        payload_prefix);
+        return PacketResult::ErrorNoSequenceLock;
+    }
+
+    response_string = "";
+    std::string payload_prefix_str(payload_prefix);
+    unsigned int response_size = 0x1000;
+    if (response_size > GetRemoteMaxPacketSize()) {  // May send qSupported packet
+        response_size = GetRemoteMaxPacketSize();
+    }
+
+    for (unsigned int offset = 0; true; offset += response_size)
+    {
+        StringExtractorGDBRemote this_response;
+        // Construct payload
+        char sizeDescriptor[128];
+        snprintf(sizeDescriptor, sizeof(sizeDescriptor), "%x,%x", offset, response_size);
+        PacketResult result = SendPacketAndWaitForResponse((payload_prefix_str + sizeDescriptor).c_str(),
+                                                           this_response,
+                                                           /*send_async=*/false);
+        if (result != PacketResult::Success)
+            return result;
+
+        const std::string &this_string = this_response.GetStringRef();
+
+        // Check for m or l as first character; l seems to mean this is the last chunk
+        char first_char = *this_string.c_str();
+        if (first_char != 'm' && first_char != 'l')
+        {
+            return PacketResult::ErrorReplyInvalid;
+        }
+        // Skip past m or l
+        const char *s = this_string.c_str() + 1;
+
+        // Concatenate the result so far
+        response_string += s;
+        if (first_char == 'l')
+            // We're done
+            return PacketResult::Success;
+    }
+}
+
+GDBRemoteCommunicationClient::PacketResult
 GDBRemoteCommunicationClient::SendPacketAndWaitForResponse
 (
     const char *payload,

Modified: lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (original)
+++ lldb/branches/iohandler/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h Mon Jan 27 13:24:19 2014
@@ -58,6 +58,27 @@ public:
                                   StringExtractorGDBRemote &response,
                                   bool send_async);
 
+    // For packets which specify a range of output to be returned,
+    // return all of the output via a series of request packets of the form
+    // <prefix>0,<size>
+    // <prefix><size>,<size>
+    // <prefix><size>*2,<size>
+    // <prefix><size>*3,<size>
+    // ...
+    // until a "$l..." packet is received, indicating the end.
+    // (size is in hex; this format is used by a standard gdbserver to
+    // return the given portion of the output specified by <prefix>;
+    // for example, "qXfer:libraries-svr4:read::fff,1000" means
+    // "return a chunk of the xml description file for shared
+    // library load addresses, where the chunk starts at offset 0xfff
+    // and continues for 0x1000 bytes").
+    // Concatenate the resulting server response packets together and
+    // return in response_string.  If any packet fails, the return value
+    // indicates that failure and the returned string value is undefined.
+    PacketResult
+    SendPacketsAndConcatenateResponses (const char *send_payload_prefix,
+                                        std::string &response_string);
+
     lldb::StateType
     SendContinuePacketAndWaitForResponse (ProcessGDBRemote *process,
                                           const char *packet_payload,
@@ -248,6 +269,9 @@ public:
     const lldb_private::ArchSpec &
     GetProcessArchitecture ();
 
+    void
+    GetRemoteQSupported();
+
     bool
     GetVContSupported (char flavor);
 
@@ -359,6 +383,18 @@ public:
     bool
     SetCurrentThreadForRun (uint64_t tid);
 
+    bool
+    GetQXferLibrariesReadSupported ();
+
+    bool
+    GetQXferLibrariesSVR4ReadSupported ();
+
+    uint64_t
+    GetRemoteMaxPacketSize();
+
+    bool
+    GetAugmentedLibrariesSVR4ReadSupported ();
+
     lldb_private::LazyBool
     SupportsAllocDeallocMemory () // const
     {
@@ -489,7 +525,10 @@ protected:
     lldb_private::LazyBool m_prepare_for_reg_writing_reply;
     lldb_private::LazyBool m_supports_p;
     lldb_private::LazyBool m_supports_QSaveRegisterState;
-    
+    lldb_private::LazyBool m_supports_qXfer_libraries_read;
+    lldb_private::LazyBool m_supports_qXfer_libraries_svr4_read;
+    lldb_private::LazyBool m_supports_augmented_libraries_svr4_read;
+
     bool
         m_supports_qProcessInfoPID:1,
         m_supports_qfProcessInfo:1,
@@ -532,6 +571,7 @@ protected:
     std::string m_os_kernel;
     std::string m_hostname;
     uint32_t m_default_packet_timeout;
+    uint64_t m_max_packet_size;  // as returned by qSupported
     
     bool
     DecodeProcessInfoResponse (StringExtractorGDBRemote &response, 

Modified: lldb/branches/iohandler/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/iohandler/source/Symbol/ClangASTType.cpp?rev=200241&r1=200240&r2=200241&view=diff
==============================================================================
--- lldb/branches/iohandler/source/Symbol/ClangASTType.cpp (original)
+++ lldb/branches/iohandler/source/Symbol/ClangASTType.cpp Mon Jan 27 13:24:19 2014
@@ -1625,7 +1625,7 @@ ClangASTType::GetFunctionReturnType () c
         QualType qual_type(GetCanonicalQualType());
         const FunctionProtoType* func = dyn_cast<FunctionProtoType>(qual_type.getTypePtr());
         if (func)
-            return ClangASTType(m_ast, func->getResultType());
+            return ClangASTType(m_ast, func->getReturnType());
     }
     return ClangASTType();
 }
@@ -4715,7 +4715,7 @@ ClangASTType::AddMethodToCXXRecordType (
                 cxx_method_decl = CXXConversionDecl::Create (*m_ast,
                                                              cxx_record_decl,
                                                              SourceLocation(),
-                                                             DeclarationNameInfo (m_ast->DeclarationNames.getCXXConversionFunctionName (m_ast->getCanonicalType (function_type->getResultType())), SourceLocation()),
+                                                             DeclarationNameInfo (m_ast->DeclarationNames.getCXXConversionFunctionName (m_ast->getCanonicalType (function_type->getReturnType())), SourceLocation()),
                                                              method_qual_type,
                                                              NULL, // TypeSourceInfo *
                                                              is_inline,
@@ -5143,7 +5143,7 @@ ClangASTType::AddMethodToObjCObjectType
                                                                SourceLocation(), // beginLoc,
                                                                SourceLocation(), // endLoc,
                                                                method_selector,
-                                                               method_function_prototype->getResultType(),
+                                                               method_function_prototype->getReturnType(),
                                                                NULL, // TypeSourceInfo *ResultTInfo,
                                                                GetDeclContextForType (),
                                                                name[0] == '-',





More information about the llvm-branch-commits mailing list