Remove an x86-ism from RegisterInfoInterface
authorPavel Labath <labath@google.com>
Wed, 30 Nov 2016 10:17:58 +0000 (10:17 +0000)
committerPavel Labath <labath@google.com>
Wed, 30 Nov 2016 10:17:58 +0000 (10:17 +0000)
Summary:
While adding FPR support to x86 elf core files (D26300), we ended up adding a
very x86-specific function to the general RegisterInfoInterface class, which I
didn't catch in review. This removes that function. The only reason we needed
it was to find the offset of the FXSAVE area. This is the same as the offset of
the first register within that area, so we might as well use that.

Reviewers: clayborg, dvlahovski

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D27222

llvm-svn: 288236

lldb/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
lldb/source/Plugins/Process/Utility/RegisterContextLinux_i386.h
lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
lldb/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h
lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
lldb/source/Plugins/Process/Utility/RegisterInfoInterface.h

index 2eebadd..6563796 100644 (file)
@@ -111,10 +111,6 @@ RegisterContextLinux_i386::RegisterContextLinux_i386(
 
 size_t RegisterContextLinux_i386::GetGPRSize() const { return sizeof(GPR); }
 
-size_t RegisterContextLinux_i386::GetFXSAVEOffset() const {
-  return (LLVM_EXTENSION offsetof(UserArea, i387));
-}
-
 const RegisterInfo *RegisterContextLinux_i386::GetRegisterInfo() const {
   switch (m_target_arch.GetMachine()) {
   case llvm::Triple::x86:
index bb6707b..fbf8037 100644 (file)
@@ -18,8 +18,6 @@ public:
 
   size_t GetGPRSize() const override;
 
-  size_t GetFXSAVEOffset() const override;
-
   const lldb_private::RegisterInfo *GetRegisterInfo() const override;
 
   uint32_t GetRegisterCount() const override;
index 6f4bb80..526b3ec 100644 (file)
@@ -179,11 +179,6 @@ RegisterContextLinux_x86_64::RegisterContextLinux_x86_64(
 
 size_t RegisterContextLinux_x86_64::GetGPRSize() const { return sizeof(GPR); }
 
-size_t RegisterContextLinux_x86_64::GetFXSAVEOffset() const {
-  return (LLVM_EXTENSION offsetof(UserArea, fpr) +
-          LLVM_EXTENSION offsetof(FPR, xstate));
-}
-
 const std::vector<lldb_private::RegisterInfo> *
 RegisterContextLinux_x86_64::GetDynamicRegisterInfoP() const {
   return &d_register_infos;
index e9e3e8b..99a4cb7 100644 (file)
@@ -18,8 +18,6 @@ public:
 
   size_t GetGPRSize() const override;
 
-  size_t GetFXSAVEOffset() const override;
-
   const lldb_private::RegisterInfo *GetRegisterInfo() const override;
 
   uint32_t GetRegisterCount() const override;
index d6f67cb..67134aa 100644 (file)
@@ -420,7 +420,7 @@ size_t RegisterContextPOSIX_x86::GetGPRSize() {
 }
 
 size_t RegisterContextPOSIX_x86::GetFXSAVEOffset() {
-  return m_register_info_ap->GetFXSAVEOffset();
+  return GetRegisterInfo()[m_reg_info.first_fpr].byte_offset;
 }
 
 const RegisterInfo *RegisterContextPOSIX_x86::GetRegisterInfo() {
index a077640..12db366 100644 (file)
@@ -29,8 +29,6 @@ public:
 
   virtual size_t GetGPRSize() const = 0;
 
-  virtual size_t GetFXSAVEOffset() const { return 0; }
-
   virtual const lldb_private::RegisterInfo *GetRegisterInfo() const = 0;
 
   // Returns the number of registers including the user registers and the