tberghammer added a comment.

Looks much better, but I think the root cause of your problem is that you are 
using RegisterValue::SetBytes instead of RegisterValue::SetUInt. I would 
suggest to use a code like this (I don't have a mips environment at the moment 
to try it out):

  Error
  NativeRegisterContextLinux_mips64::DoReadRegisterValue(uint32_t offset,
                                                         const char* reg_name,
                                                         uint32_t size,
                                                         RegisterValue &value)
  {
      GPR_linux_mips regs;
      ::memset(&regs, 0, sizeof(GPR_linux_mips));
      Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGS, 
m_thread.GetID(), NULL, &regs, sizeof regs);
      if (error.Success())
      {
          lldb_private::ArchSpec arch;
          if (m_thread.GetProcess()->GetArchitecture(arch))
              value.SetUInt(*(uint64_t*)(((uint8_t*)&regs) + offset), 
arch.GetAddressByteSize());
          else
              error.SetErrorString("failed to get architecture");
      }
      return error;
  }


================
Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp:1378
@@ -1377,2 +1377,3 @@
     GPR_linux_mips regs;
+    lldb_private::ArchSpec arch;
     ::memset(&regs, 0, sizeof(GPR_linux_mips));
----------------
You use this variable without initializing it. You can call SetBytes with an 
explicit byte order value (e.g. eByteOrderLittle) as it isn't matter during 0 
initialization.


Repository:
  rL LLVM

http://reviews.llvm.org/D14633



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to