[Lldb-commits] [PATCH] D15884: [LLDB][MIPS] Make register read/write to set/get the size of register according to abi.
Sagar Thakur via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 4 23:03:30 PST 2016
sagar created this revision.
sagar added reviewers: clayborg, tberghammer.
sagar added subscribers: jaydeep, bhushan, mohit.bhakkad, nitesh.jain, lldb-commits.
sagar set the repository for this revision to rL LLVM.
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.
Repository:
rL LLVM
http://reviews.llvm.org/D15884
Files:
source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
===================================================================
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
@@ -1388,7 +1388,7 @@
{
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)), 4 + (!(arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32) * 4), arch.GetByteOrder());
else
error.SetErrorString("failed to get architecture");
}
@@ -1404,8 +1404,14 @@
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(), 4 + (!(arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32) * 4));
+ error = NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(), NULL, ®s, sizeof regs);
+ }
+ else
+ error.SetErrorString("failed to get architecture");
}
return error;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15884.43963.patch
Type: text/x-patch
Size: 1747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160105/955bc389/attachment.bin>
More information about the lldb-commits
mailing list