[Lldb-commits] [lldb] r209016 - Refactored RegisterInfoInterface into its own header.

Todd Fiala todd.fiala at gmail.com
Fri May 16 13:43:20 PDT 2014


Author: tfiala
Date: Fri May 16 15:43:19 2014
New Revision: 209016

URL: http://llvm.org/viewvc/llvm-project?rev=209016&view=rev
Log:
Refactored RegisterInfoInterface into its own header.

Also moved it into the lldb_private namespace.

The llgs branch is making use of this interface and its use is not
strictly limited to POSIX.

Added:
    lldb/trunk/source/Plugins/Process/Utility/RegisterInfoInterface.h
Modified:
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp
    lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.h
    lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp
    lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
    lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
    lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri May 16 15:43:19 2014
@@ -868,6 +868,7 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+		23EDE3371926AAD500F6A132 /* RegisterInfoInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RegisterInfoInterface.h; path = Utility/RegisterInfoInterface.h; sourceTree = "<group>"; };
 		260157C41885F4FF00F875CF /* libpanel.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpanel.dylib; path = /usr/lib/libpanel.dylib; sourceTree = "<absolute>"; };
 		260223E7115F06D500A601A2 /* SBCommunication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBCommunication.h; path = include/lldb/API/SBCommunication.h; sourceTree = "<group>"; };
 		260223E8115F06E500A601A2 /* SBCommunication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBCommunication.cpp; path = source/API/SBCommunication.cpp; sourceTree = "<group>"; };
@@ -2862,6 +2863,7 @@
 				AF68D3301255A110002FF25B /* UnwindLLDB.h */,
 				26E3EEE411A9901300FBADB6 /* UnwindMacOSXFrameBackchain.h */,
 				26E3EEE311A9901300FBADB6 /* UnwindMacOSXFrameBackchain.cpp */,
+				23EDE3371926AAD500F6A132 /* RegisterInfoInterface.h */,
 			);
 			name = Utility;
 			sourceTree = "<group>";

Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp Fri May 16 15:43:19 2014
@@ -22,7 +22,7 @@ using namespace lldb;
 
 RegisterContextPOSIXProcessMonitor_mips64::RegisterContextPOSIXProcessMonitor_mips64(Thread &thread,
                                                                                      uint32_t concrete_frame_idx,
-                                                                                     RegisterInfoInterface *register_info)
+                                                                                     lldb_private::RegisterInfoInterface *register_info)
     : RegisterContextPOSIX_mips64(thread, concrete_frame_idx, register_info)
 {
 }

Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.h Fri May 16 15:43:19 2014
@@ -19,7 +19,7 @@ class RegisterContextPOSIXProcessMonitor
 public:
     RegisterContextPOSIXProcessMonitor_mips64(lldb_private::Thread &thread,
                                               uint32_t concrete_frame_idx,
-                                              RegisterInfoInterface *register_info);
+                                              lldb_private::RegisterInfoInterface *register_info);
 
 protected:
     bool

Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp Fri May 16 15:43:19 2014
@@ -53,7 +53,7 @@ size_and_rw_bits(size_t size, bool read,
 
 RegisterContextPOSIXProcessMonitor_x86_64::RegisterContextPOSIXProcessMonitor_x86_64(Thread &thread,
                                                                                      uint32_t concrete_frame_idx,
-                                                                                     RegisterInfoInterface *register_info)
+                                                                                     lldb_private::RegisterInfoInterface *register_info)
     : RegisterContextPOSIX_x86(thread, concrete_frame_idx, register_info)
 {
 }

Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h Fri May 16 15:43:19 2014
@@ -19,7 +19,7 @@ class RegisterContextPOSIXProcessMonitor
 public:
     RegisterContextPOSIXProcessMonitor_x86_64(lldb_private::Thread &thread,
                                               uint32_t concrete_frame_idx,
-                                              RegisterInfoInterface *register_info);
+                                              lldb_private::RegisterInfoInterface *register_info);
 
 protected:
     bool

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_i386.h Fri May 16 15:43:19 2014
@@ -13,7 +13,7 @@
 #include "RegisterContextPOSIX.h"
 
 class RegisterContextFreeBSD_i386
