[Lldb-commits] [lldb] r201118 - Change RNBRemote::HandlePacket_m() to store the packet on the heap

Jason Molenda jmolenda at apple.com
Mon Feb 10 16:48:29 PST 2014


Author: jmolenda
Date: Mon Feb 10 18:48:29 2014
New Revision: 201118

URL: http://llvm.org/viewvc/llvm-project?rev=201118&view=rev
Log:
Change RNBRemote::HandlePacket_m() to store the packet on the heap
instead of on the stack.  Handles larger packet read requests better.

Modified:
    lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=201118&r1=201117&r2=201118&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Mon Feb 10 18:48:29 2014
@@ -2476,7 +2476,11 @@ RNBRemote::HandlePacket_m (const char *p
         return SendPacket ("");
     }
 
-    uint8_t buf[length];
+    uint8_t *buf = (uint8_t *)malloc (length);
+    if (buf == NULL)
+    {
+        return SendPacket ("E78");
+    }
     int bytes_read = DNBProcessMemoryRead (m_ctx.ProcessID(), addr, length, buf);
     if (bytes_read == 0)
     {
@@ -2490,6 +2494,7 @@ RNBRemote::HandlePacket_m (const char *p
     std::ostringstream ostrm;
     for (int i = 0; i < length; i++)
         ostrm << RAWHEX8(buf[i]);
+    free (buf);
     return SendPacket (ostrm.str ());
 }
 





More information about the lldb-commits mailing list