This revision was automatically updated to reflect the committed changes.
Closed by commit rL256331: [LLDB] Fix Read/Write memory to be compatible with 
both endians (authored by mohit.bhakkad).

Changed prior to commit:
  http://reviews.llvm.org/D15738?vs=43520&id=43522#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15738

Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -2547,8 +2547,7 @@
         remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : 
remainder;
 
         // Copy the data into our buffer
-        for (unsigned i = 0; i < remainder; ++i)
-            dst[i] = ((data >> i*8) & 0xFF);
+        memcpy(dst, &data, remainder);
 
         if (log && ProcessPOSIXLog::AtTopNestLevel() &&
                 (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) ||
@@ -2600,8 +2599,7 @@
         if (remainder == k_ptrace_word_size)
         {
             unsigned long data = 0;
-            for (unsigned i = 0; i < k_ptrace_word_size; ++i)
-                data |= (unsigned long)src[i] << i*8;
+            memcpy(&data, src, k_ptrace_word_size);
 
             if (log && ProcessPOSIXLog::AtTopNestLevel() &&
                     (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) ||


Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -2547,8 +2547,7 @@
         remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder;
 
         // Copy the data into our buffer
-        for (unsigned i = 0; i < remainder; ++i)
-            dst[i] = ((data >> i*8) & 0xFF);
+        memcpy(dst, &data, remainder);
 
         if (log && ProcessPOSIXLog::AtTopNestLevel() &&
                 (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) ||
@@ -2600,8 +2599,7 @@
         if (remainder == k_ptrace_word_size)
         {
             unsigned long data = 0;
-            for (unsigned i = 0; i < k_ptrace_word_size; ++i)
-                data |= (unsigned long)src[i] << i*8;
+            memcpy(&data, src, k_ptrace_word_size);
 
             if (log && ProcessPOSIXLog::AtTopNestLevel() &&
                     (log->GetMask().Test(POSIX_LOG_MEMORY_DATA_LONG) ||
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to