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.

llvm-svn: 209016
This commit is contained in:
Todd Fiala 2014-05-16 20:43:19 +00:00
parent fceb76f5f9
commit 4fc3cdd054
18 changed files with 59 additions and 37 deletions

View File

@ -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>";

View File

@ -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)
{
}

View File

@ -19,7 +19,7 @@ class RegisterContextPOSIXProcessMonitor_mips64:
public:
RegisterContextPOSIXProcessMonitor_mips64(lldb_private::Thread &thread,
uint32_t concrete_frame_idx,
RegisterInfoInterface *register_info);
lldb_private::RegisterInfoInterface *register_info);
protected:
bool

View File

@ -53,7 +53,7 @@ size_and_rw_bits(size_t size, bool read, bool write)
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)
{
}

View File

@ -19,7 +19,7 @@ class RegisterContextPOSIXProcessMonitor_x86_64:
public:
RegisterContextPOSIXProcessMonitor_x86_64(lldb_private::Thread &thread,
uint32_t concrete_frame_idx,
RegisterInfoInterface *register_info);
lldb_private::RegisterInfoInterface *register_info);
protected:
bool

View File

@ -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);

View File

@ -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);

View File

@ -93,7 +93,7 @@ GetRegisterInfo_i386(const lldb_private::ArchSpec& arch)
}
RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64(const ArchSpec &target_arch) :
RegisterInfoInterface(target_arch)
lldb_private::RegisterInfoInterface(target_arch)
{
}

View File

@ -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);

View File

@ -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);

View File

@ -106,7 +106,7 @@ GetRegisterInfo_i386(const lldb_private::ArchSpec &arch)
}
RegisterContextLinux_x86_64::RegisterContextLinux_x86_64(const ArchSpec &target_arch) :
RegisterInfoInterface(target_arch)
lldb_private::RegisterInfoInterface(target_arch)
{
}

View File

@ -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);

View File

@ -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_

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);