[Lldb-commits] [lldb] r256331 - [LLDB] Fix Read/Write memory to be compatible with both endians
Mohit K. Bhakkad via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 23 04:34:58 PST 2015
Author: mohit.bhakkad
Date: Wed Dec 23 06:34:58 2015
New Revision: 256331
URL: http://llvm.org/viewvc/llvm-project?rev=256331&view=rev
Log:
[LLDB] Fix Read/Write memory to be compatible with both endians
Reviewers: tberghammer.
Subscribers: jaydeep, bhushan, sagar, nitesh.jain,lldb-commits.
Differential Revision: http://reviews.llvm.org/D15738
Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=256331&r1=256330&r2=256331&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Dec 23 06:34:58 2015
@@ -2547,8 +2547,7 @@ NativeProcessLinux::ReadMemory (lldb::ad
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 @@ NativeProcessLinux::WriteMemory(lldb::ad
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) ||
More information about the lldb-commits
mailing list