diff options
author | Sagar Thakur <sagar.thakur@imgtec.com> | 2016-01-05 14:03:45 +0000 |
---|---|---|
committer | Sagar Thakur <sagar.thakur@imgtec.com> | 2016-01-05 14:03:45 +0000 |
commit | 307a3ba3b3c291e17f047d8a6606c1a36cb31eb4 (patch) | |
tree | d8cda0c87c7d1a550ab0ef1147a89fce6c5cfbf7 | |
parent | 7093cccf92ee6805c8dd4ee9a4d5949d22b7f205 (diff) | |
download | bcm5719-llvm-307a3ba3b3c291e17f047d8a6606c1a36cb31eb4.tar.gz bcm5719-llvm-307a3ba3b3c291e17f047d8a6606c1a36cb31eb4.zip |
[LLDB][MIPS] Make register read/write to set/get the size of register according to abi.
Summary:
For O32 abi register size should be 4 bytes.
For N32 and N64 abi register size should be 8 bytes.
This patch will make register read/write to set/get the size of register according to abi.
Reviewers: clayborg, tberghammer
Subscribers: lldb-commits, nitesh.jain, mohit.bhakkad, bhushan, jaydeep
Differential: http://reviews.llvm.org/D15884
llvm-svn: 256834
-rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp index 7aba9c1ba18..3cfeaf5546b 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -1388,7 +1388,7 @@ NativeRegisterContextLinux_mips64::DoReadRegisterValue(uint32_t offset, { lldb_private::ArchSpec arch; if (m_thread.GetProcess()->GetArchitecture(arch)) - value.SetBytes((void *)(((unsigned char *)®s) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetAddressByteSize(), arch.GetByteOrder()); + value.SetBytes((void *)(((unsigned char *)®s) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8, arch.GetByteOrder()); else error.SetErrorString("failed to get architecture"); } @@ -1404,8 +1404,14 @@ NativeRegisterContextLinux_mips64::DoWriteRegisterValue(uint32_t offset, Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGS, m_thread.GetID(), NULL, ®s, sizeof regs); if (error.Success()) { - ::memcpy((void *)(((unsigned char *)(®s)) + offset), value.GetBytes(), 8); - error = NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(), NULL, ®s, sizeof regs); + lldb_private::ArchSpec arch; + if (m_thread.GetProcess()->GetArchitecture(arch)) + { + ::memcpy((void *)(((unsigned char *)(®s)) + offset), value.GetBytes(), arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32 ? 4 : 8); + error = NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(), NULL, ®s, sizeof regs); + } + else + error.SetErrorString("failed to get architecture"); } return error; } |