[LLDB][MIPS] Fix register read/write for 32 bit big endian system
authorNitesh Jain <nitesh.jain@imgtec.com>
Mon, 10 Oct 2016 09:02:41 +0000 (09:02 +0000)
committerNitesh Jain <nitesh.jain@imgtec.com>
Mon, 10 Oct 2016 09:02:41 +0000 (09:02 +0000)
Reviewers: clayborg, labath

Subscribers: jaydeep, bhushan, mohit.bhakkad, slthakur, llvm-commits

Differential Revision: https://reviews.llvm.org/D24124

llvm-svn: 283728

lldb/source/Core/RegisterValue.cpp
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp

index a19b0f3..509919d 100644 (file)
@@ -633,8 +633,11 @@ uint64_t RegisterValue::GetAsUInt64(uint64_t fail_value,
     default:
       break;
     case 1:
+      return *(const uint8_t *)buffer.bytes;
     case 2:
+      return *(const uint16_t *)buffer.bytes;
     case 4:
+      return *(const uint32_t *)buffer.bytes;
     case 8:
       return *(const uint64_t *)buffer.bytes;
     }
index a59a288..580d2f9 100644 (file)
@@ -169,7 +169,7 @@ Error NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset,
 
   if (error.Success())
     // First cast to an unsigned of the same size to avoid sign extension.
-    value.SetUInt64(static_cast<unsigned long>(data));
+    value.SetUInt(static_cast<unsigned long>(data), size);
 
   if (log)
     log->Printf("NativeRegisterContextLinux::%s() reg %s: 0x%lx", __FUNCTION__,