mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
[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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user