[Lldb-commits] [lldb] r255108 - [LLDB][MIPS] Adding call to IsMSAAvailable() while creating RegisterInfoInterface

Sagar Thakur via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 9 04:31:02 PST 2015


Author: slthakur
Date: Wed Dec  9 06:31:01 2015
New Revision: 255108

URL: http://llvm.org/viewvc/llvm-project?rev=255108&view=rev
Log:
[LLDB][MIPS] Adding call to IsMSAAvailable() while creating RegisterInfoInterface

This patch will fix the test case test_p_returns_correct_data_size_for_each_qRegisterInfo_attach_llgs_* of TestLldbGdbServer.py on mips. The test fails because we were sending RegisterInfo for msa registers to client even when msa registers are not available. With this commit server will send E45(end of resigters) response if msa registers are not available.


Modified:
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h

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=255108&r1=255107&r2=255108&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp Wed Dec  9 06:31:01 2015
@@ -20,6 +20,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/Host.h"
 #include "lldb/Core/EmulateInstruction.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-enumerations.h"
@@ -416,14 +417,14 @@ CreateRegisterInfoInterface(const ArchSp
     if (HostInfo::GetArchitecture().GetAddressByteSize() == 4)
     {
         // 32-bit hosts run with a RegisterContextLinux_mips context.
-        return new RegisterContextLinux_mips(target_arch);
+        return new RegisterContextLinux_mips(target_arch, NativeRegisterContextLinux_mips64::IsMSAAvailable());
     }
     else
     {
         assert((HostInfo::GetArchitecture().GetAddressByteSize() == 8) &&
                "Register setting path assumes this is a 64-bit host");
         // mips64 hosts know how to work with 64-bit and 32-bit EXEs using the mips64 register context.
-        return new RegisterContextLinux_mips64 (target_arch);
+        return new RegisterContextLinux_mips64 (target_arch, NativeRegisterContextLinux_mips64::IsMSAAvailable());
     }
 }
 
@@ -1104,9 +1105,12 @@ NativeRegisterContextLinux_mips64::IsMSA
 bool
 NativeRegisterContextLinux_mips64::IsMSAAvailable()
 {
-    Error error = NativeRegisterContextLinux::ReadRegisterSet(&m_msa, sizeof(MSA_linux_mips), NT_MIPS_MSA);
+    MSA_linux_mips msa_buf;
+    unsigned int regset = NT_MIPS_MSA;
 
-    if (error.Success() && m_msa.mir)
+    Error error = NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, Host::GetCurrentProcessID(), static_cast<void *>(&regset), &msa_buf, sizeof(MSA_linux_mips));
+
+    if (error.Success() && msa_buf.mir)
     {
         return true;
     }

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h?rev=255108&r1=255107&r2=255108&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.h Wed Dec  9 06:31:01 2015
@@ -89,6 +89,9 @@ namespace process_linux {
         uint32_t
         NumSupportedHardwareWatchpoints () override;
 
+        static bool
+        IsMSAAvailable();
+
     protected:
         Error
         DoReadRegisterValue(uint32_t offset,
@@ -119,9 +122,6 @@ namespace process_linux {
         bool
         IsMSA(uint32_t reg_index) const;
 
-        bool
-        IsMSAAvailable();
-
         void*
         GetGPRBuffer() override { return &m_gpr; }
 




More information about the lldb-commits mailing list