[Lldb-commits] [lldb] r217153 - Use the process' ReadCStringFromMemory from DYLDRendezvous::ReadStringFromMemory.

Todd Fiala todd.fiala at gmail.com
Thu Sep 4 07:16:19 PDT 2014


Author: tfiala
Date: Thu Sep  4 09:16:19 2014
New Revision: 217153

URL: http://llvm.org/viewvc/llvm-project?rev=217153&view=rev
Log:
Use the process' ReadCStringFromMemory from DYLDRendezvous::ReadStringFromMemory.

Tested:
Ubuntu 14.04 x86_64, clang-3.5-built lldb.
MacOSX 10.9.4, Xcode6-Beta7-built lldb.

Visual packet inspection on lldb <-> llgs shows significant reduction in overly-verbose
memory read traffic on start-up when scanning shared library info.

Change by Stephane Sezer.

Modified:
    lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp?rev=217153&r1=217152&r2=217153&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp Thu Sep  4 09:16:19 2014
@@ -320,23 +320,11 @@ DYLDRendezvous::ReadStringFromMemory(add
 {
     std::string str;
     Error error;
-    size_t size;
-    char c;
 
     if (addr == LLDB_INVALID_ADDRESS)
         return std::string();
 
-    for (;;) {
-        size = m_process->DoReadMemory(addr, &c, 1, error);
-        if (size != 1 || error.Fail())
-            return std::string();
-        if (c == 0)
-            break;
-        else {
-            str.push_back(c);
-            addr++;
-        }
-    }
+    m_process->ReadCStringFromMemory(addr, str, error);
 
     return str;
 }





More information about the lldb-commits mailing list