summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
diff options
context:
space:
mode:
authorMohit K. Bhakkad <mohit.bhakkad@gmail.com>2015-12-23 12:34:58 +0000
committerMohit K. Bhakkad <mohit.bhakkad@gmail.com>2015-12-23 12:34:58 +0000
commitf6ef187b9b5e5c49ed99ed454de07a65c40a6f13 (patch)
tree775d0ac718bc9bda2cb5fa99b7118484562e70e7 /lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
parenta636c7f9b9a4a34dfa270c215eedbb985e2eb746 (diff)
downloadbcm5719-llvm-f6ef187b9b5e5c49ed99ed454de07a65c40a6f13.tar.gz
bcm5719-llvm-f6ef187b9b5e5c49ed99ed454de07a65c40a6f13.zip
[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 llvm-svn: 256331
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 284dbeebbab..87c76f57830 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -2547,8 +2547,7 @@ NativeProcessLinux::ReadMemory (lldb::addr_t addr, void *buf, size_t size, size_
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::addr_t addr, const void *buf, size_t size,
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) ||
OpenPOWER on IntegriCloud