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 *)) + offset + 4 *
(arch.GetMachine() == llvm::Triple::mips)), arch.GetAddressByteSize(),
arch.GetByteOrder());
+value.SetBytes((void *)(((unsigned char *)) + 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, , sizeof regs);
if (error.Success())
{
-::memcpy((void *)(((unsigned char *)()) + offset),
value.GetBytes(), 8);
-error = NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS,
m_thread.GetID(), NULL, , sizeof regs);
+lldb_private::ArchSpec arch;
+if (m_thread.GetProcess()->GetArchitecture(arch))
+{
+::memcpy((void *)(((unsigned char *)()) + offset),
value.GetBytes(), 4 + (!(arch.GetFlags() &
lldb_private::ArchSpec::eMIPSABI_O32) * 4));
+error = NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS,
m_thread.GetID(), NULL, , sizeof regs);
+}
+else
+error.SetErrorString("failed to get architecture");
}
return error;
}
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 *)) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetAddressByteSize(), arch.GetByteOrder());
+value.SetBytes((void *)(((unsigned char *)) + 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, , sizeof regs);
if (error.Success())
{
-::memcpy((void *)(((unsigned char *)()) + offset), value.GetBytes(), 8);
-error = NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(), NULL, , sizeof regs);
+lldb_private::ArchSpec arch;
+if (m_thread.GetProcess()->GetArchitecture(arch))
+{
+::memcpy((void *)(((unsigned char *)()) + offset), value.GetBytes(), 4 + (!(arch.GetFlags() & lldb_private::ArchSpec::eMIPSABI_O32) * 4));
+error = NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(), NULL, , sizeof regs);
+}
+else
+error.SetErrorString("failed to get architecture");
}
return error;
}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits