[Lldb-commits] [lldb] r249020 - [LLDB][MIPS] Fix gp register value for o32 applications on 64-bit target

Sagar Thakur via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 1 08:05:32 PDT 2015


Author: slthakur
Date: Thu Oct  1 10:05:31 2015
New Revision: 249020

URL: http://llvm.org/viewvc/llvm-project?rev=249020&view=rev
Log:
[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.


Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=249020&r1=249019&r2=249020&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Oct  1 10:05:31 2015
@@ -2206,6 +2206,8 @@ ObjectFileELF::ParseSymbols (Symtab *sym
                 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,

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp?rev=249020&r1=249019&r2=249020&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp Thu Oct  1 10:05:31 2015
@@ -623,13 +623,6 @@ NativeRegisterContextLinux_mips64::ReadR
     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::DoRea
     {
         lldb_private::ArchSpec arch;
         if (m_thread.GetProcess()->GetArchitecture(arch))
-            value.SetBytes((void *)(((unsigned char *)(&regs)) + offset), 8, arch.GetByteOrder());
+            value.SetBytes((void *)(((unsigned char *)&regs) + offset + 4 * (arch.GetMachine() == llvm::Triple::mips)), arch.GetAddressByteSize(), arch.GetByteOrder());
         else
             error.SetErrorString("failed to get architecture");
     }




More information about the lldb-commits mailing list