[Lldb-commits] [lldb] r179799 - Try to unbreak the lldb-x86_64-linux buildbot after recent std::auto_ptr/std::unique_ptr changes.

Greg Clayton gclayton at apple.com
Thu Apr 18 15:01:06 PDT 2013


Author: gclayton
Date: Thu Apr 18 17:01:06 2013
New Revision: 179799

URL: http://llvm.org/viewvc/llvm-project?rev=179799&view=rev
Log:
Try to unbreak the lldb-x86_64-linux buildbot after recent std::auto_ptr/std::unique_ptr changes.


Modified:
    lldb/trunk/include/lldb/Expression/IRMemoryMap.h
    lldb/trunk/source/Expression/IRMemoryMap.cpp

Modified: lldb/trunk/include/lldb/Expression/IRMemoryMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRMemoryMap.h?rev=179799&r1=179798&r2=179799&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRMemoryMap.h (original)
+++ lldb/trunk/include/lldb/Expression/IRMemoryMap.h Thu Apr 18 17:01:06 2013
@@ -83,10 +83,19 @@ private:
         size_t          m_size;             ///< The size of the requested allocation
         uint32_t        m_permissions;      ///< The access permissions on the memory in the process.  In the host, the memory is always read/write.
         uint8_t         m_alignment;        ///< The alignment of the requested allocation
-        
-        STD_UNIQUE_PTR(DataBufferHeap) m_data;
-        
+        STD_UNIQUE_PTR(DataBufferHeap) m_data_ap;
         AllocationPolicy    m_policy;
+        
+        Allocation () :
+            m_process_alloc (LLDB_INVALID_ADDRESS),
+            m_process_start (LLDB_INVALID_ADDRESS),
+            m_size (0),
+            m_permissions (0),
+            m_alignment (0),
+            m_data_ap (),
+            m_policy (eAllocationPolicyInvalid)
+        {
+        }
     };
     
     lldb::ProcessWP                             m_process_wp;

Modified: lldb/trunk/source/Expression/IRMemoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRMemoryMap.cpp?rev=179799&r1=179798&r2=179799&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRMemoryMap.cpp (original)
+++ lldb/trunk/source/Expression/IRMemoryMap.cpp Thu Apr 18 17:01:06 2013
@@ -241,12 +241,12 @@ IRMemoryMap::Malloc (size_t size, uint8_
     default:
         assert (0 && "We cannot reach this!");
     case eAllocationPolicyHostOnly:
-        allocation.m_data.reset(new DataBufferHeap(size, 0));
+        allocation.m_data_ap.reset(new DataBufferHeap(size, 0));
         break;
     case eAllocationPolicyProcessOnly:
         break;
     case eAllocationPolicyMirror:
-        allocation.m_data.reset(new DataBufferHeap(size, 0));
+        allocation.m_data_ap.reset(new DataBufferHeap(size, 0));
         break;
     }
     
@@ -355,22 +355,22 @@ IRMemoryMap::WriteMemory (lldb::addr_t p
         error.SetErrorString("Couldn't write: invalid allocation policy");
         return;
     case eAllocationPolicyHostOnly:
-        if (!allocation.m_data)
+        if (!allocation.m_data_ap.get())
         {
             error.SetErrorToGenericError();
             error.SetErrorString("Couldn't write: data buffer is empty");
             return;
         }
-        ::memcpy (allocation.m_data->GetBytes() + offset, bytes, size);
+        ::memcpy (allocation.m_data_ap->GetBytes() + offset, bytes, size);
         break;
     case eAllocationPolicyMirror:
-        if (!allocation.m_data)
+        if (!allocation.m_data_ap.get())
         {
             error.SetErrorToGenericError();
             error.SetErrorString("Couldn't write: data buffer is empty");
             return;
         }
-        ::memcpy (allocation.m_data->GetBytes() + offset, bytes, size);
+        ::memcpy (allocation.m_data_ap->GetBytes() + offset, bytes, size);
         process_sp = m_process_wp.lock();
         if (process_sp)
         {
@@ -485,13 +485,13 @@ IRMemoryMap::ReadMemory (uint8_t *bytes,
         error.SetErrorString("Couldn't read: invalid allocation policy");
         return;
     case eAllocationPolicyHostOnly:
-        if (!allocation.m_data)
+        if (!allocation.m_data_ap.get())
         {
             error.SetErrorToGenericError();
             error.SetErrorString("Couldn't read: data buffer is empty");
             return;
         }
-        ::memcpy (bytes, allocation.m_data->GetBytes() + offset, size);
+        ::memcpy (bytes, allocation.m_data_ap->GetBytes() + offset, size);
         break;
     case eAllocationPolicyMirror:
         process_sp = m_process_wp.lock();
@@ -503,13 +503,13 @@ IRMemoryMap::ReadMemory (uint8_t *bytes,
         }
         else
         {
-            if (!allocation.m_data)
+            if (!allocation.m_data_ap.get())
             {
                 error.SetErrorToGenericError();
                 error.SetErrorString("Couldn't read: data buffer is empty");
                 return;
             }
-            ::memcpy (bytes, allocation.m_data->GetBytes() + offset, size);
+            ::memcpy (bytes, allocation.m_data_ap->GetBytes() + offset, size);
         }
         break;
     case eAllocationPolicyProcessOnly:
@@ -619,7 +619,7 @@ IRMemoryMap::GetMemoryData (DataExtracto
             {
                 lldb::ProcessSP process_sp = m_process_wp.lock();
 
-                if (!allocation.m_data.get())
+                if (!allocation.m_data_ap.get())
                 {
                     error.SetErrorToGenericError();
                     error.SetErrorString("Couldn't get memory data: data buffer is empty");
@@ -627,23 +627,23 @@ IRMemoryMap::GetMemoryData (DataExtracto
                 }
                 if (process_sp)
                 {
-                    process_sp->ReadMemory(allocation.m_process_start, allocation.m_data->GetBytes(), allocation.m_data->GetByteSize(), error);
+                    process_sp->ReadMemory(allocation.m_process_start, allocation.m_data_ap->GetBytes(), allocation.m_data_ap->GetByteSize(), error);
                     if (!error.Success())
                         return;
                     uint64_t offset = process_address - allocation.m_process_start;
-                    extractor = DataExtractor(allocation.m_data->GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
+                    extractor = DataExtractor(allocation.m_data_ap->GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
                     return;
                 }
             }
         case eAllocationPolicyHostOnly:
-            if (!allocation.m_data.get())
+            if (!allocation.m_data_ap.get())
             {
                 error.SetErrorToGenericError();
                 error.SetErrorString("Couldn't get memory data: data buffer is empty");
                 return;
             }
             uint64_t offset = process_address - allocation.m_process_start;
-            extractor = DataExtractor(allocation.m_data->GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
+            extractor = DataExtractor(allocation.m_data_ap->GetBytes() + offset, size, GetByteOrder(), GetAddressByteSize());
             return;
         }
     }





More information about the lldb-commits mailing list