[Lldb-commits] [lldb] r251906 - [LLDB][MIPS] Fix GetUserRegisterInfoCount to count no of regs which are physically present
Mohit K. Bhakkad via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 3 01:13:45 PST 2015
Author: mohit.bhakkad
Date: Tue Nov 3 03:13:45 2015
New Revision: 251906
URL: http://llvm.org/viewvc/llvm-project?rev=251906&view=rev
Log:
[LLDB][MIPS] Fix GetUserRegisterInfoCount to count no of regs which are physically present
Reviewers: clayborg, labath.
Subscribers: jaydeep, bhushan, sagar, nitesh.jain, lldb-commits.
Differential Revision: http://reviews.llvm.org/D13859
Modified:
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
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp?rev=251906&r1=251905&r2=251906&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.cpp Tue Nov 3 03:13:45 2015
@@ -29,8 +29,17 @@ using namespace lldb;
#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 @@ RegisterContextLinux_mips::GetRegisterCo
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);
}
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h?rev=251906&r1=251905&r2=251906&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips.h Tue Nov 3 03:13:45 2015
@@ -17,7 +17,7 @@ class RegisterContextLinux_mips
: 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 @@ public:
uint32_t
GetUserRegisterCount () const override;
+
+private:
+ uint32_t m_user_register_count;
};
#endif
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp?rev=251906&r1=251905&r2=251906&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.cpp Tue Nov 3 03:13:45 2015
@@ -75,27 +75,31 @@ GetRegisterInfoCount (const ArchSpec &ta
}
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))
{
}
Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h?rev=251906&r1=251905&r2=251906&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_mips64.h Tue Nov 3 03:13:45 2015
@@ -19,7 +19,7 @@ class RegisterContextLinux_mips64
: 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;
More information about the lldb-commits
mailing list