This revision was automatically updated to reflect the committed changes.
Closed by commit rL251906: [LLDB][MIPS] Fix GetUserRegisterInfoCount to count 
no of regs which are… (authored by mohit.bhakkad).

Changed prior to commit:
  http://reviews.llvm.org/D13859?vs=38785&id=39037#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13859

Files:
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
  lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h

Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
@@ -75,27 +75,31 @@
 }
 
 uint32_t
-GetUserRegisterInfoCount (const ArchSpec &target_arch)
+GetUserRegisterInfoCount (const ArchSpec &target_arch, bool msa_present)
 {
     switch (target_arch.GetMachine())
     {
         case llvm::Triple::mips:
         case llvm::Triple::mipsel:
-            return static_cast<uint32_t> (k_num_user_registers_mips);
+            if (msa_present)
+                return static_cast<uint32_t> (k_num_user_registers_mips);
+            return static_cast<uint32_t> (k_num_user_registers_mips - k_num_msa_registers_mips); 
         case llvm::Triple::mips64el:
         case llvm::Triple::mips64:
-            return static_cast<uint32_t> (k_num_user_registers_mips64);
+            if (msa_present)
+                return static_cast<uint32_t> (k_num_user_registers_mips64);
+            return static_cast<uint32_t> (k_num_user_registers_mips64 - k_num_msa_registers_mips64);
         default:
             assert(false && "Unhandled target architecture.");
             return 0;
     }
 }
 
-RegisterContextLinux_mips64::RegisterContextLinux_mips64(const ArchSpec &target_arch) :
+RegisterContextLinux_mips64::RegisterContextLinux_mips64(const ArchSpec &target_arch, bool msa_present) :
     lldb_private::RegisterInfoInterface(target_arch),
     m_register_info_p (GetRegisterInfoPtr (target_arch)),
     m_register_info_count (GetRegisterInfoCount (target_arch)),
-    m_user_register_count (GetUserRegisterInfoCount (target_arch))
+    m_user_register_count (GetUserRegisterInfoCount (target_arch, msa_present))
 {
 }
 
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
===================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
@@ -19,7 +19,7 @@
     : public lldb_private::RegisterInfoInterface
 {
 public:
-    RegisterContextLinux_mips64(const lldb_private::ArchSpec &target_arch);
+    RegisterContextLinux_mips64(const lldb_private::ArchSpec &target_arch, bool msa_present = true);
 
     size_t
     GetGPRSize() const override;
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp
@@ -29,8 +29,17 @@
 #include "RegisterInfos_mips.h"
 #undef DECLARE_REGISTER_INFOS_MIPS_STRUCT
 
-RegisterContextLinux_mips::RegisterContextLinux_mips(const ArchSpec &target_arch) :
-    RegisterInfoInterface(target_arch)
+uint32_t
+GetUserRegisterInfoCount (bool msa_present)
+{
+    if (msa_present)
+        return static_cast<uint32_t> (k_num_user_registers_mips);
+    return static_cast<uint32_t> (k_num_user_registers_mips - k_num_msa_registers_mips);
+}
+
+RegisterContextLinux_mips::RegisterContextLinux_mips(const ArchSpec &target_arch, bool msa_present) :
+    RegisterInfoInterface(target_arch),
+    m_user_register_count (GetUserRegisterInfoCount (msa_present))
 {
 }
 
@@ -63,5 +72,5 @@
 uint32_t
 RegisterContextLinux_mips::GetUserRegisterCount () const
 {
-    return static_cast<uint32_t> (k_num_user_registers_mips);
+    return static_cast<uint32_t> (m_user_register_count);
 }
Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
===================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
@@ -17,7 +17,7 @@
     : public lldb_private::RegisterInfoInterface
 {
 public:
-    RegisterContextLinux_mips(const lldb_private::ArchSpec &target_arch);
+    RegisterContextLinux_mips(const lldb_private::ArchSpec &target_arch, bool msa_present = true);
 
     size_t
     GetGPRSize() const override;
@@ -30,6 +30,9 @@
 
     uint32_t
     GetUserRegisterCount () const override;
+
+private:
+    uint32_t m_user_register_count;
 };
 
 #endif
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to