[Lldb-commits] [PATCH] D16060: [LLDB][MIPS] Fix ReadRegisterValue for registers with constant 32 bit size regardless of ABI

Mohit Bhakkad via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 11 21:58:50 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL257447: [LLDB][MIPS] Fix ReadRegisterValue for registers with constant 32 bit sizeā€¦ (authored by mohit.bhakkad).

Changed prior to commit:
  http://reviews.llvm.org/D16060?vs=44504&id=44603#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16060

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

Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
@@ -1388,7 +1388,15 @@
     {
         lldb_private::ArchSpec arch;
         if (m_thread.GetProcess()->GetArchitecture(arch))
-            value.SetBytes((void *)(((unsigned char *)&regs) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8, arch.GetByteOrder());
+        {
+            void* target_address = ((uint8_t*)&regs) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips;
+            uint32_t target_size;
+            if ((::strcmp(reg_name, "sr") == 0) || (::strcmp(reg_name, "cause") == 0) || (::strcmp(reg_name, "config5") == 0))
+                target_size = 4;
+            else
+                target_size = arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8;
+            value.SetBytes(target_address, target_size, arch.GetByteOrder());
+        }
         else
             error.SetErrorString("failed to get architecture");
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16060.44603.patch
Type: text/x-patch
Size: 1259 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160112/4d00e9b2/attachment.bin>


More information about the lldb-commits mailing list