-  : public RegisterInfoInterface
+  : public lldb_private::RegisterInfoInterface
 {
 public:
     RegisterContextFreeBSD_i386(const lldb_private::ArchSpec &target_arch);

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h Fri May 16 15:43:19 2014
@@ -13,7 +13,7 @@
 #include "RegisterContextPOSIX.h"
 
 class RegisterContextFreeBSD_mips64:
-    public RegisterInfoInterface
+    public lldb_private::RegisterInfoInterface
 {
 public:
     RegisterContextFreeBSD_mips64(const lldb_private::ArchSpec &target_arch);

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp Fri May 16 15:43:19 2014
@@ -93,7 +93,7 @@ GetRegisterInfo_i386(const lldb_private:
 }
 
 RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64(const ArchSpec &target_arch) :
-    RegisterInfoInterface(target_arch)
+    lldb_private::RegisterInfoInterface(target_arch)
 {
 }
 

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h Fri May 16 15:43:19 2014
@@ -13,7 +13,7 @@
 #include "RegisterContextPOSIX.h"
 
 class RegisterContextFreeBSD_x86_64:
-    public RegisterInfoInterface
+    public lldb_private::RegisterInfoInterface
 {
 public:
     RegisterContextFreeBSD_x86_64(const lldb_private::ArchSpec &target_arch);

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.h Fri May 16 15:43:19 2014
@@ -13,7 +13,7 @@
 #include "RegisterContextPOSIX.h"
 
 class RegisterContextLinux_i386
-  : public RegisterInfoInterface
+  : public lldb_private::RegisterInfoInterface
 {
 public:
     RegisterContextLinux_i386(const lldb_private::ArchSpec &target_arch);

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp Fri May 16 15:43:19 2014
@@ -106,7 +106,7 @@ GetRegisterInfo_i386(const lldb_private:
 }
 
 RegisterContextLinux_x86_64::RegisterContextLinux_x86_64(const ArchSpec &target_arch) :
-    RegisterInfoInterface(target_arch)
+    lldb_private::RegisterInfoInterface(target_arch)
 {
 }
 

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_x86_64.h Fri May 16 15:43:19 2014
@@ -13,7 +13,7 @@
 #include "RegisterContextPOSIX.h"
 
 class RegisterContextLinux_x86_64
-  : public RegisterInfoInterface
+    : public lldb_private::RegisterInfoInterface
 {
 public:
     RegisterContextLinux_x86_64(const lldb_private::ArchSpec &target_arch);

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX.h Fri May 16 15:43:19 2014
@@ -15,6 +15,7 @@
 // Other libraries and framework includes
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Target/RegisterContext.h"
+#include "RegisterInfoInterface.h"
 
 //------------------------------------------------------------------------------
 /// @class POSIXBreakpointProtocol
@@ -74,25 +75,5 @@ protected:
     bool m_watchpoints_initialized;
 };
 
-//------------------------------------------------------------------------------
-/// @class RegisterInfoInterface
-///
-/// @brief RegisterInfo interface to patch RegisterInfo structure for archs.
-class RegisterInfoInterface
-{
-public:
-    RegisterInfoInterface(const lldb_private::ArchSpec& target_arch) : m_target_arch(target_arch) {}
-    virtual ~RegisterInfoInterface () {}
-
-    virtual size_t
-    GetGPRSize () = 0;
-
-    virtual const lldb_private::RegisterInfo *
-    GetRegisterInfo () = 0;
-
-public:
-    lldb_private::ArchSpec m_target_arch;
-};
-
 #endif // #ifndef liblldb_RegisterContextPOSIX_H_
 

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.h Fri May 16 15:43:19 2014
@@ -73,7 +73,7 @@ class RegisterContextPOSIX_mips64
 public:
     RegisterContextPOSIX_mips64 (lldb_private::Thread &thread,
                             uint32_t concrete_frame_idx,
-                            RegisterInfoInterface *register_info);
+                            lldb_private::RegisterInfoInterface *register_info);
 
     ~RegisterContextPOSIX_mips64();
 
@@ -112,7 +112,7 @@ public:
 
 protected:
     uint64_t m_gpr_mips64[k_num_gpr_registers_mips64];         // general purpose registers.
-    std::unique_ptr<RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
+    std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
 
     // Determines if an extended register set is supported on the processor running the inferior process.
     virtual bool

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.h Fri May 16 15:43:19 2014
@@ -296,7 +296,7 @@ class RegisterContextPOSIX_x86
 public:
     RegisterContextPOSIX_x86 (lldb_private::Thread &thread,
                             uint32_t concrete_frame_idx,
-                            RegisterInfoInterface *register_info);
+                            lldb_private::RegisterInfoInterface *register_info);
 
     ~RegisterContextPOSIX_x86();
 
@@ -428,7 +428,7 @@ protected:
     FPR      m_fpr;                                            // floating-point registers including extended register sets.
     IOVEC    m_iovec;                                          // wrapper for xsave.
     YMM      m_ymm_set;                                        // copy of ymmh and xmm register halves.
-    std::unique_ptr<RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
+    std::unique_ptr<lldb_private::RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
 
     // Determines if an extended register set is supported on the processor running the inferior process.
     virtual bool

Added: lldb/trunk/source/Plugins/Process/Utility/RegisterInfoInterface.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterInfoInterface.h?rev=209016&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterInfoInterface.h (added)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterInfoInterface.h Fri May 16 15:43:19 2014
@@ -0,0 +1,39 @@
+//===-- RegisterInfoInterface.h --------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_RegisterInfoInterface_h
+#define lldb_RegisterInfoInterface_h
+
+namespace lldb_private
+{
+
+    ///------------------------------------------------------------------------------
+    /// @class RegisterInfoInterface
+    ///
+    /// @brief RegisterInfo interface to patch RegisterInfo structure for archs.
+    ///------------------------------------------------------------------------------
+    class RegisterInfoInterface
+    {
+    public:
+        RegisterInfoInterface(const lldb_private::ArchSpec& target_arch) : m_target_arch(target_arch) {}
+        virtual ~RegisterInfoInterface () {}
+
+        virtual size_t
+        GetGPRSize () = 0;
+
+        virtual const lldb_private::RegisterInfo *
+        GetRegisterInfo () = 0;
+
+    public:
+        lldb_private::ArchSpec m_target_arch;
+    };
+
+}
+
+#endif

Modified: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h Fri May 16 15:43:19 2014
@@ -18,7 +18,7 @@ class RegisterContextCorePOSIX_mips64 :
 {
 public:
     RegisterContextCorePOSIX_mips64 (lldb_private::Thread &thread,
-                                     RegisterInfoInterface *register_info,
+                                     lldb_private::RegisterInfoInterface *register_info,
                                      const lldb_private::DataExtractor &gpregset,
                                      const lldb_private::DataExtractor &fpregset);
 

Modified: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h?rev=209016&r1=209015&r2=209016&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h Fri May 16 15:43:19 2014
@@ -17,7 +17,7 @@ class RegisterContextCorePOSIX_x86_64 :
 {
 public:
     RegisterContextCorePOSIX_x86_64 (lldb_private::Thread &thread,
-                                     RegisterInfoInterface *register_info,
+                                     lldb_private::RegisterInfoInterface *register_info,
                                      const lldb_private::DataExtractor &gpregset,
                                      const lldb_private::DataExtractor &fpregset);
 





More information about the lldb-commits mailing list