From b8862c010743f1992f6a4a903502439224193a81 Mon Sep 17 00:00:00 2001 From: Sagar Thakur Date: Thu, 1 Oct 2015 15:05:31 +0000 Subject: [PATCH] [LLDB][MIPS] Fix gp register value for o32 applications on 64-bit target GP registers for o32 applications were always giving zero value because SetType() on the RegisterValue was causing the accessor functions to pickup the value from m_scalar of RegisterValue which is zero. In this patch byte size and byte order of register value is set at the time of setting the value of the register. llvm-svn: 249020 --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 2 ++ .../Process/Linux/NativeRegisterContextLinux_mips64.cpp | 9 +-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index f9f035878c42..250db126791f 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2206,6 +2206,8 @@ ObjectFileELF::ParseSymbols (Symtab *symtab, mangled.SetDemangledName( ConstString((demangled_name + suffix).str()) ); } + printf("Symbol: name=%s, Type:%d value=%08lx\n", symbol_name, symbol_type, symbol.st_value); + Symbol dc_symbol( i + start_id, // ID is the original symbol table index. mangled, diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp index 33f5263ed2a6..0d48091da43e 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -623,13 +623,6 @@ NativeRegisterContextLinux_mips64::ReadRegister (const RegisterInfo *reg_info, R else { error = ReadRegisterRaw(reg, reg_value); - if (error.Success()) - { - // If our return byte size was greater than the return value reg size, then - // use the type specified by reg_info rather than the uint64_t default - if (reg_value.GetByteSize() > reg_info->byte_size) - reg_value.SetType(reg_info); - } } return error; @@ -1387,7 +1380,7 @@ NativeRegisterContextLinux_mips64::DoReadRegisterValue(uint32_t offset, { lldb_private::ArchSpec arch; if (m_thread.GetProcess()->GetArchitecture(arch)) - value.SetBytes((void *)(((unsigned char *)(®s)) + offset), 8, arch.GetByteOrder()); + value.SetBytes((void *)(((unsigned char *)®s) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetAddressByteSize(), arch.GetByteOrder()); else error.SetErrorString("failed to get architecture"); }