Index: source/Plugins/Process/POSIX/CMakeLists.txt
===================================================================
--- source/Plugins/Process/POSIX/CMakeLists.txt
+++ source/Plugins/Process/POSIX/CMakeLists.txt
@@ -10,8 +10,10 @@
   ProcessMessage.cpp
   ProcessPOSIX.cpp
   ProcessPOSIXLog.cpp
+  RegisterContextPOSIX_i386.cpp
+  RegisterContextPOSIX_x86_64.cpp
   RegisterContextFreeBSD_x86_64.cpp
-  RegisterContext_i386.cpp
   RegisterContextLinux_x86_64.cpp
-  RegisterContext_x86_64.cpp
+  RegisterContextPOSIXProcessMonitor_i386.cpp
+  RegisterContextPOSIXProcessMonitor_x86_64.cpp
   )
Index: source/Plugins/Process/POSIX/POSIXThread.cpp
===================================================================
--- source/Plugins/Process/POSIX/POSIXThread.cpp
+++ source/Plugins/Process/POSIX/POSIXThread.cpp
@@ -29,9 +29,9 @@
 #include "ProcessPOSIX.h"
 #include "ProcessPOSIXLog.h"
 #include "ProcessMonitor.h"
-#include "RegisterContext_i386.h"
-#include "RegisterContext_x86_64.h"
-#include "RegisterContextPOSIX.h"
+#include "RegisterContextPOSIX_i386.h"
+#include "RegisterContextPOSIXProcessMonitor_i386.h"
+#include "RegisterContextPOSIXProcessMonitor_x86_64.h"
 #include "RegisterContextLinux_x86_64.h"
 #include "RegisterContextFreeBSD_x86_64.h"
 
@@ -149,17 +149,17 @@
         case ArchSpec::eCore_x86_32_i386:
         case ArchSpec::eCore_x86_32_i486:
         case ArchSpec::eCore_x86_32_i486sx:
-            m_reg_context_sp.reset(new RegisterContext_i386(*this, 0));
+            m_reg_context_sp.reset(new RegisterContextPOSIXProcessMonitor_i386(*this, 0));
             break;
 
         case ArchSpec::eCore_x86_64_x86_64:
             switch (arch.GetTriple().getOS())
             {
                 case llvm::Triple::FreeBSD:
-                    m_reg_context_sp.reset(new RegisterContextFreeBSD_x86_64(*this, 0));
+                    m_reg_context_sp.reset(new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, new RegisterContextFreeBSD_x86_64()));
                     break;
                 case llvm::Triple::Linux:
-                    m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0));
+                    m_reg_context_sp.reset(new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, new RegisterContextLinux_x86_64()));
                     break;
                 default:
                     assert(false && "OS not supported");
Index: source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
+++ source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
@@ -7,8 +7,8 @@
 //
 //===---------------------------------------------------------------------===//
 
+#include "RegisterContextPOSIX_x86_64.h"
 #include "RegisterContextFreeBSD_x86_64.h"
-#include <vector>
 
 using namespace lldb_private;
 
@@ -19,13 +19,13 @@
 // Update the FreeBSD specific information (offset and size).
 #define UPDATE_GPR_INFO(reg)                                                \
 do {                                                                        \
-    GetRegisterContext()[gpr_##reg].byte_size = sizeof(GPR::reg);               \
-    GetRegisterContext()[gpr_##reg].byte_offset = GPR_OFFSET(reg);              \
+    m_register_infos[gpr_##reg].byte_size = sizeof(GPR::reg);               \
+    m_register_infos[gpr_##reg].byte_offset = GPR_OFFSET(reg);              \
 } while(false);
 
 #define UPDATE_I386_GPR_INFO(i386_reg, reg)                                 \
 do {                                                                        \
-    GetRegisterContext()[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg);         \
+    m_register_infos[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg);         \
 } while(false);
 
 typedef struct _GPR
@@ -58,15 +58,11 @@
     uint64_t ss;
 } GPR;
 
-// Use a singleton function to avoid global constructors in shared libraries.
-static std::vector<RegisterInfo> & GetRegisterContext () {
-    static std::vector<RegisterInfo> g_register_infos;
-    return g_register_infos;
+RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64()
+{
 }
 
-
-RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64(Thread &thread, uint32_t concrete_frame_idx):
-    RegisterContext_x86_64(thread, concrete_frame_idx)
+RegisterContextFreeBSD_x86_64::~RegisterContextFreeBSD_x86_64()
 {
 }
 
@@ -77,21 +73,17 @@
 }
 
 const RegisterInfo *
-RegisterContextFreeBSD_x86_64::GetRegisterInfo()
+RegisterContextFreeBSD_x86_64::GetRegisterInfo(const RegisterInfo *base_info)
 {
     // Allocate RegisterInfo only once
-    if (GetRegisterContext().empty())
+    if (m_register_infos.empty())
     {
         // Copy the register information from base class
-        const RegisterInfo *base_info = RegisterContext_x86_64::GetRegisterInfo();
-        if (base_info)
-        {
-            GetRegisterContext().insert(GetRegisterContext().end(), &base_info[0], &base_info[k_num_registers]);
-            // Update the FreeBSD specific register information (offset and size).
-            UpdateRegisterInfo();
-        }
+        m_register_infos.insert(m_register_infos.end(), &base_info[0], &base_info[k_num_registers]);
+        // Update the FreeBSD specific register information (offset and size).
+        UpdateRegisterInfo();
     }
-    return &GetRegisterContext()[0];
+    return &m_register_infos[0];
 }
 
 void
Index: source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h
+++ source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h
@@ -10,23 +10,27 @@
 #ifndef liblldb_RegisterContextFreeBSD_x86_64_H_
 #define liblldb_RegisterContextFreeBSD_x86_64_H_
 
-#include "Plugins/Process/POSIX/RegisterContext_x86_64.h"
+#include <vector>
+#include "RegisterContextPOSIX.h"
 
 class RegisterContextFreeBSD_x86_64:
-    public RegisterContext_x86_64
+    public RegisterInfoInterface
 {
 public:
-    RegisterContextFreeBSD_x86_64(lldb_private::Thread &thread, uint32_t concrete_frame_idx);
+    RegisterContextFreeBSD_x86_64();
+    virtual ~RegisterContextFreeBSD_x86_64();
 
     size_t
     GetGPRSize();
 
-protected:
-    virtual const lldb_private::RegisterInfo *
-    GetRegisterInfo();
+    const lldb_private::RegisterInfo *
+    GetRegisterInfo(const lldb_private::RegisterInfo *base_info);
 
-    virtual void
+protected:
+    void
     UpdateRegisterInfo();
+
+    std::vector<lldb_private::RegisterInfo> m_register_infos;
 };
 
 #endif
Index: source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
@@ -8,8 +8,8 @@
 //===---------------------------------------------------------------------===//
 
 #include "llvm/Support/Compiler.h"
+#include "RegisterContextPOSIX_x86_64.h"
 #include "RegisterContextLinux_x86_64.h"
-#include <vector>
 
 using namespace lldb_private;
 
@@ -20,22 +20,22 @@
 // Update the Linux specific information (offset and size).
 #define UPDATE_GPR_INFO(reg)                                                \
 do {                                                                        \
-    GetRegisterContext()[gpr_##reg].byte_size = sizeof(GPR::reg);               \
-    GetRegisterContext()[gpr_##reg].byte_offset = GPR_OFFSET(reg);              \
+    m_register_infos[gpr_##reg].byte_size = sizeof(GPR::reg);               \
+    m_register_infos[gpr_##reg].byte_offset = GPR_OFFSET(reg);              \
 } while(false);
 
 #define UPDATE_I386_GPR_INFO(i386_reg, reg)                                 \
 do {                                                                        \
-    GetRegisterContext()[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg);         \
+    m_register_infos[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg);         \
 } while(false);
 
 #define DR_OFFSET(reg_index)                                                \
     (LLVM_EXTENSION offsetof(UserArea, u_debugreg[reg_index]))
 
 #define UPDATE_DR_INFO(reg_index)                                                \
 do {                                                                             \
-    GetRegisterContext()[dr##reg_index].byte_size = sizeof(UserArea::u_debugreg[0]); \
-    GetRegisterContext()[dr##reg_index].byte_offset = DR_OFFSET(reg_index);          \
+    m_register_infos[dr##reg_index].byte_size = sizeof(UserArea::u_debugreg[0]); \
+    m_register_infos[dr##reg_index].byte_offset = DR_OFFSET(reg_index);          \
 } while(false);
 
 typedef struct _GPR
@@ -69,7 +69,7 @@
     uint64_t gs;
 } GPR;
 
-typedef RegisterContext_x86_64::FXSAVE FXSAVE;
+typedef RegisterContextPOSIX_x86_64::FXSAVE FXSAVE;
 
 struct UserArea
 {
@@ -94,14 +94,11 @@
     uint64_t fault_address; // Control register CR3.
 };
 
-// Use a singleton function to avoid global constructors in shared libraries.
-static std::vector<RegisterInfo> & GetRegisterContext () {
-    static std::vector<RegisterInfo> g_register_infos;
-    return g_register_infos;
+RegisterContextLinux_x86_64::RegisterContextLinux_x86_64()
+{
 }
 
-RegisterContextLinux_x86_64::RegisterContextLinux_x86_64(Thread &thread, uint32_t concrete_frame_idx):
-    RegisterContext_x86_64(thread, concrete_frame_idx)
+RegisterContextLinux_x86_64::~RegisterContextLinux_x86_64()
 {
 }
 
@@ -112,21 +109,17 @@
 }
 
 const RegisterInfo *
-RegisterContextLinux_x86_64::GetRegisterInfo()
+RegisterContextLinux_x86_64::GetRegisterInfo(const RegisterInfo *base_info)
 {
     // Allocate RegisterInfo only once
-    if (GetRegisterContext().empty())
+    if (m_register_infos.empty())
     {
         // Copy the register information from base class
-        const RegisterInfo *base_info = RegisterContext_x86_64::GetRegisterInfo();
-        if (base_info)
-        {
-            GetRegisterContext().insert(GetRegisterContext().end(), &base_info[0], &base_info[k_num_registers]);
-            // Update the Linux specific register information (offset and size).
-            UpdateRegisterInfo();
-        }
+        m_register_infos.insert(m_register_infos.end(), &base_info[0], &base_info[k_num_registers]);
+        // Update the Linux specific register information (offset and size).
+        UpdateRegisterInfo();
     }
-    return &GetRegisterContext()[0];
+    return &m_register_infos[0];
 }
 
 void
Index: source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h
+++ source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h
@@ -10,23 +10,27 @@
 #ifndef liblldb_RegisterContextLinux_x86_64_H_
 #define liblldb_RegisterContextLinux_x86_64_H_
 
-#include "Plugins/Process/POSIX/RegisterContext_x86_64.h"
+#include <vector>
+#include "RegisterContextPOSIX.h"
 
-class RegisterContextLinux_x86_64:
-    public RegisterContext_x86_64
+class RegisterContextLinux_x86_64
+  : public RegisterInfoInterface
 {
 public:
-    RegisterContextLinux_x86_64(lldb_private::Thread &thread, uint32_t concrete_frame_idx);
+    RegisterContextLinux_x86_64();
+    virtual ~RegisterContextLinux_x86_64();
 
     size_t
     GetGPRSize();
 
-protected:
-    virtual const lldb_private::RegisterInfo *
-    GetRegisterInfo();
+    const lldb_private::RegisterInfo *
+    GetRegisterInfo(const lldb_private::RegisterInfo *base_info);
 
-    virtual void
+protected:
+    void
     UpdateRegisterInfo();
+
+    std::vector<lldb_private::RegisterInfo> m_register_infos;
 };
 
 #endif
Index: source/Plugins/Process/POSIX/RegisterContextPOSIX.h
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextPOSIX.h
+++ source/Plugins/Process/POSIX/RegisterContextPOSIX.h
@@ -67,4 +67,21 @@
     bool m_watchpoints_initialized;
 };
 
+//------------------------------------------------------------------------------
+/// @class RegisterInfoInterface
+///
+/// @brief RegisterInfo interface to patch RegisterInfo structure for archs.
+class RegisterInfoInterface
+{
+public:
+    virtual ~RegisterInfoInterface() {}
+
+    virtual size_t
+    GetGPRSize() = 0;
+
+    virtual const lldb_private::RegisterInfo *
+    GetRegisterInfo(const lldb_private::RegisterInfo *base_info) = 0;
+};
+
 #endif // #ifndef liblldb_RegisterContextPOSIX_H_
+
Index: source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp
===================================================================
--- /dev/null
+++ source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp
@@ -0,0 +1,80 @@
+//===-- RegisterContextPOSIXProcessMonitor_i386.h --------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------===//
+
+#include "lldb/Target/Thread.h"
+
+#include "ProcessPOSIX.h"
+#include "RegisterContextPOSIXProcessMonitor_i386.h"
+#include "ProcessMonitor.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+RegisterContextPOSIXProcessMonitor_i386::RegisterContextPOSIXProcessMonitor_i386(Thread &thread,
+                                                                                 uint32_t concrete_frame_idx)
+    : RegisterContextPOSIX_i386(thread, concrete_frame_idx)
+{
+}
+
+ProcessMonitor &
+RegisterContextPOSIXProcessMonitor_i386::GetMonitor()
+{
+    ProcessSP base = CalculateProcess();
+    ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());
+    return process->GetMonitor();
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_i386::ReadGPR()
+{
+    bool result;
+
+    ProcessMonitor &monitor = GetMonitor();
+    result = monitor.ReadGPR(m_thread.GetID(), &m_user.regs, sizeof(m_user.regs));
+    LogGPR("RegisterContextPOSIXProcessMonitor_i386::ReadGPR()");
+    return result;
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_i386::ReadFPR()
+{
+    ProcessMonitor &monitor = GetMonitor();
+    return monitor.ReadFPR(m_thread.GetID(), &m_user.i387, sizeof(m_user.i387));
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_i386::WriteGPR()
+{
+    return false;
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_i386::WriteFPR()
+{
+    return false;
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_i386::ReadRegister(const RegisterInfo *reg_info,
+                                                      RegisterValue &value)
+{
+    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
+    ProcessMonitor &monitor = GetMonitor();
+    return monitor.ReadRegisterValue(m_thread.GetID(), GetRegOffset(reg),
+                                     GetRegisterName(reg), GetRegSize(reg), value);
+}
+
+bool RegisterContextPOSIXProcessMonitor_i386::WriteRegister(const RegisterInfo *reg_info,
+                                                            const RegisterValue &value)
+{
+    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
+    ProcessMonitor &monitor = GetMonitor();
+    return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg),
+                                      GetRegisterName(reg), value);
+}
Index: source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h
===================================================================
--- /dev/null
+++ source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h
@@ -0,0 +1,46 @@
+//===-- RegisterContextPOSIXProcessMonitor_i386.h ---------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegisterContextPOSIXProcessMonitor_i386_H_
+#define liblldb_RegisterContextPOSIXProcessMonitor_i386_H_
+
+#include "Plugins/Process/POSIX/RegisterContextPOSIX_i386.h"
+
+class RegisterContextPOSIXProcessMonitor_i386:
+    public RegisterContextPOSIX_i386
+{
+public:
+    RegisterContextPOSIXProcessMonitor_i386(lldb_private::Thread &thread,
+                                            uint32_t concrete_frame_idx);
+
+protected:
+    bool
+    ReadGPR();
+
+    bool
+    ReadFPR();
+
+    bool
+    WriteGPR();
+
+    bool
+    WriteFPR();
+
+	bool
+	ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value);
+
+	bool
+	WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value);
+
+private:
+    ProcessMonitor &
+    GetMonitor();
+};
+
+#endif
Index: source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp
===================================================================
--- /dev/null
+++ source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp
@@ -0,0 +1,98 @@
+//===-- RegisterContextPOSIXProcessMonitor_x86_64.h ------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===---------------------------------------------------------------------===//
+
+#include "lldb/Target/Thread.h"
+
+#include "ProcessPOSIX.h"
+#include "RegisterContextPOSIXProcessMonitor_x86_64.h"
+#include "ProcessMonitor.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+// Support ptrace extensions even when compiled without required kernel support
+#ifndef NT_X86_XSTATE
+  #define NT_X86_XSTATE 0x202
+#endif
+
+RegisterContextPOSIXProcessMonitor_x86_64::RegisterContextPOSIXProcessMonitor_x86_64(Thread &thread,
+                                                                                     uint32_t concrete_frame_idx,
+                                                                                     RegisterInfoInterface *register_info)
+    : RegisterContextPOSIX_x86_64(thread, concrete_frame_idx, register_info)
+{
+}
+
+ProcessMonitor &
+RegisterContextPOSIXProcessMonitor_x86_64::GetMonitor()
+{
+    ProcessSP base = CalculateProcess();
+    ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());
+    return process->GetMonitor();
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_x86_64::ReadGPR()
+{
+     ProcessMonitor &monitor = GetMonitor();
+     return monitor.ReadGPR(m_thread.GetID(), &m_gpr, GetGPRSize());
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_x86_64::ReadFPR()
+{
+    ProcessMonitor &monitor = GetMonitor();
+    if (m_fpr_type == eFXSAVE)
+        return monitor.ReadFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
+
+    if (m_fpr_type == eXSAVE)
+        return monitor.ReadRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
+    return false;
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_x86_64::WriteGPR()
+{
+    ProcessMonitor &monitor = GetMonitor();
+    return monitor.WriteGPR(m_thread.GetID(), &m_gpr, GetGPRSize());
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_x86_64::WriteFPR()
+{
+    ProcessMonitor &monitor = GetMonitor();
+    if (m_fpr_type == eFXSAVE)
+        return monitor.WriteFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
+
+    if (m_fpr_type == eXSAVE)
+        return monitor.WriteRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
+    return false;
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister(const unsigned reg,
+                                                        RegisterValue &value)
+{
+    ProcessMonitor &monitor = GetMonitor();
+    return monitor.ReadRegisterValue(m_thread.GetID(),
+                                     GetRegisterOffset(reg),
+                                     GetRegisterName(reg),
+                                     GetRegisterSize(reg),
+                                     value);
+}
+
+bool
+RegisterContextPOSIXProcessMonitor_x86_64::WriteRegister(const unsigned reg,
+                                                         const RegisterValue &value)
+{
+    ProcessMonitor &monitor = GetMonitor();
+    return monitor.WriteRegisterValue(m_thread.GetID(),
+                                      GetRegisterOffset(reg),
+                                      GetRegisterName(reg),
+                                      value);
+}
Index: source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h
===================================================================
--- /dev/null
+++ source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h
@@ -0,0 +1,47 @@
+//===-- RegisterContextPOSIXProcessMonitor_x86_64.h -------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_RegisterContextPOSIXProcessMonitor_x86_64_H_
+#define liblldb_RegisterContextPOSIXProcessMonitor_x86_64_H_
+
+#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h"
+
+class RegisterContextPOSIXProcessMonitor_x86_64:
+    public RegisterContextPOSIX_x86_64
+{
+public:
+    RegisterContextPOSIXProcessMonitor_x86_64(lldb_private::Thread &thread,
+                                              uint32_t concrete_frame_idx,
+                                              RegisterInfoInterface *register_info);
+
+protected:
+    bool
+    ReadGPR();
+
+    bool
+    ReadFPR();
+
+    bool
+    WriteGPR();
+
+    bool
+    WriteFPR();
+
+    bool
+    ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
+
+    bool
+    WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value);
+
+private:
+    ProcessMonitor &
+    GetMonitor();
+};
+
+#endif
Index: source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp
+++ source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp
@@ -15,7 +15,7 @@
 #include "ProcessPOSIX.h"
 #include "ProcessPOSIXLog.h"
 #include "ProcessMonitor.h"
-#include "RegisterContext_i386.h"
+#include "RegisterContextPOSIX_i386.h"
 #include "RegisterContext_x86.h"
 
 using namespace lldb_private;
@@ -147,25 +147,25 @@
 
 // Computes the offset of the given GPR in the user data area.
 #define GPR_OFFSET(regname) \
-    (offsetof(RegisterContext_i386::UserArea, regs) + \
-     offsetof(RegisterContext_i386::GPR, regname))
+    (offsetof(RegisterContextPOSIX_i386::UserArea, regs) + \
+     offsetof(RegisterContextPOSIX_i386::GPR, regname))
 
 // Computes the offset of the given FPR in the user data area.
 #define FPR_OFFSET(regname) \
-    (offsetof(RegisterContext_i386::UserArea, i387) + \
-     offsetof(RegisterContext_i386::FPU, regname))
+    (offsetof(RegisterContextPOSIX_i386::UserArea, i387) + \
+     offsetof(RegisterContextPOSIX_i386::FPU, regname))
 
 // Number of bytes needed to represent a GPR.
-#define GPR_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)
+#define GPR_SIZE(reg) sizeof(((RegisterContextPOSIX_i386::GPR*)NULL)->reg)
 
 // Number of bytes needed to represent a FPR.
-#define FPR_SIZE(reg) sizeof(((RegisterContext_i386::FPU*)NULL)->reg)
+#define FPR_SIZE(reg) sizeof(((RegisterContextPOSIX_i386::FPU*)NULL)->reg)
 
 // Number of bytes needed to represent the i'th FP register.
-#define FP_SIZE sizeof(((RegisterContext_i386::MMSReg*)NULL)->bytes)
+#define FP_SIZE sizeof(((RegisterContextPOSIX_i386::MMSReg*)NULL)->bytes)
 
 // Number of bytes needed to represent an XMM register.
-#define XMM_SIZE sizeof(RegisterContext_i386::XMMReg)
+#define XMM_SIZE sizeof(RegisterContextPOSIX_i386::XMMReg)
 
 #define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)        \
     { #reg, alt, GPR_SIZE(reg), GPR_OFFSET(reg), eEncodingUint, \
@@ -244,55 +244,47 @@
 static size_t k_num_register_infos = (sizeof(g_register_infos)/sizeof(RegisterInfo));
 #endif
 
-static unsigned GetRegOffset(unsigned reg)
+unsigned RegisterContextPOSIX_i386::GetRegOffset(unsigned reg)
 {
     assert(reg < k_num_registers && "Invalid register number.");
     return g_register_infos[reg].byte_offset;
 }
 
-static unsigned GetRegSize(unsigned reg)
+unsigned RegisterContextPOSIX_i386::GetRegSize(unsigned reg)
 {
     assert(reg < k_num_registers && "Invalid register number.");
     return g_register_infos[reg].byte_size;
 }
 
-RegisterContext_i386::RegisterContext_i386(Thread &thread,
+RegisterContextPOSIX_i386::RegisterContextPOSIX_i386(Thread &thread,
                                                      uint32_t concrete_frame_idx)
     : RegisterContextPOSIX(thread, concrete_frame_idx)
 {
 }
 
-RegisterContext_i386::~RegisterContext_i386()
+RegisterContextPOSIX_i386::~RegisterContextPOSIX_i386()
 {
 }
 
-ProcessMonitor &
-RegisterContext_i386::GetMonitor()
-{
-    ProcessSP base = CalculateProcess();
-    ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());
-    return process->GetMonitor();
-}
-
 void
-RegisterContext_i386::Invalidate()
+RegisterContextPOSIX_i386::Invalidate()
 {
 }
 
 void
-RegisterContext_i386::InvalidateAllRegisters()
+RegisterContextPOSIX_i386::InvalidateAllRegisters()
 {
 }
 
 size_t
-RegisterContext_i386::GetRegisterCount()
+RegisterContextPOSIX_i386::GetRegisterCount()
 {
     assert(k_num_register_infos == k_num_registers);
     return k_num_registers;
 }
 
 const RegisterInfo *
-RegisterContext_i386::GetRegisterInfoAtIndex(size_t reg)
+RegisterContextPOSIX_i386::GetRegisterInfoAtIndex(size_t reg)
 {
     assert(k_num_register_infos == k_num_registers);
     if (reg < k_num_registers)
@@ -302,22 +294,22 @@
 }
 
 size_t
-RegisterContext_i386::GetRegisterSetCount()
+RegisterContextPOSIX_i386::GetRegisterSetCount()
 {
     return k_num_register_sets;
 }
 
 const RegisterSet *
-RegisterContext_i386::GetRegisterSet(size_t set)
+RegisterContextPOSIX_i386::GetRegisterSet(size_t set)
 {
     if (set < k_num_register_sets)
         return &g_reg_sets[set];
     else
         return NULL;
 }
 
 unsigned
-RegisterContext_i386::GetRegisterIndexFromOffset(unsigned offset)
+RegisterContextPOSIX_i386::GetRegisterIndexFromOffset(unsigned offset)
 {
     unsigned reg;
     for (reg = 0; reg < k_num_registers; reg++)
@@ -330,45 +322,26 @@
 }
 
 const char *
-RegisterContext_i386::GetRegisterName(unsigned reg)
+RegisterContextPOSIX_i386::GetRegisterName(unsigned reg)
 {
     assert(reg < k_num_registers && "Invalid register offset.");
     return g_register_infos[reg].name;
 }
 
 bool
-RegisterContext_i386::ReadRegister(const RegisterInfo *reg_info,
-                                        RegisterValue &value)
-{
-    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.ReadRegisterValue(m_thread.GetID(), GetRegOffset(reg),
-                                     GetRegisterName(reg), GetRegSize(reg), value);
-}
-
-bool
-RegisterContext_i386::ReadAllRegisterValues(DataBufferSP &data_sp)
+RegisterContextPOSIX_i386::ReadAllRegisterValues(DataBufferSP &data_sp)
 {
     return false;
 }
 
-bool RegisterContext_i386::WriteRegister(const RegisterInfo *reg_info,
-                                         const RegisterValue &value)
-{
-    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg),
-                                      GetRegisterName(reg), value);
-}
-
 bool
-RegisterContext_i386::WriteAllRegisterValues(const DataBufferSP &data)
+RegisterContextPOSIX_i386::WriteAllRegisterValues(const DataBufferSP &data)
 {
     return false;
 }
 
 bool
-RegisterContext_i386::UpdateAfterBreakpoint()
+RegisterContextPOSIX_i386::UpdateAfterBreakpoint()
 {
     // PC points one byte past the int3 responsible for the breakpoint.
     lldb::addr_t pc;
@@ -381,7 +354,7 @@
 }
 
 uint32_t
-RegisterContext_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,
+RegisterContextPOSIX_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,
                                                                uint32_t num)
 {
     if (kind == eRegisterKindGeneric)
@@ -490,7 +463,7 @@
 }
 
 bool
-RegisterContext_i386::HardwareSingleStep(bool enable)
+RegisterContextPOSIX_i386::HardwareSingleStep(bool enable)
 {
     enum { TRACE_BIT = 0x100 };
     uint64_t eflags;
@@ -517,7 +490,7 @@
 }
 
 void
-RegisterContext_i386::LogGPR(const char *title)
+RegisterContextPOSIX_i386::LogGPR(const char *title)
 {
     Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));
     if (log)
@@ -527,25 +500,7 @@
         for (uint32_t i=0; i<k_num_gpr_registers; i++)
         {
             uint32_t reg = gpr_eax + i;
-            log->Printf("%12s = 0x%8.8" PRIx64, g_register_infos[reg].name, ((uint64_t*)&user.regs)[reg]);
+            log->Printf("%12s = 0x%8.8" PRIx64, g_register_infos[reg].name, ((uint64_t*)&m_user.regs)[reg]);
         }
     }
 }
-
-bool
-RegisterContext_i386::ReadGPR()
-{
-    bool result;
-
-    ProcessMonitor &monitor = GetMonitor();
-    result = monitor.ReadGPR(m_thread.GetID(), &user.regs, sizeof(user.regs));
-    LogGPR("RegisterContext_i386::ReadGPR()");
-    return result;
-}
-
-bool
-RegisterContext_i386::ReadFPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.ReadFPR(m_thread.GetID(), &user.i387, sizeof(user.i387));
-}
Index: source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h
+++ source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h
@@ -1,4 +1,4 @@
-//===-- RegisterContext_i386.h ------------------------------*- C++ -*-===//
+//===-- RegisterContextPOSIX_i386.h -----------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,13 +17,14 @@
 #include "lldb/Core/Log.h"
 #include "RegisterContextPOSIX.h"
 
-class RegisterContext_i386 : public RegisterContextPOSIX
+class RegisterContextPOSIX_i386 :
+    public RegisterContextPOSIX
 {
 public:
-    RegisterContext_i386(lldb_private::Thread &thread,
+    RegisterContextPOSIX_i386(lldb_private::Thread &thread,
                               uint32_t concreate_frame_idx);
 
-    ~RegisterContext_i386();
+    ~RegisterContextPOSIX_i386();
 
     void
     Invalidate();
@@ -57,7 +58,7 @@
 
     virtual bool
     ReadRegister(const lldb_private::RegisterInfo *reg_info,
-                 lldb_private::RegisterValue &value);
+                 lldb_private::RegisterValue &value) = 0;
 
     bool
     ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
@@ -71,7 +72,7 @@
 
     virtual bool
     WriteRegister(const lldb_private::RegisterInfo *reg_info,
-                  const lldb_private::RegisterValue &value);
+                  const lldb_private::RegisterValue &value) = 0;
 
     bool
     WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
@@ -155,15 +156,19 @@
         char     u_comm[32];    // Command causing core dump.
         uint32_t u_debugreg[8]; // Debug registers (DR0 - DR7).
     };
-private:
-    UserArea user;
 
-    ProcessMonitor &GetMonitor();
+protected:
+    UserArea m_user;
+
+    static unsigned GetRegOffset(unsigned reg);
+    static unsigned GetRegSize(unsigned reg);
 
     void LogGPR(const char *title);
 
-    bool ReadGPR();
-    bool ReadFPR();
+    virtual bool ReadGPR() = 0;
+    virtual bool ReadFPR() = 0;
+    virtual bool WriteGPR() = 0;
+    virtual bool WriteFPR() = 0;
 };
 
 #endif // #ifndef liblldb_RegisterContext_i386_h_
Index: source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
+++ source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
@@ -1,4 +1,4 @@
-//===-- RegisterContext_x86_64.cpp -------------------------*- C++ -*-===//
+//===-- RegisterContextPOSIX_x86_64.cpp -------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -21,22 +21,14 @@
 #include "llvm/Support/Compiler.h"
 
 #include "ProcessPOSIX.h"
-#if defined(__linux__) or defined(__FreeBSD__)
-#include "ProcessMonitor.h"
-#endif
-#include "RegisterContext_i386.h"
+#include "RegisterContextPOSIX_i386.h"
 #include "RegisterContext_x86.h"
-#include "RegisterContext_x86_64.h"
+#include "RegisterContextPOSIX_x86_64.h"
 #include "Plugins/Process/elf-core/ProcessElfCore.h"
 
 using namespace lldb_private;
 using namespace lldb;
 
-// Support ptrace extensions even when compiled without required kernel support
-#ifndef NT_X86_XSTATE
-  #define NT_X86_XSTATE 0x202
-#endif
-
 enum
 {
     gcc_dwarf_gpr_rax = 0,
@@ -291,27 +283,27 @@
 
 // Computes the offset of the given FPR in the extended data area.
 #define FPR_OFFSET(regname) \
-    (offsetof(RegisterContext_x86_64::FPR, xstate) + \
-     offsetof(RegisterContext_x86_64::FXSAVE, regname))
+    (offsetof(RegisterContextPOSIX_x86_64::FPR, xstate) + \
+     offsetof(RegisterContextPOSIX_x86_64::FXSAVE, regname))
 
 // Computes the offset of the YMM register assembled from register halves.
 #define YMM_OFFSET(regname) \
-    (offsetof(RegisterContext_x86_64::YMM, regname))
+    (offsetof(RegisterContextPOSIX_x86_64::YMM, regname))
 
 // Number of bytes needed to represent a i386 GPR
-#define GPR_i386_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)
+#define GPR_i386_SIZE(reg) sizeof(((RegisterContextPOSIX_i386::GPR*)NULL)->reg)
 
 // Number of bytes needed to represent a FPR.
-#define FPR_SIZE(reg) sizeof(((RegisterContext_x86_64::FXSAVE*)NULL)->reg)
+#define FPR_SIZE(reg) sizeof(((RegisterContextPOSIX_x86_64::FXSAVE*)NULL)->reg)
 
 // Number of bytes needed to represent the i'th FP register.
-#define FP_SIZE sizeof(((RegisterContext_x86_64::MMSReg*)NULL)->bytes)
+#define FP_SIZE sizeof(((RegisterContextPOSIX_x86_64::MMSReg*)NULL)->bytes)
 
 // Number of bytes needed to represent an XMM register.
-#define XMM_SIZE sizeof(RegisterContext_x86_64::XMMReg)
+#define XMM_SIZE sizeof(RegisterContextPOSIX_x86_64::XMMReg)
 
 // Number of bytes needed to represent a YMM register.
-#define YMM_SIZE sizeof(RegisterContext_x86_64::YMMReg)
+#define YMM_SIZE sizeof(RegisterContextPOSIX_x86_64::YMMReg)
 
 // Note that the size and offset will be updated by platform-specific classes.
 #define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)           \
@@ -352,7 +344,7 @@
       { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM }, NULL, NULL }
 
-#define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(RegisterContext_x86_64::FPR))
+#define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(RegisterContextPOSIX_x86_64::FPR))
 
 static RegisterInfo
 g_register_infos[k_num_registers] =
@@ -464,109 +456,127 @@
     DEFINE_DR(dr, 7)
 };
 
-static bool IsGPR(unsigned reg)
+bool RegisterContextPOSIX_x86_64::IsGPR(unsigned reg)
 {
     return reg <= k_last_gpr;   // GPR's come first.
 }
 
-static bool IsAVX(unsigned reg)
+bool RegisterContextPOSIX_x86_64::IsAVX(unsigned reg)
 {
     return (k_first_avx <= reg && reg <= k_last_avx);
 }
-static bool IsFPR(unsigned reg)
+
+bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg)
 {
     return (k_first_fpr <= reg && reg <= k_last_fpr);
 }
 
-
-bool RegisterContext_x86_64::IsFPR(unsigned reg, FPRType fpr_type)
+bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg, FPRType fpr_type)
 {
-    bool generic_fpr = ::IsFPR(reg);
+    bool generic_fpr = IsFPR(reg);
     if (fpr_type == eXSAVE)
       return generic_fpr || IsAVX(reg);
 
     return generic_fpr;
 }
 
-RegisterContext_x86_64::RegisterContext_x86_64(Thread &thread,
-                                               uint32_t concrete_frame_idx)
+RegisterContextPOSIX_x86_64::RegisterContextPOSIX_x86_64(Thread &thread,
+                                               uint32_t concrete_frame_idx,
+                                               RegisterInfoInterface *register_info)
     : RegisterContextPOSIX(thread, concrete_frame_idx)
 {
+    m_register_info_ap.reset(register_info);
+
     // Initialize m_iovec to point to the buffer and buffer size
     // using the conventions of Berkeley style UIO structures, as required
     // by PTRACE extensions.
     m_iovec.iov_base = &m_fpr.xstate.xsave;
     m_iovec.iov_len = sizeof(m_fpr.xstate.xsave);
 
-    ::memset(&m_fpr, 0, sizeof(RegisterContext_x86_64::FPR));
+    ::memset(&m_fpr, 0, sizeof(RegisterContextPOSIX_x86_64::FPR));
 
     // elf-core yet to support ReadFPR()
     ProcessSP base = CalculateProcess();
     if (base.get()->GetPluginName() ==  ProcessElfCore::GetPluginNameStatic())
         return;
     
-    // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx
-    m_fpr_type = eXSAVE; // extended floating-point registers, if available
-    if (false == ReadFPR())
-        m_fpr_type = eFXSAVE; // assume generic floating-point registers
+    m_fpr_type = eNotValid;
+}
+
+RegisterContextPOSIX_x86_64::~RegisterContextPOSIX_x86_64()
+{
 }
 
-RegisterContext_x86_64::~RegisterContext_x86_64()
+RegisterContextPOSIX_x86_64::FPRType RegisterContextPOSIX_x86_64::GetFPRType()
 {
+    if (m_fpr_type == eNotValid)
+    {
+        // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx
+        m_fpr_type = eXSAVE; // extended floating-point registers, if available
+        if (false == ReadFPR())
+            m_fpr_type = eFXSAVE; // assume generic floating-point registers
+    }
+    return m_fpr_type;
 }
 
 void
-RegisterContext_x86_64::Invalidate()
+RegisterContextPOSIX_x86_64::Invalidate()
 {
 }
 
 void
-RegisterContext_x86_64::InvalidateAllRegisters()
+RegisterContextPOSIX_x86_64::InvalidateAllRegisters()
 {
 }
 
 unsigned
-RegisterContext_x86_64::GetRegisterOffset(unsigned reg)
+RegisterContextPOSIX_x86_64::GetRegisterOffset(unsigned reg)
 {
     assert(reg < k_num_registers && "Invalid register number.");
     return GetRegisterInfo()[reg].byte_offset;
 }
 
 unsigned
-RegisterContext_x86_64::GetRegisterSize(unsigned reg)
+RegisterContextPOSIX_x86_64::GetRegisterSize(unsigned reg)
 {
     assert(reg < k_num_registers && "Invalid register number.");
     return GetRegisterInfo()[reg].byte_size;
 }
 
 size_t
-RegisterContext_x86_64::GetRegisterCount()
+RegisterContextPOSIX_x86_64::GetRegisterCount()
 {
     size_t num_registers = k_num_gpr_registers + k_num_fpr_registers;
-    if (m_fpr_type == eXSAVE)
+    if (GetFPRType() == eXSAVE)
       return num_registers + k_num_avx_registers;
     return num_registers;
 }
 
+size_t
+RegisterContextPOSIX_x86_64::GetGPRSize()
+{
+    return m_register_info_ap->GetGPRSize();
+}
+
 const RegisterInfo *
-RegisterContext_x86_64::GetRegisterInfo()
+RegisterContextPOSIX_x86_64::GetRegisterInfo()
 {
     // Commonly, this method is overridden and g_register_infos is copied and specialized.
     // So, use GetRegisterInfo() rather than g_register_infos in this scope.
-    return g_register_infos;
+    return m_register_info_ap->GetRegisterInfo(g_register_infos);
 }
 
 const RegisterInfo *
-RegisterContext_x86_64::GetRegisterInfoAtIndex(size_t reg)
+RegisterContextPOSIX_x86_64::GetRegisterInfoAtIndex(size_t reg)
 {
     if (reg < k_num_registers)
         return &GetRegisterInfo()[reg];
     else
         return NULL;
 }
 
 size_t
-RegisterContext_x86_64::GetRegisterSetCount()
+RegisterContextPOSIX_x86_64::GetRegisterSetCount()
 {
     size_t sets = 0;
     for (size_t set = 0; set < k_num_register_sets; ++set)
@@ -577,16 +587,16 @@
 }
 
 const RegisterSet *
-RegisterContext_x86_64::GetRegisterSet(size_t set)
+RegisterContextPOSIX_x86_64::GetRegisterSet(size_t set)
 {
     if (IsRegisterSetAvailable(set))
         return &g_reg_sets[set];
     else
         return NULL;
 }
 
 unsigned
-RegisterContext_x86_64::GetRegisterIndexFromOffset(unsigned offset)
+RegisterContextPOSIX_x86_64::GetRegisterIndexFromOffset(unsigned offset)
 {
     unsigned reg;
     for (reg = 0; reg < k_num_registers; reg++)
@@ -599,14 +609,14 @@
 }
 
 const char *
-RegisterContext_x86_64::GetRegisterName(unsigned reg)
+RegisterContextPOSIX_x86_64::GetRegisterName(unsigned reg)
 {
     assert(reg < k_num_registers && "Invalid register offset.");
     return GetRegisterInfo()[reg].name;
 }
 
 lldb::ByteOrder
-RegisterContext_x86_64::GetByteOrder()
+RegisterContextPOSIX_x86_64::GetByteOrder()
 {
     // Get the target process whose privileged thread was used for the register read.
     lldb::ByteOrder byte_order = eByteOrderInvalid;
@@ -618,80 +628,80 @@
 }
 
 // Parse ymm registers and into xmm.bytes and ymmh.bytes.
-bool RegisterContext_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
+bool RegisterContextPOSIX_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
 {
     if (!IsAVX(reg))
         return false;
 
     if (byte_order == eByteOrderLittle) {
       ::memcpy(m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
                m_ymm_set.ymm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::XMMReg));
+               sizeof(RegisterContextPOSIX_x86_64::XMMReg));
       ::memcpy(m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
-               m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
-               sizeof(RegisterContext_x86_64::YMMHReg));
+               m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),
+               sizeof(RegisterContextPOSIX_x86_64::YMMHReg));
       return true;
     }
 
     if (byte_order == eByteOrderBig) {
       ::memcpy(m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
-               m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
-               sizeof(RegisterContext_x86_64::XMMReg));
+               m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),
+               sizeof(RegisterContextPOSIX_x86_64::XMMReg));
       ::memcpy(m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
                m_ymm_set.ymm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::YMMHReg));
+               sizeof(RegisterContextPOSIX_x86_64::YMMHReg));
       return true;
     }
     return false; // unsupported or invalid byte order
 }
 
 // Concatenate xmm.bytes with ymmh.bytes
-bool RegisterContext_x86_64::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
+bool RegisterContextPOSIX_x86_64::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
 {
     if (!IsAVX(reg))
         return false;
 
     if (byte_order == eByteOrderLittle) {
       ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes,
                m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::XMMReg));
-      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
+               sizeof(RegisterContextPOSIX_x86_64::XMMReg));
+      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),
                m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::YMMHReg));
+               sizeof(RegisterContextPOSIX_x86_64::YMMHReg));
       return true;
     }
     if (byte_order == eByteOrderBig) {
-      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
+      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),
                m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::XMMReg));
+               sizeof(RegisterContextPOSIX_x86_64::XMMReg));
       ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes,
                m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::YMMHReg));
+               sizeof(RegisterContextPOSIX_x86_64::YMMHReg));
       return true;
     }
     return false; // unsupported or invalid byte order
 }
 
 bool
-RegisterContext_x86_64::IsRegisterSetAvailable(size_t set_index)
+RegisterContextPOSIX_x86_64::IsRegisterSetAvailable(size_t set_index)
 {
     // Note: Extended register sets are assumed to be at the end of g_reg_sets...
     size_t num_sets = k_num_register_sets - k_num_extended_register_sets;
-    if (m_fpr_type == eXSAVE) // ...and to start with AVX registers.
+    if (GetFPRType() == eXSAVE) // ...and to start with AVX registers.
         ++num_sets;
 
     return (set_index < num_sets);
 }   
 
 bool
-RegisterContext_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
+RegisterContextPOSIX_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
 {
     if (!reg_info)
         return false;
 
     const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
 
-    if (IsFPR(reg, m_fpr_type)) {
+    if (IsFPR(reg, GetFPRType())) {
         if (!ReadFPR())
             return false;
     }
@@ -717,7 +727,7 @@
             }
             if (reg >= fpu_ymm0 && reg <= fpu_ymm15) {
                 // Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes
-                if (m_fpr_type == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))
+                if (GetFPRType() == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))
                     value.SetBytes(m_ymm_set.ymm[reg - fpu_ymm0].bytes, reg_info->byte_size, byte_order);
                 else
                     return false;
@@ -761,7 +771,7 @@
 }
 
 bool
-RegisterContext_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp)
+RegisterContextPOSIX_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp)
 {
     bool success = false;
     data_sp.reset (new DataBufferHeap (REG_CONTEXT_SIZE, 0));
@@ -774,10 +784,10 @@
             ::memcpy (dst, &m_gpr, GetGPRSize());
             dst += GetGPRSize();
         }
-        if (m_fpr_type == eFXSAVE)
+        if (GetFPRType() == eFXSAVE)
             ::memcpy (dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
         
-        if (m_fpr_type == eXSAVE) {
+        if (GetFPRType() == eXSAVE) {
             ByteOrder byte_order = GetByteOrder();
 
             // Assemble the YMM register content from the register halves.
@@ -794,15 +804,15 @@
 }
 
 bool
-RegisterContext_x86_64::WriteRegister(const lldb_private::RegisterInfo *reg_info,
+RegisterContextPOSIX_x86_64::WriteRegister(const lldb_private::RegisterInfo *reg_info,
                                       const lldb_private::RegisterValue &value)
 {
     const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
     if (IsGPR(reg)) {
         return WriteRegister(reg, value);
     }
 
-    if (IsFPR(reg, m_fpr_type)) {
+    if (IsFPR(reg, GetFPRType())) {
         switch (reg)
         {
         default:
@@ -816,7 +826,7 @@
                ::memcpy (m_fpr.xstate.fxsave.xmm[reg - fpu_xmm0].bytes, value.GetBytes(), value.GetByteSize());
             
             if (reg >= fpu_ymm0 && reg <= fpu_ymm15) {
-               if (m_fpr_type != eXSAVE)
+               if (GetFPRType() != eXSAVE)
                    return false; // the target processor does not support AVX
 
                // Store ymm register content, and split into the register halves in xmm.bytes and ymmh.bytes
@@ -860,7 +870,7 @@
 }
 
 bool
-RegisterContext_x86_64::WriteAllRegisterValues(const DataBufferSP &data_sp)
+RegisterContextPOSIX_x86_64::WriteAllRegisterValues(const DataBufferSP &data_sp)
 {
     bool success = false;
     if (data_sp && data_sp->GetByteSize() == REG_CONTEXT_SIZE)
@@ -871,16 +881,16 @@
 
             if (WriteGPR()) {
                 src += GetGPRSize();
-                if (m_fpr_type == eFXSAVE)
+                if (GetFPRType() == eFXSAVE)
                     ::memcpy (&m_fpr.xstate.fxsave, src, sizeof(m_fpr.xstate.fxsave));
-                if (m_fpr_type == eXSAVE)
+                if (GetFPRType() == eXSAVE)
                     ::memcpy (&m_fpr.xstate.xsave, src, sizeof(m_fpr.xstate.xsave));
 
                 success = WriteFPR();
                 if (success) {
                     success = true;
 
-                    if (m_fpr_type == eXSAVE) {
+                    if (GetFPRType() == eXSAVE) {
                         ByteOrder byte_order = GetByteOrder();
 
                         // Parse the YMM register content from the register halves.
@@ -895,7 +905,7 @@
 }
 
 bool
-RegisterContext_x86_64::UpdateAfterBreakpoint()
+RegisterContextPOSIX_x86_64::UpdateAfterBreakpoint()
 {
     // PC points one byte past the int3 responsible for the breakpoint.
     lldb::addr_t pc;
@@ -908,7 +918,7 @@
 }
 
 uint32_t
-RegisterContext_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind,
+RegisterContextPOSIX_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind,
                                                                  uint32_t num)
 {
     const Process *process = CalculateProcess().get();
@@ -1205,14 +1215,14 @@
 }
 
 uint32_t
-RegisterContext_x86_64::NumSupportedHardwareWatchpoints()
+RegisterContextPOSIX_x86_64::NumSupportedHardwareWatchpoints()
 {
     // Available debug address registers: dr0, dr1, dr2, dr3
     return 4;
 }
 
 bool
-RegisterContext_x86_64::IsWatchpointVacant(uint32_t hw_index)
+RegisterContextPOSIX_x86_64::IsWatchpointVacant(uint32_t hw_index)
 {
     bool is_vacant = false;
     RegisterValue value;
@@ -1264,7 +1274,7 @@
 }
 
 uint32_t
-RegisterContext_x86_64::SetHardwareWatchpoint(addr_t addr, size_t size,
+RegisterContextPOSIX_x86_64::SetHardwareWatchpoint(addr_t addr, size_t size,
                                               bool read, bool write)
 {
     const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
@@ -1282,7 +1292,7 @@
 }
 
 bool
-RegisterContext_x86_64::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,
+RegisterContextPOSIX_x86_64::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,
                                                        bool read, bool write,
                                                        uint32_t hw_index)
 {
@@ -1344,7 +1354,7 @@
 }
 
 bool
-RegisterContext_x86_64::ClearHardwareWatchpoint(uint32_t hw_index)
+RegisterContextPOSIX_x86_64::ClearHardwareWatchpoint(uint32_t hw_index)
 {
     if (hw_index < NumSupportedHardwareWatchpoints())
     {
@@ -1363,7 +1373,7 @@
 }
 
 bool
-RegisterContext_x86_64::IsWatchpointHit(uint32_t hw_index)
+RegisterContextPOSIX_x86_64::IsWatchpointHit(uint32_t hw_index)
 {
     bool is_hit = false;
 
@@ -1391,7 +1401,7 @@
 }
 
 addr_t
-RegisterContext_x86_64::GetWatchpointAddress(uint32_t hw_index)
+RegisterContextPOSIX_x86_64::GetWatchpointAddress(uint32_t hw_index)
 {
     addr_t wp_monitor_addr = LLDB_INVALID_ADDRESS;
 
@@ -1411,13 +1421,13 @@
 
 
 bool
-RegisterContext_x86_64::ClearWatchpointHits()
+RegisterContextPOSIX_x86_64::ClearWatchpointHits()
 {
     return WriteRegister(dr6, RegisterValue((uint64_t)0));
 }
 
 bool
-RegisterContext_x86_64::HardwareSingleStep(bool enable)
+RegisterContextPOSIX_x86_64::HardwareSingleStep(bool enable)
 {
     enum { TRACE_BIT = 0x100 };
     uint64_t rflags;
@@ -1442,122 +1452,3 @@
 
     return WriteRegisterFromUnsigned(gpr_rflags, rflags);
 }
-
-#if defined(__linux__) or defined(__FreeBSD__)
-
-ProcessMonitor &
-RegisterContext_x86_64::GetMonitor()
-{
-    ProcessSP base = CalculateProcess();
-    ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());
-    return process->GetMonitor();
-}
-
-bool
-RegisterContext_x86_64::ReadGPR()
-{
-     ProcessMonitor &monitor = GetMonitor();
-     return monitor.ReadGPR(m_thread.GetID(), &m_gpr, GetGPRSize());
-}
-
-bool
-RegisterContext_x86_64::ReadFPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    if (m_fpr_type == eFXSAVE)
-        return monitor.ReadFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-
-    if (m_fpr_type == eXSAVE)
-        return monitor.ReadRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteGPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.WriteGPR(m_thread.GetID(), &m_gpr, GetGPRSize());
-}
-
-bool
-RegisterContext_x86_64::WriteFPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    if (m_fpr_type == eFXSAVE)
-        return monitor.WriteFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-
-    if (m_fpr_type == eXSAVE)
-        return monitor.WriteRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
-    return false;
-}
-
-bool
-RegisterContext_x86_64::ReadRegister(const unsigned reg,
-                                     RegisterValue &value)
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.ReadRegisterValue(m_thread.GetID(),
-                                     GetRegisterOffset(reg),
-                                     GetRegisterName(reg),
-                                     GetRegisterSize(reg),
-                                     value);
-}
-
-bool
-RegisterContext_x86_64::WriteRegister(const unsigned reg,
-                                      const RegisterValue &value)
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.WriteRegisterValue(m_thread.GetID(),
-                                      GetRegisterOffset(reg),
-                                      GetRegisterName(reg),
-                                      value);
-}
-
-#else
-
-bool
-RegisterContext_x86_64::ReadGPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::ReadFPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteGPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteFPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::ReadRegister(const unsigned reg,
-                                     RegisterValue &value)
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteRegister(const unsigned reg,
-                                      const RegisterValue &value)
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-#endif
Index: source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h
===================================================================
--- source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h
+++ source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h
@@ -1,14 +1,14 @@
-//===-- RegisterContext_x86_64.h ---------------------------*- C++ -*-===//
+//===-- RegisterContextPOSIX_x86_64.h ---------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef liblldb_RegisterContext_x86_64_H_
-#define liblldb_RegisterContext_x86_64_H_
+#ifndef liblldb_RegisterContextPOSIX_x86_64_H_
+#define liblldb_RegisterContextPOSIX_x86_64_H_
 
 #include "lldb/Core/Log.h"
 #include "RegisterContextPOSIX.h"
@@ -127,14 +127,15 @@
     k_num_avx_registers = k_last_avx - k_first_avx + 1
 };
 
-class RegisterContext_x86_64
+class RegisterContextPOSIX_x86_64
   : public RegisterContextPOSIX
 {
 public:
-    RegisterContext_x86_64 (lldb_private::Thread &thread,
-                            uint32_t concrete_frame_idx);
+    RegisterContextPOSIX_x86_64 (lldb_private::Thread &thread,
+                            uint32_t concrete_frame_idx,
+                            RegisterInfoInterface *register_info);
 
-    ~RegisterContext_x86_64();
+    ~RegisterContextPOSIX_x86_64();
 
     void
     Invalidate();
@@ -146,7 +147,7 @@
     GetRegisterCount();
 
     virtual size_t
-    GetGPRSize() = 0;
+    GetGPRSize();
 
     virtual unsigned
     GetRegisterSize(unsigned reg);
@@ -318,30 +319,38 @@
     GetRegisterInfo();
 
     virtual bool
-    ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
+    ReadRegister(const unsigned reg, lldb_private::RegisterValue &value) = 0;
 
     virtual bool
-    WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value);
+    WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value) = 0;
 
-private:
-    uint64_t m_gpr[k_num_gpr_registers]; // general purpose registers.
-    FPRType  m_fpr_type;                 // determines the type of data stored by union FPR, if any.
-    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.
+    static bool
+    IsGPR(unsigned reg);
+
+    static bool
+    IsFPR(unsigned reg);
+
+    static bool
+    IsAVX(unsigned reg);
+
+    uint64_t m_gpr[k_num_gpr_registers];                       // general purpose registers.
+    FPRType  m_fpr_type;                                       // determines the type of data stored by union FPR, if any.
+    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)
 
-    ProcessMonitor &GetMonitor();
     lldb::ByteOrder GetByteOrder();
 
     bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order);
     bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);
     bool IsFPR(unsigned reg, FPRType fpr_type);
+    FPRType GetFPRType();
 
-    bool ReadGPR();
-    bool ReadFPR();
-
-    bool WriteGPR();
-    bool WriteFPR();
+    virtual bool ReadGPR() = 0;
+    virtual bool ReadFPR() = 0;
+    virtual bool WriteGPR() = 0;
+    virtual bool WriteFPR() = 0;
 };
 
-#endif // #ifndef liblldb_RegisterContext_x86_64_H_
+#endif // #ifndef liblldb_RegisterContextPOSIX_x86_64_H_
Index: source/Plugins/Process/POSIX/RegisterContext_i386.cpp
===================================================================
--- source/Plugins/Process/POSIX/RegisterContext_i386.cpp
+++ source/Plugins/Process/POSIX/RegisterContext_i386.cpp
@@ -1,551 +0,0 @@
-//===-- RegisterContextPOSIX_i386.cpp ---------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Target/Thread.h"
-#include "lldb/Host/Endian.h"
-#include "llvm/Support/Compiler.h"
-
-#include "ProcessPOSIX.h"
-#include "ProcessPOSIXLog.h"
-#include "ProcessMonitor.h"
-#include "RegisterContext_i386.h"
-#include "RegisterContext_x86.h"
-
-using namespace lldb_private;
-using namespace lldb;
-
-enum
-{
-    k_first_gpr,
-    gpr_eax = k_first_gpr,
-    gpr_ebx,
-    gpr_ecx,
-    gpr_edx,
-    gpr_edi,
-    gpr_esi,
-    gpr_ebp,
-    gpr_esp,
-    gpr_ss,
-    gpr_eflags,
-#ifdef __FreeBSD__
-    gpr_orig_ax,
-#endif
-    gpr_eip,
-    gpr_cs,
-    gpr_ds,
-    gpr_es,
-    gpr_fs,
-    gpr_gs,
-    k_last_gpr = gpr_gs,
-
-    k_first_fpr,
-    fpu_fcw = k_first_fpr,
-    fpu_fsw,
-    fpu_ftw,
-    fpu_fop,
-    fpu_ip,
-    fpu_cs,
-    fpu_foo,
-    fpu_fos,
-    fpu_mxcsr,
-    fpu_stmm0,
-    fpu_stmm1,
-    fpu_stmm2,
-    fpu_stmm3,
-    fpu_stmm4,
-    fpu_stmm5,
-    fpu_stmm6,
-    fpu_stmm7,
-    fpu_xmm0,
-    fpu_xmm1,
-    fpu_xmm2,
-    fpu_xmm3,
-    fpu_xmm4,
-    fpu_xmm5,
-    fpu_xmm6,
-    fpu_xmm7,
-    k_last_fpr = fpu_xmm7,
-
-    k_num_registers,
-    k_num_gpr_registers = k_last_gpr - k_first_gpr + 1,
-    k_num_fpu_registers = k_last_fpr - k_first_fpr + 1
-};
-
-// Number of register sets provided by this context.
-enum
-{
-    k_num_register_sets = 2
-};
-
-static const
-uint32_t g_gpr_regnums[k_num_gpr_registers] =
-{
-    gpr_eax,
-    gpr_ebx,
-    gpr_ecx,
-    gpr_edx,
-    gpr_edi,
-    gpr_esi,
-    gpr_ebp,
-    gpr_esp,
-    gpr_ss,
-    gpr_eflags,
-#ifdef __FreeBSD__
-    gpr_orig_ax,
-#endif
-    gpr_eip,
-    gpr_cs,
-    gpr_ds,
-    gpr_es,
-    gpr_fs,
-    gpr_gs,
-};
-
-static const uint32_t
-g_fpu_regnums[k_num_fpu_registers] =
-{
-    fpu_fcw,
-    fpu_fsw,
-    fpu_ftw,
-    fpu_fop,
-    fpu_ip,
-    fpu_cs,
-    fpu_foo,
-    fpu_fos,
-    fpu_mxcsr,
-    fpu_stmm0,
-    fpu_stmm1,
-    fpu_stmm2,
-    fpu_stmm3,
-    fpu_stmm4,
-    fpu_stmm5,
-    fpu_stmm6,
-    fpu_stmm7,
-    fpu_xmm0,
-    fpu_xmm1,
-    fpu_xmm2,
-    fpu_xmm3,
-    fpu_xmm4,
-    fpu_xmm5,
-    fpu_xmm6,
-    fpu_xmm7,
-};
-
-static const RegisterSet
-g_reg_sets[k_num_register_sets] =
-{
-    { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums },
-    { "Floating Point Registers",  "fpu", k_num_fpu_registers, g_fpu_regnums }
-};
-
-// Computes the offset of the given GPR in the user data area.
-#define GPR_OFFSET(regname) \
-    (offsetof(RegisterContext_i386::UserArea, regs) + \
-     offsetof(RegisterContext_i386::GPR, regname))
-
-// Computes the offset of the given FPR in the user data area.
-#define FPR_OFFSET(regname) \
-    (offsetof(RegisterContext_i386::UserArea, i387) + \
-     offsetof(RegisterContext_i386::FPU, regname))
-
-// Number of bytes needed to represent a GPR.
-#define GPR_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)
-
-// Number of bytes needed to represent a FPR.
-#define FPR_SIZE(reg) sizeof(((RegisterContext_i386::FPU*)NULL)->reg)
-
-// Number of bytes needed to represent the i'th FP register.
-#define FP_SIZE sizeof(((RegisterContext_i386::MMSReg*)NULL)->bytes)
-
-// Number of bytes needed to represent an XMM register.
-#define XMM_SIZE sizeof(RegisterContext_i386::XMMReg)
-
-#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)        \
-    { #reg, alt, GPR_SIZE(reg), GPR_OFFSET(reg), eEncodingUint, \
-      eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg }, NULL, NULL }
-
-#define DEFINE_FPR(reg, kind1, kind2, kind3, kind4)              \
-    { #reg, NULL, FPR_SIZE(reg), FPR_OFFSET(reg), eEncodingUint, \
-      eFormatHex, { kind1, kind2, kind3, kind4, fpu_##reg }, NULL, NULL }
-
-#define DEFINE_FP(reg, i)                                          \
-    { #reg#i, NULL, FP_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]),    \
-      eEncodingVector, eFormatVectorOfUInt8,                       \
-      { dwarf_##reg##i, dwarf_##reg##i,                            \
-        LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i }, NULL, NULL }
-
-#define DEFINE_XMM(reg, i)                                         \
-    { #reg#i, NULL, XMM_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]),   \
-       eEncodingVector, eFormatVectorOfUInt8,                      \
-      { dwarf_##reg##i, dwarf_##reg##i,                            \
-        LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i }, NULL, NULL }
-
-static RegisterInfo
-g_register_infos[k_num_registers] =
-{
-    // General purpose registers.
-    DEFINE_GPR(eax,    NULL,    gcc_eax,    dwarf_eax,    LLDB_INVALID_REGNUM,    gdb_eax),
-    DEFINE_GPR(ebx,    NULL,    gcc_ebx,    dwarf_ebx,    LLDB_INVALID_REGNUM,    gdb_ebx),
-    DEFINE_GPR(ecx,    NULL,    gcc_ecx,    dwarf_ecx,    LLDB_INVALID_REGNUM,    gdb_ecx),
-    DEFINE_GPR(edx,    NULL,    gcc_edx,    dwarf_edx,    LLDB_INVALID_REGNUM,    gdb_edx),
-    DEFINE_GPR(edi,    NULL,    gcc_edi,    dwarf_edi,    LLDB_INVALID_REGNUM,    gdb_edi),
-    DEFINE_GPR(esi,    NULL,    gcc_esi,    dwarf_esi,    LLDB_INVALID_REGNUM,    gdb_esi),
-    DEFINE_GPR(ebp,    "fp",    gcc_ebp,    dwarf_ebp,    LLDB_INVALID_REGNUM,    gdb_ebp),
-    DEFINE_GPR(esp,    "sp",    gcc_esp,    dwarf_esp,    LLDB_INVALID_REGNUM,    gdb_esp),
-    DEFINE_GPR(ss,     NULL,    LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,    gdb_ss),
-    DEFINE_GPR(eflags, "flags", gcc_eflags, dwarf_eflags, LLDB_INVALID_REGNUM,    gdb_eflags),
-    DEFINE_GPR(eip,    "pc",    gcc_eip,    dwarf_eip,    LLDB_INVALID_REGNUM,    gdb_eip),
-    DEFINE_GPR(cs,     NULL,    LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,    gdb_cs),
-    DEFINE_GPR(ds,     NULL,    LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,    gdb_ds),
-    DEFINE_GPR(es,     NULL,    LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,    gdb_es),
-    DEFINE_GPR(fs,     NULL,    LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,    gdb_fs),
-    DEFINE_GPR(gs,     NULL,    LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,     LLDB_INVALID_REGNUM,    gdb_gs),
-
-    // Floating point registers.
-    DEFINE_FPR(fcw,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fcw),
-    DEFINE_FPR(fsw,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fsw),
-    DEFINE_FPR(ftw,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ftw),
-    DEFINE_FPR(fop,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fop),
-    DEFINE_FPR(ip,        LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ip),
-    DEFINE_FPR(cs,        LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_cs),
-    DEFINE_FPR(foo,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_dp),
-    DEFINE_FPR(fos,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_ds),
-    DEFINE_FPR(mxcsr,     LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_mxcsr),
-
-    DEFINE_FP(stmm, 0),
-    DEFINE_FP(stmm, 1),
-    DEFINE_FP(stmm, 2),
-    DEFINE_FP(stmm, 3),
-    DEFINE_FP(stmm, 4),
-    DEFINE_FP(stmm, 5),
-    DEFINE_FP(stmm, 6),
-    DEFINE_FP(stmm, 7),
-
-    // XMM registers
-    DEFINE_XMM(xmm, 0),
-    DEFINE_XMM(xmm, 1),
-    DEFINE_XMM(xmm, 2),
-    DEFINE_XMM(xmm, 3),
-    DEFINE_XMM(xmm, 4),
-    DEFINE_XMM(xmm, 5),
-    DEFINE_XMM(xmm, 6),
-    DEFINE_XMM(xmm, 7),
-
-};
-
-#ifndef NDEBUG
-static size_t k_num_register_infos = (sizeof(g_register_infos)/sizeof(RegisterInfo));
-#endif
-
-static unsigned GetRegOffset(unsigned reg)
-{
-    assert(reg < k_num_registers && "Invalid register number.");
-    return g_register_infos[reg].byte_offset;
-}
-
-static unsigned GetRegSize(unsigned reg)
-{
-    assert(reg < k_num_registers && "Invalid register number.");
-    return g_register_infos[reg].byte_size;
-}
-
-RegisterContext_i386::RegisterContext_i386(Thread &thread,
-                                                     uint32_t concrete_frame_idx)
-    : RegisterContextPOSIX(thread, concrete_frame_idx)
-{
-}
-
-RegisterContext_i386::~RegisterContext_i386()
-{
-}
-
-ProcessMonitor &
-RegisterContext_i386::GetMonitor()
-{
-    ProcessSP base = CalculateProcess();
-    ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());
-    return process->GetMonitor();
-}
-
-void
-RegisterContext_i386::Invalidate()
-{
-}
-
-void
-RegisterContext_i386::InvalidateAllRegisters()
-{
-}
-
-size_t
-RegisterContext_i386::GetRegisterCount()
-{
-    assert(k_num_register_infos == k_num_registers);
-    return k_num_registers;
-}
-
-const RegisterInfo *
-RegisterContext_i386::GetRegisterInfoAtIndex(size_t reg)
-{
-    assert(k_num_register_infos == k_num_registers);
-    if (reg < k_num_registers)
-        return &g_register_infos[reg];
-    else
-        return NULL;
-}
-
-size_t
-RegisterContext_i386::GetRegisterSetCount()
-{
-    return k_num_register_sets;
-}
-
-const RegisterSet *
-RegisterContext_i386::GetRegisterSet(size_t set)
-{
-    if (set < k_num_register_sets)
-        return &g_reg_sets[set];
-    else
-        return NULL;
-}
-
-unsigned
-RegisterContext_i386::GetRegisterIndexFromOffset(unsigned offset)
-{
-    unsigned reg;
-    for (reg = 0; reg < k_num_registers; reg++)
-    {
-        if (g_register_infos[reg].byte_offset == offset)
-            break;
-    }
-    assert(reg < k_num_registers && "Invalid register offset.");
-    return reg;
-}
-
-const char *
-RegisterContext_i386::GetRegisterName(unsigned reg)
-{
-    assert(reg < k_num_registers && "Invalid register offset.");
-    return g_register_infos[reg].name;
-}
-
-bool
-RegisterContext_i386::ReadRegister(const RegisterInfo *reg_info,
-                                        RegisterValue &value)
-{
-    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.ReadRegisterValue(m_thread.GetID(), GetRegOffset(reg),
-                                     GetRegisterName(reg), GetRegSize(reg), value);
-}
-
-bool
-RegisterContext_i386::ReadAllRegisterValues(DataBufferSP &data_sp)
-{
-    return false;
-}
-
-bool RegisterContext_i386::WriteRegister(const RegisterInfo *reg_info,
-                                         const RegisterValue &value)
-{
-    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg),
-                                      GetRegisterName(reg), value);
-}
-
-bool
-RegisterContext_i386::WriteAllRegisterValues(const DataBufferSP &data)
-{
-    return false;
-}
-
-bool
-RegisterContext_i386::UpdateAfterBreakpoint()
-{
-    // PC points one byte past the int3 responsible for the breakpoint.
-    lldb::addr_t pc;
-
-    if ((pc = GetPC()) == LLDB_INVALID_ADDRESS)
-        return false;
-
-    SetPC(pc - 1);
-    return true;
-}
-
-uint32_t
-RegisterContext_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,
-                                                               uint32_t num)
-{
-    if (kind == eRegisterKindGeneric)
-    {
-        switch (num)
-        {
-        case LLDB_REGNUM_GENERIC_PC:    return gpr_eip;
-        case LLDB_REGNUM_GENERIC_SP:    return gpr_esp;
-        case LLDB_REGNUM_GENERIC_FP:    return gpr_ebp;
-        case LLDB_REGNUM_GENERIC_FLAGS: return gpr_eflags;
-        case LLDB_REGNUM_GENERIC_RA:
-        default:
-            return LLDB_INVALID_REGNUM;
-        }
-    }
-
-    if (kind == eRegisterKindGCC || kind == eRegisterKindDWARF)
-    {
-        switch (num)
-        {
-        case dwarf_eax:  return gpr_eax;
-        case dwarf_edx:  return gpr_edx;
-        case dwarf_ecx:  return gpr_ecx;
-        case dwarf_ebx:  return gpr_ebx;
-        case dwarf_esi:  return gpr_esi;
-        case dwarf_edi:  return gpr_edi;
-        case dwarf_ebp:  return gpr_ebp;
-        case dwarf_esp:  return gpr_esp;
-        case dwarf_eip:  return gpr_eip;
-        case dwarf_xmm0: return fpu_xmm0;
-        case dwarf_xmm1: return fpu_xmm1;
-        case dwarf_xmm2: return fpu_xmm2;
-        case dwarf_xmm3: return fpu_xmm3;
-        case dwarf_xmm4: return fpu_xmm4;
-        case dwarf_xmm5: return fpu_xmm5;
-        case dwarf_xmm6: return fpu_xmm6;
-        case dwarf_xmm7: return fpu_xmm7;
-        case dwarf_stmm0: return fpu_stmm0;
-        case dwarf_stmm1: return fpu_stmm1;
-        case dwarf_stmm2: return fpu_stmm2;
-        case dwarf_stmm3: return fpu_stmm3;
-        case dwarf_stmm4: return fpu_stmm4;
-        case dwarf_stmm5: return fpu_stmm5;
-        case dwarf_stmm6: return fpu_stmm6;
-        case dwarf_stmm7: return fpu_stmm7;
-        default:
-            return LLDB_INVALID_REGNUM;
-        }
-    }
-
-    if (kind == eRegisterKindGDB)
-    {
-        switch (num)
-        {
-        case gdb_eax     : return gpr_eax;
-        case gdb_ebx     : return gpr_ebx;
-        case gdb_ecx     : return gpr_ecx;
-        case gdb_edx     : return gpr_edx;
-        case gdb_esi     : return gpr_esi;
-        case gdb_edi     : return gpr_edi;
-        case gdb_ebp     : return gpr_ebp;
-        case gdb_esp     : return gpr_esp;
-        case gdb_eip     : return gpr_eip;
-        case gdb_eflags  : return gpr_eflags;
-        case gdb_cs      : return gpr_cs;
-        case gdb_ss      : return gpr_ss;
-        case gdb_ds      : return gpr_ds;
-        case gdb_es      : return gpr_es;
-        case gdb_fs      : return gpr_fs;
-        case gdb_gs      : return gpr_gs;
-        case gdb_stmm0   : return fpu_stmm0;
-        case gdb_stmm1   : return fpu_stmm1;
-        case gdb_stmm2   : return fpu_stmm2;
-        case gdb_stmm3   : return fpu_stmm3;
-        case gdb_stmm4   : return fpu_stmm4;
-        case gdb_stmm5   : return fpu_stmm5;
-        case gdb_stmm6   : return fpu_stmm6;
-        case gdb_stmm7   : return fpu_stmm7;
-        case gdb_fcw     : return fpu_fcw;
-        case gdb_fsw     : return fpu_fsw;
-        case gdb_ftw     : return fpu_ftw;
-        case gdb_fpu_cs  : return fpu_cs;
-        case gdb_ip      : return fpu_ip;
-        case gdb_fpu_ds  : return fpu_fos;
-        case gdb_dp      : return fpu_foo;
-        case gdb_fop     : return fpu_fop;
-        case gdb_xmm0    : return fpu_xmm0;
-        case gdb_xmm1    : return fpu_xmm1;
-        case gdb_xmm2    : return fpu_xmm2;
-        case gdb_xmm3    : return fpu_xmm3;
-        case gdb_xmm4    : return fpu_xmm4;
-        case gdb_xmm5    : return fpu_xmm5;
-        case gdb_xmm6    : return fpu_xmm6;
-        case gdb_xmm7    : return fpu_xmm7;
-        case gdb_mxcsr   : return fpu_mxcsr;
-        default:
-            return LLDB_INVALID_REGNUM;
-        }
-    }
-    else if (kind == eRegisterKindLLDB)
-    {
-        return num;
-    }
-
-    return LLDB_INVALID_REGNUM;
-}
-
-bool
-RegisterContext_i386::HardwareSingleStep(bool enable)
-{
-    enum { TRACE_BIT = 0x100 };
-    uint64_t eflags;
-
-    if ((eflags = ReadRegisterAsUnsigned(gpr_eflags, -1UL)) == -1UL)
-        return false;
-
-    if (enable)
-    {
-        if (eflags & TRACE_BIT)
-            return true;
-
-        eflags |= TRACE_BIT;
-    }
-    else
-    {
-        if (!(eflags & TRACE_BIT))
-            return false;
-
-        eflags &= ~TRACE_BIT;
-    }
-
-    return WriteRegisterFromUnsigned(gpr_eflags, eflags);
-}
-
-void
-RegisterContext_i386::LogGPR(const char *title)
-{
-    Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));
-    if (log)
-    {
-        if (title)
-            log->Printf ("%s", title);
-        for (uint32_t i=0; i<k_num_gpr_registers; i++)
-        {
-            uint32_t reg = gpr_eax + i;
-            log->Printf("%12s = 0x%8.8" PRIx64, g_register_infos[reg].name, ((uint64_t*)&user.regs)[reg]);
-        }
-    }
-}
-
-bool
-RegisterContext_i386::ReadGPR()
-{
-    bool result;
-
-    ProcessMonitor &monitor = GetMonitor();
-    result = monitor.ReadGPR(m_thread.GetID(), &user.regs, sizeof(user.regs));
-    LogGPR("RegisterContext_i386::ReadGPR()");
-    return result;
-}
-
-bool
-RegisterContext_i386::ReadFPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.ReadFPR(m_thread.GetID(), &user.i387, sizeof(user.i387));
-}
Index: source/Plugins/Process/POSIX/RegisterContext_i386.h
===================================================================
--- source/Plugins/Process/POSIX/RegisterContext_i386.h
+++ source/Plugins/Process/POSIX/RegisterContext_i386.h
@@ -1,169 +0,0 @@
-//===-- RegisterContext_i386.h ------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_RegisterContext_i386_h_
-#define liblldb_RegisterContext_i386_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Log.h"
-#include "RegisterContextPOSIX.h"
-
-class RegisterContext_i386 : public RegisterContextPOSIX
-{
-public:
-    RegisterContext_i386(lldb_private::Thread &thread,
-                              uint32_t concreate_frame_idx);
-
-    ~RegisterContext_i386();
-
-    void
-    Invalidate();
-
-    void
-    InvalidateAllRegisters();
-
-    size_t
-    GetRegisterCount();
-
-    const lldb_private::RegisterInfo *
-    GetRegisterInfoAtIndex(size_t reg);
-
-    size_t
-    GetRegisterSetCount();
-
-    const lldb_private::RegisterSet *
-    GetRegisterSet(size_t set);
-
-    unsigned
-    GetRegisterIndexFromOffset(unsigned offset);
-
-    const char *
-    GetRegisterName(unsigned reg);
-
-    bool
-    ReadRegisterValue(uint32_t reg, lldb_private::Scalar &value);
-
-    bool
-    ReadRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data);
-
-    virtual bool
-    ReadRegister(const lldb_private::RegisterInfo *reg_info,
-                 lldb_private::RegisterValue &value);
-
-    bool
-    ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
-
-    bool
-    WriteRegisterValue(uint32_t reg, const lldb_private::Scalar &value);
-
-    bool
-    WriteRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data,
-                       uint32_t data_offset = 0);
-
-    virtual bool
-    WriteRegister(const lldb_private::RegisterInfo *reg_info,
-                  const lldb_private::RegisterValue &value);
-
-    bool
-    WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
-
-    uint32_t
-    ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num);
-
-    bool
-    HardwareSingleStep(bool enable);
-
-    bool
-    UpdateAfterBreakpoint();
-
-    struct GPR
-    {
-        uint32_t ebx;
-        uint32_t ecx;
-        uint32_t edx;
-        uint32_t esi;
-        uint32_t edi;
-        uint32_t ebp;
-        uint32_t eax;
-        uint32_t ds;
-        uint32_t es;
-        uint32_t fs;
-        uint32_t gs;
-        uint32_t orig_ax;
-        uint32_t eip;
-        uint32_t cs;
-        uint32_t eflags;
-        uint32_t esp;
-        uint32_t ss;
-    };
-
-    struct MMSReg
-    {
-        uint8_t bytes[8];
-    };
-
-    struct XMMReg
-    {
-        uint8_t bytes[16];
-    };
-
-    struct FPU
-    {
-        uint16_t    fcw;
-        uint16_t    fsw;
-        uint16_t    ftw;
-        uint16_t    fop;
-        uint32_t    ip;
-        uint32_t    cs;
-        uint32_t    foo;
-        uint32_t    fos;
-        uint32_t    mxcsr;
-        uint32_t    reserved;
-        MMSReg      stmm[8];
-        XMMReg      xmm[8];
-        uint32_t    pad[56];
-    };
-
-    // A user area like this no longer exists on FreeBSD
-    // making this a Linux artifact. Nonetheless, it is safe
-    // leaving it here while the code is being cleaned up and generalized.
-
-    struct UserArea
-    {
-        GPR      regs;          // General purpose registers.
-        int32_t  fpvalid;       // True if FPU is being used.
-        FPU      i387;          // FPU registers.
-        uint32_t tsize;         // Text segment size.
-        uint32_t dsize;         // Data segment size.
-        uint32_t ssize;         // Stack segment size.
-        uint32_t start_code;    // VM address of text.
-        uint32_t start_stack;   // VM address of stack bottom (top in rsp).
-        int32_t  signal;        // Signal causing core dump.
-        int32_t  reserved;      // Unused.
-        uint32_t ar0;           // Location of GPR's.
-        FPU*     fpstate;       // Location of FPR's.
-        uint32_t magic;         // Identifier for core dumps.
-        char     u_comm[32];    // Command causing core dump.
-        uint32_t u_debugreg[8]; // Debug registers (DR0 - DR7).
-    };
-private:
-    UserArea user;
-
-    ProcessMonitor &GetMonitor();
-
-    void LogGPR(const char *title);
-
-    bool ReadGPR();
-    bool ReadFPR();
-};
-
-#endif // #ifndef liblldb_RegisterContext_i386_h_
Index: source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
===================================================================
--- source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
+++ source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
@@ -1,1563 +0,0 @@
-//===-- RegisterContext_x86_64.cpp -------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include <cstring>
-#include <errno.h>
-#include <stdint.h>
-
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/RegisterValue.h"
-#include "lldb/Core/Scalar.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Target/Thread.h"
-#include "lldb/Host/Endian.h"
-#include "llvm/Support/Compiler.h"
-
-#include "ProcessPOSIX.h"
-#if defined(__linux__) or defined(__FreeBSD__)
-#include "ProcessMonitor.h"
-#endif
-#include "RegisterContext_i386.h"
-#include "RegisterContext_x86.h"
-#include "RegisterContext_x86_64.h"
-#include "Plugins/Process/elf-core/ProcessElfCore.h"
-
-using namespace lldb_private;
-using namespace lldb;
-
-// Support ptrace extensions even when compiled without required kernel support
-#ifndef NT_X86_XSTATE
-  #define NT_X86_XSTATE 0x202
-#endif
-
-enum
-{
-    gcc_dwarf_gpr_rax = 0,
-    gcc_dwarf_gpr_rdx,
-    gcc_dwarf_gpr_rcx,
-    gcc_dwarf_gpr_rbx,
-    gcc_dwarf_gpr_rsi,
-    gcc_dwarf_gpr_rdi,
-    gcc_dwarf_gpr_rbp,
-    gcc_dwarf_gpr_rsp,
-    gcc_dwarf_gpr_r8,
-    gcc_dwarf_gpr_r9,
-    gcc_dwarf_gpr_r10,
-    gcc_dwarf_gpr_r11,
-    gcc_dwarf_gpr_r12,
-    gcc_dwarf_gpr_r13,
-    gcc_dwarf_gpr_r14,
-    gcc_dwarf_gpr_r15,
-    gcc_dwarf_gpr_rip,
-    gcc_dwarf_fpu_xmm0,
-    gcc_dwarf_fpu_xmm1,
-    gcc_dwarf_fpu_xmm2,
-    gcc_dwarf_fpu_xmm3,
-    gcc_dwarf_fpu_xmm4,
-    gcc_dwarf_fpu_xmm5,
-    gcc_dwarf_fpu_xmm6,
-    gcc_dwarf_fpu_xmm7,
-    gcc_dwarf_fpu_xmm8,
-    gcc_dwarf_fpu_xmm9,
-    gcc_dwarf_fpu_xmm10,
-    gcc_dwarf_fpu_xmm11,
-    gcc_dwarf_fpu_xmm12,
-    gcc_dwarf_fpu_xmm13,
-    gcc_dwarf_fpu_xmm14,
-    gcc_dwarf_fpu_xmm15,
-    gcc_dwarf_fpu_stmm0,
-    gcc_dwarf_fpu_stmm1,
-    gcc_dwarf_fpu_stmm2,
-    gcc_dwarf_fpu_stmm3,
-    gcc_dwarf_fpu_stmm4,
-    gcc_dwarf_fpu_stmm5,
-    gcc_dwarf_fpu_stmm6,
-    gcc_dwarf_fpu_stmm7,
-    gcc_dwarf_fpu_ymm0,
-    gcc_dwarf_fpu_ymm1,
-    gcc_dwarf_fpu_ymm2,
-    gcc_dwarf_fpu_ymm3,
-    gcc_dwarf_fpu_ymm4,
-    gcc_dwarf_fpu_ymm5,
-    gcc_dwarf_fpu_ymm6,
-    gcc_dwarf_fpu_ymm7,
-    gcc_dwarf_fpu_ymm8,
-    gcc_dwarf_fpu_ymm9,
-    gcc_dwarf_fpu_ymm10,
-    gcc_dwarf_fpu_ymm11,
-    gcc_dwarf_fpu_ymm12,
-    gcc_dwarf_fpu_ymm13,
-    gcc_dwarf_fpu_ymm14,
-    gcc_dwarf_fpu_ymm15
-};
-
-enum
-{
-    gdb_gpr_rax     =   0,
-    gdb_gpr_rbx     =   1,
-    gdb_gpr_rcx     =   2,
-    gdb_gpr_rdx     =   3,
-    gdb_gpr_rsi     =   4,
-    gdb_gpr_rdi     =   5,
-    gdb_gpr_rbp     =   6,
-    gdb_gpr_rsp     =   7,
-    gdb_gpr_r8      =   8,
-    gdb_gpr_r9      =   9,
-    gdb_gpr_r10     =  10,
-    gdb_gpr_r11     =  11,
-    gdb_gpr_r12     =  12,
-    gdb_gpr_r13     =  13,
-    gdb_gpr_r14     =  14,
-    gdb_gpr_r15     =  15,
-    gdb_gpr_rip     =  16,
-    gdb_gpr_rflags  =  17,
-    gdb_gpr_cs      =  18,
-    gdb_gpr_ss      =  19,
-    gdb_gpr_ds      =  20,
-    gdb_gpr_es      =  21,
-    gdb_gpr_fs      =  22,
-    gdb_gpr_gs      =  23,
-    gdb_fpu_stmm0   =  24,
-    gdb_fpu_stmm1   =  25,
-    gdb_fpu_stmm2   =  26,
-    gdb_fpu_stmm3   =  27,
-    gdb_fpu_stmm4   =  28,
-    gdb_fpu_stmm5   =  29,
-    gdb_fpu_stmm6   =  30,
-    gdb_fpu_stmm7   =  31,
-    gdb_fpu_fcw     =  32,
-    gdb_fpu_fsw     =  33,
-    gdb_fpu_ftw     =  34,
-    gdb_fpu_cs_64   =  35,
-    gdb_fpu_ip      =  36,
-    gdb_fpu_ds_64   =  37,
-    gdb_fpu_dp      =  38,
-    gdb_fpu_fop     =  39,
-    gdb_fpu_xmm0    =  40,
-    gdb_fpu_xmm1    =  41,
-    gdb_fpu_xmm2    =  42,
-    gdb_fpu_xmm3    =  43,
-    gdb_fpu_xmm4    =  44,
-    gdb_fpu_xmm5    =  45,
-    gdb_fpu_xmm6    =  46,
-    gdb_fpu_xmm7    =  47,
-    gdb_fpu_xmm8    =  48,
-    gdb_fpu_xmm9    =  49,
-    gdb_fpu_xmm10   =  50,
-    gdb_fpu_xmm11   =  51,
-    gdb_fpu_xmm12   =  52,
-    gdb_fpu_xmm13   =  53,
-    gdb_fpu_xmm14   =  54,
-    gdb_fpu_xmm15   =  55,
-    gdb_fpu_mxcsr   =  56,
-    gdb_fpu_ymm0    =  57,
-    gdb_fpu_ymm1    =  58,
-    gdb_fpu_ymm2    =  59,
-    gdb_fpu_ymm3    =  60,
-    gdb_fpu_ymm4    =  61,
-    gdb_fpu_ymm5    =  62,
-    gdb_fpu_ymm6    =  63,
-    gdb_fpu_ymm7    =  64,
-    gdb_fpu_ymm8    =  65,
-    gdb_fpu_ymm9    =  66,
-    gdb_fpu_ymm10   =  67,
-    gdb_fpu_ymm11   =  68,
-    gdb_fpu_ymm12   =  69,
-    gdb_fpu_ymm13   =  70,
-    gdb_fpu_ymm14   =  71,
-    gdb_fpu_ymm15   =  72
-};
-
-static const
-uint32_t g_gpr_regnums[k_num_gpr_registers] =
-{
-    gpr_rax,
-    gpr_rbx,
-    gpr_rcx,
-    gpr_rdx,
-    gpr_rdi,
-    gpr_rsi,
-    gpr_rbp,
-    gpr_rsp,
-    gpr_r8,
-    gpr_r9,
-    gpr_r10,
-    gpr_r11,
-    gpr_r12,
-    gpr_r13,
-    gpr_r14,
-    gpr_r15,
-    gpr_rip,
-    gpr_rflags,
-    gpr_cs,
-    gpr_fs,
-    gpr_gs,
-    gpr_ss,
-    gpr_ds,
-    gpr_es,
-    gpr_eax,
-    gpr_ebx,
-    gpr_ecx,
-    gpr_edx,
-    gpr_edi,
-    gpr_esi,
-    gpr_ebp,
-    gpr_esp,
-    gpr_eip,
-    gpr_eflags
-};
-
-static const uint32_t
-g_fpu_regnums[k_num_fpr_registers] =
-{
-    fpu_fcw,
-    fpu_fsw,
-    fpu_ftw,
-    fpu_fop,
-    fpu_ip,
-    fpu_cs,
-    fpu_dp,
-    fpu_ds,
-    fpu_mxcsr,
-    fpu_mxcsrmask,
-    fpu_stmm0,
-    fpu_stmm1,
-    fpu_stmm2,
-    fpu_stmm3,
-    fpu_stmm4,
-    fpu_stmm5,
-    fpu_stmm6,
-    fpu_stmm7,
-    fpu_xmm0,
-    fpu_xmm1,
-    fpu_xmm2,
-    fpu_xmm3,
-    fpu_xmm4,
-    fpu_xmm5,
-    fpu_xmm6,
-    fpu_xmm7,
-    fpu_xmm8,
-    fpu_xmm9,
-    fpu_xmm10,
-    fpu_xmm11,
-    fpu_xmm12,
-    fpu_xmm13,
-    fpu_xmm14,
-    fpu_xmm15
-};
-
-static const uint32_t
-g_avx_regnums[k_num_avx_registers] =
-{
-    fpu_ymm0,
-    fpu_ymm1,
-    fpu_ymm2,
-    fpu_ymm3,
-    fpu_ymm4,
-    fpu_ymm5,
-    fpu_ymm6,
-    fpu_ymm7,
-    fpu_ymm8,
-    fpu_ymm9,
-    fpu_ymm10,
-    fpu_ymm11,
-    fpu_ymm12,
-    fpu_ymm13,
-    fpu_ymm14,
-    fpu_ymm15
-};
-
-// Number of register sets provided by this context.
-enum
-{
-    k_num_extended_register_sets = 1,
-    k_num_register_sets = 3
-};
-
-static const RegisterSet
-g_reg_sets[k_num_register_sets] =
-{
-    { "General Purpose Registers",  "gpr", k_num_gpr_registers, g_gpr_regnums },
-    { "Floating Point Registers",   "fpu", k_num_fpr_registers, g_fpu_regnums },
-    { "Advanced Vector Extensions", "avx", k_num_avx_registers, g_avx_regnums }
-};
-
-// Computes the offset of the given FPR in the extended data area.
-#define FPR_OFFSET(regname) \
-    (offsetof(RegisterContext_x86_64::FPR, xstate) + \
-     offsetof(RegisterContext_x86_64::FXSAVE, regname))
-
-// Computes the offset of the YMM register assembled from register halves.
-#define YMM_OFFSET(regname) \
-    (offsetof(RegisterContext_x86_64::YMM, regname))
-
-// Number of bytes needed to represent a i386 GPR
-#define GPR_i386_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)
-
-// Number of bytes needed to represent a FPR.
-#define FPR_SIZE(reg) sizeof(((RegisterContext_x86_64::FXSAVE*)NULL)->reg)
-
-// Number of bytes needed to represent the i'th FP register.
-#define FP_SIZE sizeof(((RegisterContext_x86_64::MMSReg*)NULL)->bytes)
-
-// Number of bytes needed to represent an XMM register.
-#define XMM_SIZE sizeof(RegisterContext_x86_64::XMMReg)
-
-// Number of bytes needed to represent a YMM register.
-#define YMM_SIZE sizeof(RegisterContext_x86_64::YMMReg)
-
-// Note that the size and offset will be updated by platform-specific classes.
-#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4)           \
-    { #reg, alt, 0, 0, eEncodingUint,                              \
-      eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg }, NULL, NULL }
-
-// Dummy data for RegisterInfo::value_regs as expected by DumpRegisterSet. 
-static uint32_t value_regs = LLDB_INVALID_REGNUM;
-
-#define DEFINE_GPR_i386(reg_i386, reg_x86_64, alt, kind1, kind2, kind3, kind4) \
-    { #reg_i386, alt, GPR_i386_SIZE(reg_i386), 0, eEncodingUint,   \
-      eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg_i386 }, &value_regs, NULL }
-
-#define DEFINE_FPR(reg, kind1, kind2, kind3, kind4)                \
-    { #reg, NULL, FPR_SIZE(reg), FPR_OFFSET(reg), eEncodingUint,   \
-      eFormatHex, { kind1, kind2, kind3, kind4, fpu_##reg }, NULL, NULL }
-
-#define DEFINE_FP(reg, i)                                          \
-    { #reg#i, NULL, FP_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]),    \
-      eEncodingVector, eFormatVectorOfUInt8,                       \
-      { gcc_dwarf_fpu_##reg##i, gcc_dwarf_fpu_##reg##i,            \
-        LLDB_INVALID_REGNUM, gdb_fpu_##reg##i, fpu_##reg##i }, NULL, NULL }
-
-#define DEFINE_XMM(reg, i)                                         \
-    { #reg#i, NULL, XMM_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]),   \
-      eEncodingVector, eFormatVectorOfUInt8,                       \
-      { gcc_dwarf_fpu_##reg##i, gcc_dwarf_fpu_##reg##i,            \
-        LLDB_INVALID_REGNUM, gdb_fpu_##reg##i, fpu_##reg##i }, NULL, NULL }
-
-#define DEFINE_YMM(reg, i)                                         \
-    { #reg#i, NULL, YMM_SIZE, LLVM_EXTENSION YMM_OFFSET(reg[i]),   \
-      eEncodingVector, eFormatVectorOfUInt8,                       \
-      { gcc_dwarf_fpu_##reg##i, gcc_dwarf_fpu_##reg##i,            \
-        LLDB_INVALID_REGNUM, gdb_fpu_##reg##i, fpu_##reg##i }, NULL, NULL }
-
-#define DEFINE_DR(reg, i)                                              \
-    { #reg#i, NULL, 0, 0, eEncodingUint, eFormatHex,                   \
-      { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
-      LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM }, NULL, NULL }
-
-#define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(RegisterContext_x86_64::FPR))
-
-static RegisterInfo
-g_register_infos[k_num_registers] =
-{
-    // General purpose registers.
-    DEFINE_GPR(rax,    NULL,    gcc_dwarf_gpr_rax,   gcc_dwarf_gpr_rax,   LLDB_INVALID_REGNUM,       gdb_gpr_rax),
-    DEFINE_GPR(rbx,    NULL,    gcc_dwarf_gpr_rbx,   gcc_dwarf_gpr_rbx,   LLDB_INVALID_REGNUM,       gdb_gpr_rbx),
-    DEFINE_GPR(rcx,    NULL,    gcc_dwarf_gpr_rcx,   gcc_dwarf_gpr_rcx,   LLDB_INVALID_REGNUM,       gdb_gpr_rcx),
-    DEFINE_GPR(rdx,    NULL,    gcc_dwarf_gpr_rdx,   gcc_dwarf_gpr_rdx,   LLDB_INVALID_REGNUM,       gdb_gpr_rdx),
-    DEFINE_GPR(rdi,    NULL,    gcc_dwarf_gpr_rdi,   gcc_dwarf_gpr_rdi,   LLDB_INVALID_REGNUM,       gdb_gpr_rdi),
-    DEFINE_GPR(rsi,    NULL,    gcc_dwarf_gpr_rsi,   gcc_dwarf_gpr_rsi,   LLDB_INVALID_REGNUM,       gdb_gpr_rsi),
-    DEFINE_GPR(rbp,    "fp",    gcc_dwarf_gpr_rbp,   gcc_dwarf_gpr_rbp,   LLDB_REGNUM_GENERIC_FP,    gdb_gpr_rbp),
-    DEFINE_GPR(rsp,    "sp",    gcc_dwarf_gpr_rsp,   gcc_dwarf_gpr_rsp,   LLDB_REGNUM_GENERIC_SP,    gdb_gpr_rsp),
-    DEFINE_GPR(r8,     NULL,    gcc_dwarf_gpr_r8,    gcc_dwarf_gpr_r8,    LLDB_INVALID_REGNUM,       gdb_gpr_r8),
-    DEFINE_GPR(r9,     NULL,    gcc_dwarf_gpr_r9,    gcc_dwarf_gpr_r9,    LLDB_INVALID_REGNUM,       gdb_gpr_r9),
-    DEFINE_GPR(r10,    NULL,    gcc_dwarf_gpr_r10,   gcc_dwarf_gpr_r10,   LLDB_INVALID_REGNUM,       gdb_gpr_r10),
-    DEFINE_GPR(r11,    NULL,    gcc_dwarf_gpr_r11,   gcc_dwarf_gpr_r11,   LLDB_INVALID_REGNUM,       gdb_gpr_r11),
-    DEFINE_GPR(r12,    NULL,    gcc_dwarf_gpr_r12,   gcc_dwarf_gpr_r12,   LLDB_INVALID_REGNUM,       gdb_gpr_r12),
-    DEFINE_GPR(r13,    NULL,    gcc_dwarf_gpr_r13,   gcc_dwarf_gpr_r13,   LLDB_INVALID_REGNUM,       gdb_gpr_r13),
-    DEFINE_GPR(r14,    NULL,    gcc_dwarf_gpr_r14,   gcc_dwarf_gpr_r14,   LLDB_INVALID_REGNUM,       gdb_gpr_r14),
-    DEFINE_GPR(r15,    NULL,    gcc_dwarf_gpr_r15,   gcc_dwarf_gpr_r15,   LLDB_INVALID_REGNUM,       gdb_gpr_r15),
-    DEFINE_GPR(rip,    "pc",    gcc_dwarf_gpr_rip,   gcc_dwarf_gpr_rip,   LLDB_REGNUM_GENERIC_PC,    gdb_gpr_rip),
-    DEFINE_GPR(rflags, "flags", LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_FLAGS, gdb_gpr_rflags),
-    DEFINE_GPR(cs,     NULL,    LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,       gdb_gpr_cs),
-    DEFINE_GPR(fs,     NULL,    LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,       gdb_gpr_fs),
-    DEFINE_GPR(gs,     NULL,    LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,       gdb_gpr_gs),
-    DEFINE_GPR(ss,     NULL,    LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,       gdb_gpr_ss),
-    DEFINE_GPR(ds,     NULL,    LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,       gdb_gpr_ds),
-    DEFINE_GPR(es,     NULL,    LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,       gdb_gpr_es),
-    // i386 registers
-    DEFINE_GPR_i386(eax,    rax,    NULL,    gcc_eax,    dwarf_eax,    LLDB_INVALID_REGNUM,       gdb_eax),
-    DEFINE_GPR_i386(ebx,    rbx,    NULL,    gcc_ebx,    dwarf_ebx,    LLDB_INVALID_REGNUM,       gdb_ebx),
-    DEFINE_GPR_i386(ecx,    rcx,    NULL,    gcc_ecx,    dwarf_ecx,    LLDB_INVALID_REGNUM,       gdb_ecx),
-    DEFINE_GPR_i386(edx,    rdx,    NULL,    gcc_edx,    dwarf_edx,    LLDB_INVALID_REGNUM,       gdb_edx),
-    DEFINE_GPR_i386(edi,    rdi,    NULL,    gcc_edi,    dwarf_edi,    LLDB_INVALID_REGNUM,       gdb_edi),
-    DEFINE_GPR_i386(esi,    rsi,    NULL,    gcc_esi,    dwarf_esi,    LLDB_INVALID_REGNUM,       gdb_esi),
-    DEFINE_GPR_i386(ebp,    rbp,    "fp",    gcc_ebp,    dwarf_ebp,    LLDB_REGNUM_GENERIC_FP,    gdb_ebp),
-    DEFINE_GPR_i386(esp,    rsp,    "sp",    gcc_esp,    dwarf_esp,    LLDB_REGNUM_GENERIC_SP,    gdb_esp),
-    DEFINE_GPR_i386(eip,    rip,    "pc",    gcc_eip,    dwarf_eip,    LLDB_REGNUM_GENERIC_PC,    gdb_eip),
-    DEFINE_GPR_i386(eflags, rflags, "flags", gcc_eflags, dwarf_eflags, LLDB_REGNUM_GENERIC_FLAGS, gdb_eflags),
-    // i387 Floating point registers.
-    DEFINE_FPR(fcw,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_fcw),
-    DEFINE_FPR(fsw,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_fsw),
-    DEFINE_FPR(ftw,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_ftw),
-    DEFINE_FPR(fop,       LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_fop),
-    DEFINE_FPR(ip,        LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_ip),
-    // FIXME: Extract segment from ip.
-    DEFINE_FPR(ip,        LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_cs_64),
-    DEFINE_FPR(dp,        LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_dp),
-    // FIXME: Extract segment from dp.
-    DEFINE_FPR(dp,        LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_ds_64),
-    DEFINE_FPR(mxcsr,     LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_mxcsr),
-    DEFINE_FPR(mxcsrmask, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM),
-
-    // FP registers.
-    DEFINE_FP(stmm, 0),
-    DEFINE_FP(stmm, 1),
-    DEFINE_FP(stmm, 2),
-    DEFINE_FP(stmm, 3),
-    DEFINE_FP(stmm, 4),
-    DEFINE_FP(stmm, 5),
-    DEFINE_FP(stmm, 6),
-    DEFINE_FP(stmm, 7),
-
-    // XMM registers
-    DEFINE_XMM(xmm, 0),
-    DEFINE_XMM(xmm, 1),
-    DEFINE_XMM(xmm, 2),
-    DEFINE_XMM(xmm, 3),
-    DEFINE_XMM(xmm, 4),
-    DEFINE_XMM(xmm, 5),
-    DEFINE_XMM(xmm, 6),
-    DEFINE_XMM(xmm, 7),
-    DEFINE_XMM(xmm, 8),
-    DEFINE_XMM(xmm, 9),
-    DEFINE_XMM(xmm, 10),
-    DEFINE_XMM(xmm, 11),
-    DEFINE_XMM(xmm, 12),
-    DEFINE_XMM(xmm, 13),
-    DEFINE_XMM(xmm, 14),
-    DEFINE_XMM(xmm, 15),
-
-    // Copy of YMM registers assembled from xmm and ymmh
-    DEFINE_YMM(ymm, 0),
-    DEFINE_YMM(ymm, 1),
-    DEFINE_YMM(ymm, 2),
-    DEFINE_YMM(ymm, 3),
-    DEFINE_YMM(ymm, 4),
-    DEFINE_YMM(ymm, 5),
-    DEFINE_YMM(ymm, 6),
-    DEFINE_YMM(ymm, 7),
-    DEFINE_YMM(ymm, 8),
-    DEFINE_YMM(ymm, 9),
-    DEFINE_YMM(ymm, 10),
-    DEFINE_YMM(ymm, 11),
-    DEFINE_YMM(ymm, 12),
-    DEFINE_YMM(ymm, 13),
-    DEFINE_YMM(ymm, 14),
-    DEFINE_YMM(ymm, 15),
-
-    // Debug registers for lldb internal use
-    DEFINE_DR(dr, 0),
-    DEFINE_DR(dr, 1),
-    DEFINE_DR(dr, 2),
-    DEFINE_DR(dr, 3),
-    DEFINE_DR(dr, 4),
-    DEFINE_DR(dr, 5),
-    DEFINE_DR(dr, 6),
-    DEFINE_DR(dr, 7)
-};
-
-static bool IsGPR(unsigned reg)
-{
-    return reg <= k_last_gpr;   // GPR's come first.
-}
-
-static bool IsAVX(unsigned reg)
-{
-    return (k_first_avx <= reg && reg <= k_last_avx);
-}
-static bool IsFPR(unsigned reg)
-{
-    return (k_first_fpr <= reg && reg <= k_last_fpr);
-}
-
-
-bool RegisterContext_x86_64::IsFPR(unsigned reg, FPRType fpr_type)
-{
-    bool generic_fpr = ::IsFPR(reg);
-    if (fpr_type == eXSAVE)
-      return generic_fpr || IsAVX(reg);
-
-    return generic_fpr;
-}
-
-RegisterContext_x86_64::RegisterContext_x86_64(Thread &thread,
-                                               uint32_t concrete_frame_idx)
-    : RegisterContextPOSIX(thread, concrete_frame_idx)
-{
-    // Initialize m_iovec to point to the buffer and buffer size
-    // using the conventions of Berkeley style UIO structures, as required
-    // by PTRACE extensions.
-    m_iovec.iov_base = &m_fpr.xstate.xsave;
-    m_iovec.iov_len = sizeof(m_fpr.xstate.xsave);
-
-    ::memset(&m_fpr, 0, sizeof(RegisterContext_x86_64::FPR));
-
-    // elf-core yet to support ReadFPR()
-    ProcessSP base = CalculateProcess();
-    if (base.get()->GetPluginName() ==  ProcessElfCore::GetPluginNameStatic())
-        return;
-    
-    // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx
-    m_fpr_type = eXSAVE; // extended floating-point registers, if available
-    if (false == ReadFPR())
-        m_fpr_type = eFXSAVE; // assume generic floating-point registers
-}
-
-RegisterContext_x86_64::~RegisterContext_x86_64()
-{
-}
-
-void
-RegisterContext_x86_64::Invalidate()
-{
-}
-
-void
-RegisterContext_x86_64::InvalidateAllRegisters()
-{
-}
-
-unsigned
-RegisterContext_x86_64::GetRegisterOffset(unsigned reg)
-{
-    assert(reg < k_num_registers && "Invalid register number.");
-    return GetRegisterInfo()[reg].byte_offset;
-}
-
-unsigned
-RegisterContext_x86_64::GetRegisterSize(unsigned reg)
-{
-    assert(reg < k_num_registers && "Invalid register number.");
-    return GetRegisterInfo()[reg].byte_size;
-}
-
-size_t
-RegisterContext_x86_64::GetRegisterCount()
-{
-    size_t num_registers = k_num_gpr_registers + k_num_fpr_registers;
-    if (m_fpr_type == eXSAVE)
-      return num_registers + k_num_avx_registers;
-    return num_registers;
-}
-
-const RegisterInfo *
-RegisterContext_x86_64::GetRegisterInfo()
-{
-    // Commonly, this method is overridden and g_register_infos is copied and specialized.
-    // So, use GetRegisterInfo() rather than g_register_infos in this scope.
-    return g_register_infos;
-}
-
-const RegisterInfo *
-RegisterContext_x86_64::GetRegisterInfoAtIndex(size_t reg)
-{
-    if (reg < k_num_registers)
-        return &GetRegisterInfo()[reg];
-    else
-        return NULL;
-}
-
-size_t
-RegisterContext_x86_64::GetRegisterSetCount()
-{
-    size_t sets = 0;
-    for (size_t set = 0; set < k_num_register_sets; ++set)
-        if (IsRegisterSetAvailable(set))
-            ++sets;
-
-    return sets;
-}
-
-const RegisterSet *
-RegisterContext_x86_64::GetRegisterSet(size_t set)
-{
-    if (IsRegisterSetAvailable(set))
-        return &g_reg_sets[set];
-    else
-        return NULL;
-}
-
-unsigned
-RegisterContext_x86_64::GetRegisterIndexFromOffset(unsigned offset)
-{
-    unsigned reg;
-    for (reg = 0; reg < k_num_registers; reg++)
-    {
-        if (GetRegisterInfo()[reg].byte_offset == offset)
-            break;
-    }
-    assert(reg < k_num_registers && "Invalid register offset.");
-    return reg;
-}
-
-const char *
-RegisterContext_x86_64::GetRegisterName(unsigned reg)
-{
-    assert(reg < k_num_registers && "Invalid register offset.");
-    return GetRegisterInfo()[reg].name;
-}
-
-lldb::ByteOrder
-RegisterContext_x86_64::GetByteOrder()
-{
-    // Get the target process whose privileged thread was used for the register read.
-    lldb::ByteOrder byte_order = eByteOrderInvalid;
-    Process *process = CalculateProcess().get();
-
-    if (process)
-        byte_order = process->GetByteOrder();
-    return byte_order;
-}
-
-// Parse ymm registers and into xmm.bytes and ymmh.bytes.
-bool RegisterContext_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
-{
-    if (!IsAVX(reg))
-        return false;
-
-    if (byte_order == eByteOrderLittle) {
-      ::memcpy(m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
-               m_ymm_set.ymm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::XMMReg));
-      ::memcpy(m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
-               m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
-               sizeof(RegisterContext_x86_64::YMMHReg));
-      return true;
-    }
-
-    if (byte_order == eByteOrderBig) {
-      ::memcpy(m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
-               m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
-               sizeof(RegisterContext_x86_64::XMMReg));
-      ::memcpy(m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
-               m_ymm_set.ymm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::YMMHReg));
-      return true;
-    }
-    return false; // unsupported or invalid byte order
-}
-
-// Concatenate xmm.bytes with ymmh.bytes
-bool RegisterContext_x86_64::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
-{
-    if (!IsAVX(reg))
-        return false;
-
-    if (byte_order == eByteOrderLittle) {
-      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes,
-               m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::XMMReg));
-      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
-               m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::YMMHReg));
-      return true;
-    }
-    if (byte_order == eByteOrderBig) {
-      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),
-               m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::XMMReg));
-      ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes,
-               m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,
-               sizeof(RegisterContext_x86_64::YMMHReg));
-      return true;
-    }
-    return false; // unsupported or invalid byte order
-}
-
-bool
-RegisterContext_x86_64::IsRegisterSetAvailable(size_t set_index)
-{
-    // Note: Extended register sets are assumed to be at the end of g_reg_sets...
-    size_t num_sets = k_num_register_sets - k_num_extended_register_sets;
-    if (m_fpr_type == eXSAVE) // ...and to start with AVX registers.
-        ++num_sets;
-
-    return (set_index < num_sets);
-}   
-
-bool
-RegisterContext_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
-{
-    if (!reg_info)
-        return false;
-
-    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-
-    if (IsFPR(reg, m_fpr_type)) {
-        if (!ReadFPR())
-            return false;
-    }
-    else {
-        bool success = ReadRegister(reg, value);
-
-        // If an i386 register should be parsed from an x86_64 register...
-        if (success && reg >= k_first_i386 && reg <= k_last_i386)
-            if (value.GetByteSize() > reg_info->byte_size)
-                value.SetType(reg_info); // ...use the type specified by reg_info rather than the uint64_t default
-        return success; 
-    }
-
-    if (reg_info->encoding == eEncodingVector) {
-        ByteOrder byte_order = GetByteOrder();
-
-        if (byte_order != ByteOrder::eByteOrderInvalid) {
-            if (reg >= fpu_stmm0 && reg <= fpu_stmm7) {
-               value.SetBytes(m_fpr.xstate.fxsave.stmm[reg - fpu_stmm0].bytes, reg_info->byte_size, byte_order);
-            }
-            if (reg >= fpu_xmm0 && reg <= fpu_xmm15) {
-                value.SetBytes(m_fpr.xstate.fxsave.xmm[reg - fpu_xmm0].bytes, reg_info->byte_size, byte_order);
-            }
-            if (reg >= fpu_ymm0 && reg <= fpu_ymm15) {
-                // Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes
-                if (m_fpr_type == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))
-                    value.SetBytes(m_ymm_set.ymm[reg - fpu_ymm0].bytes, reg_info->byte_size, byte_order);
-                else
-                    return false;
-            }
-            return value.GetType() == RegisterValue::eTypeBytes;
-        }
-        return false;
-    }
-
-    // Note that lldb uses slightly different naming conventions from sys/user.h
-    switch (reg)
-    {
-    default:
-        return false;
-    case fpu_dp:
-        value = m_fpr.xstate.fxsave.dp;
-        break;
-    case fpu_fcw:
-        value = m_fpr.xstate.fxsave.fcw;
-        break;
-    case fpu_fsw:
-        value = m_fpr.xstate.fxsave.fsw;
-        break;
-    case fpu_ip:
-        value = m_fpr.xstate.fxsave.ip;
-        break;
-    case fpu_fop:
-        value = m_fpr.xstate.fxsave.fop;
-        break;
-    case fpu_ftw:
-        value = m_fpr.xstate.fxsave.ftw;
-        break;
-    case fpu_mxcsr:
-        value = m_fpr.xstate.fxsave.mxcsr;
-        break;
-    case fpu_mxcsrmask:
-        value = m_fpr.xstate.fxsave.mxcsrmask;
-        break;
-    }
-    return true;
-}
-
-bool
-RegisterContext_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp)
-{
-    bool success = false;
-    data_sp.reset (new DataBufferHeap (REG_CONTEXT_SIZE, 0));
-    if (data_sp && ReadGPR () && ReadFPR ())
-    {
-        uint8_t *dst = data_sp->GetBytes();
-        success = dst != 0;
-
-        if (success) {
-            ::memcpy (dst, &m_gpr, GetGPRSize());
-            dst += GetGPRSize();
-        }
-        if (m_fpr_type == eFXSAVE)
-            ::memcpy (dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-        
-        if (m_fpr_type == eXSAVE) {
-            ByteOrder byte_order = GetByteOrder();
-
-            // Assemble the YMM register content from the register halves.
-            for (uint32_t reg = fpu_ymm0; success && reg <= fpu_ymm15; ++reg)
-                success = CopyXSTATEtoYMM(reg, byte_order);
-
-            if (success) {
-                // Copy the extended register state including the assembled ymm registers.
-                ::memcpy (dst, &m_fpr, sizeof(m_fpr));
-            }
-        }
-    }
-    return success;
-}
-
-bool
-RegisterContext_x86_64::WriteRegister(const lldb_private::RegisterInfo *reg_info,
-                                      const lldb_private::RegisterValue &value)
-{
-    const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-    if (IsGPR(reg)) {
-        return WriteRegister(reg, value);
-    }
-
-    if (IsFPR(reg, m_fpr_type)) {
-        switch (reg)
-        {
-        default:
-            if (reg_info->encoding != eEncodingVector)
-                return false;
-
-            if (reg >= fpu_stmm0 && reg <= fpu_stmm7)
-               ::memcpy (m_fpr.xstate.fxsave.stmm[reg - fpu_stmm0].bytes, value.GetBytes(), value.GetByteSize());
-            
-            if (reg >= fpu_xmm0 && reg <= fpu_xmm15)
-               ::memcpy (m_fpr.xstate.fxsave.xmm[reg - fpu_xmm0].bytes, value.GetBytes(), value.GetByteSize());
-            
-            if (reg >= fpu_ymm0 && reg <= fpu_ymm15) {
-               if (m_fpr_type != eXSAVE)
-                   return false; // the target processor does not support AVX
-
-               // Store ymm register content, and split into the register halves in xmm.bytes and ymmh.bytes
-               ::memcpy (m_ymm_set.ymm[reg - fpu_ymm0].bytes, value.GetBytes(), value.GetByteSize());
-               if (false == CopyYMMtoXSTATE(reg, GetByteOrder()))
-                   return false;
-            }
-            break;
-        case fpu_dp:
-            m_fpr.xstate.fxsave.dp = value.GetAsUInt64();
-            break;
-        case fpu_fcw:
-            m_fpr.xstate.fxsave.fcw = value.GetAsUInt16();
-            break;
-        case fpu_fsw:
-            m_fpr.xstate.fxsave.fsw = value.GetAsUInt16();
-            break;
-        case fpu_ip:
-            m_fpr.xstate.fxsave.ip = value.GetAsUInt64();
-            break;
-        case fpu_fop:
-            m_fpr.xstate.fxsave.fop = value.GetAsUInt16();
-            break;
-        case fpu_ftw:
-            m_fpr.xstate.fxsave.ftw = value.GetAsUInt16();
-            break;
-        case fpu_mxcsr:
-            m_fpr.xstate.fxsave.mxcsr = value.GetAsUInt32();
-            break;
-        case fpu_mxcsrmask:
-            m_fpr.xstate.fxsave.mxcsrmask = value.GetAsUInt32();
-            break;
-        }
-        if (WriteFPR()) {
-            if (IsAVX(reg))
-                return CopyYMMtoXSTATE(reg, GetByteOrder());
-            return true;
-        }
-    }
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteAllRegisterValues(const DataBufferSP &data_sp)
-{
-    bool success = false;
-    if (data_sp && data_sp->GetByteSize() == REG_CONTEXT_SIZE)
-    {
-        uint8_t *src = data_sp->GetBytes();
-        if (src) {
-            ::memcpy (&m_gpr, src, GetGPRSize());
-
-            if (WriteGPR()) {
-                src += GetGPRSize();
-                if (m_fpr_type == eFXSAVE)
-                    ::memcpy (&m_fpr.xstate.fxsave, src, sizeof(m_fpr.xstate.fxsave));
-                if (m_fpr_type == eXSAVE)
-                    ::memcpy (&m_fpr.xstate.xsave, src, sizeof(m_fpr.xstate.xsave));
-
-                success = WriteFPR();
-                if (success) {
-                    success = true;
-
-                    if (m_fpr_type == eXSAVE) {
-                        ByteOrder byte_order = GetByteOrder();
-
-                        // Parse the YMM register content from the register halves.
-                        for (uint32_t reg = fpu_ymm0; success && reg <= fpu_ymm15; ++reg)
-                            success = CopyYMMtoXSTATE(reg, byte_order);
-                    }
-                }
-            }
-        }
-    }
-    return success;
-}
-
-bool
-RegisterContext_x86_64::UpdateAfterBreakpoint()
-{
-    // PC points one byte past the int3 responsible for the breakpoint.
-    lldb::addr_t pc;
-
-    if ((pc = GetPC()) == LLDB_INVALID_ADDRESS)
-        return false;
-
-    SetPC(pc - 1);
-    return true;
-}
-
-uint32_t
-RegisterContext_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind,
-                                                                 uint32_t num)
-{
-    const Process *process = CalculateProcess().get();
-    if (process)
-    {
-        const ArchSpec arch = process->GetTarget().GetArchitecture();;
-        switch (arch.GetCore())
-        {
-        default:
-            assert(false && "CPU type not supported!");
-            break;
-
-        case ArchSpec::eCore_x86_32_i386:
-        case ArchSpec::eCore_x86_32_i486:
-        case ArchSpec::eCore_x86_32_i486sx:
-        {
-            if (kind == eRegisterKindGeneric)
-            {
-                switch (num)
-                {
-                case LLDB_REGNUM_GENERIC_PC:    return gpr_eip;
-                case LLDB_REGNUM_GENERIC_SP:    return gpr_esp;
-                case LLDB_REGNUM_GENERIC_FP:    return gpr_ebp;
-                case LLDB_REGNUM_GENERIC_FLAGS: return gpr_eflags;
-                case LLDB_REGNUM_GENERIC_RA:
-                default:
-                    return LLDB_INVALID_REGNUM;
-                }
-            }
-
-            if (kind == eRegisterKindGCC || kind == eRegisterKindDWARF)
-            {
-                switch (num)
-                {
-                case dwarf_eax:  return gpr_eax;
-                case dwarf_edx:  return gpr_edx;
-                case dwarf_ecx:  return gpr_ecx;
-                case dwarf_ebx:  return gpr_ebx;
-                case dwarf_esi:  return gpr_esi;
-                case dwarf_edi:  return gpr_edi;
-                case dwarf_ebp:  return gpr_ebp;
-                case dwarf_esp:  return gpr_esp;
-                case dwarf_eip:  return gpr_eip;
-                case dwarf_xmm0: return fpu_xmm0;
-                case dwarf_xmm1: return fpu_xmm1;
-                case dwarf_xmm2: return fpu_xmm2;
-                case dwarf_xmm3: return fpu_xmm3;
-                case dwarf_xmm4: return fpu_xmm4;
-                case dwarf_xmm5: return fpu_xmm5;
-                case dwarf_xmm6: return fpu_xmm6;
-                case dwarf_xmm7: return fpu_xmm7;
-                case dwarf_stmm0: return fpu_stmm0;
-                case dwarf_stmm1: return fpu_stmm1;
-                case dwarf_stmm2: return fpu_stmm2;
-                case dwarf_stmm3: return fpu_stmm3;
-                case dwarf_stmm4: return fpu_stmm4;
-                case dwarf_stmm5: return fpu_stmm5;
-                case dwarf_stmm6: return fpu_stmm6;
-                case dwarf_stmm7: return fpu_stmm7;
-                default:
-                    return LLDB_INVALID_REGNUM;
-                }
-            }
-
-            if (kind == eRegisterKindGDB)
-            {
-                switch (num)
-                {
-                case gdb_eax     : return gpr_eax;
-                case gdb_ebx     : return gpr_ebx;
-                case gdb_ecx     : return gpr_ecx;
-                case gdb_edx     : return gpr_edx;
-                case gdb_esi     : return gpr_esi;
-                case gdb_edi     : return gpr_edi;
-                case gdb_ebp     : return gpr_ebp;
-                case gdb_esp     : return gpr_esp;
-                case gdb_eip     : return gpr_eip;
-                case gdb_eflags  : return gpr_eflags;
-                case gdb_cs      : return gpr_cs;
-                case gdb_ss      : return gpr_ss;
-                case gdb_ds      : return gpr_ds;
-                case gdb_es      : return gpr_es;
-                case gdb_fs      : return gpr_fs;
-                case gdb_gs      : return gpr_gs;
-                case gdb_stmm0   : return fpu_stmm0;
-                case gdb_stmm1   : return fpu_stmm1;
-                case gdb_stmm2   : return fpu_stmm2;
-                case gdb_stmm3   : return fpu_stmm3;
-                case gdb_stmm4   : return fpu_stmm4;
-                case gdb_stmm5   : return fpu_stmm5;
-                case gdb_stmm6   : return fpu_stmm6;
-                case gdb_stmm7   : return fpu_stmm7;
-                case gdb_fcw     : return fpu_fcw;
-                case gdb_fsw     : return fpu_fsw;
-                case gdb_ftw     : return fpu_ftw;
-                case gdb_fpu_cs  : return fpu_cs;
-                case gdb_ip      : return fpu_ip;
-                case gdb_fpu_ds  : return fpu_ds; //fpu_fos
-                case gdb_dp      : return fpu_dp; //fpu_foo
-                case gdb_fop     : return fpu_fop;
-                case gdb_xmm0    : return fpu_xmm0;
-                case gdb_xmm1    : return fpu_xmm1;
-                case gdb_xmm2    : return fpu_xmm2;
-                case gdb_xmm3    : return fpu_xmm3;
-                case gdb_xmm4    : return fpu_xmm4;
-                case gdb_xmm5    : return fpu_xmm5;
-                case gdb_xmm6    : return fpu_xmm6;
-                case gdb_xmm7    : return fpu_xmm7;
-                case gdb_mxcsr   : return fpu_mxcsr;
-                default:
-                    return LLDB_INVALID_REGNUM;
-                }
-            }
-            else if (kind == eRegisterKindLLDB)
-            {
-                return num;
-            }
-
-            break;
-        }
-
-        case ArchSpec::eCore_x86_64_x86_64:
-        {
-            if (kind == eRegisterKindGeneric)
-            {
-                switch (num)
-                {
-                case LLDB_REGNUM_GENERIC_PC:    return gpr_rip;
-                case LLDB_REGNUM_GENERIC_SP:    return gpr_rsp;
-                case LLDB_REGNUM_GENERIC_FP:    return gpr_rbp;
-                case LLDB_REGNUM_GENERIC_FLAGS: return gpr_rflags;
-                case LLDB_REGNUM_GENERIC_RA:
-                default:
-                    return LLDB_INVALID_REGNUM;
-                }
-            }
-
-            if (kind == eRegisterKindGCC || kind == eRegisterKindDWARF)
-            {
-                switch (num)
-                {
-                case gcc_dwarf_gpr_rax:  return gpr_rax;
-                case gcc_dwarf_gpr_rdx:  return gpr_rdx;
-                case gcc_dwarf_gpr_rcx:  return gpr_rcx;
-                case gcc_dwarf_gpr_rbx:  return gpr_rbx;
-                case gcc_dwarf_gpr_rsi:  return gpr_rsi;
-                case gcc_dwarf_gpr_rdi:  return gpr_rdi;
-                case gcc_dwarf_gpr_rbp:  return gpr_rbp;
-                case gcc_dwarf_gpr_rsp:  return gpr_rsp;
-                case gcc_dwarf_gpr_r8:   return gpr_r8;
-                case gcc_dwarf_gpr_r9:   return gpr_r9;
-                case gcc_dwarf_gpr_r10:  return gpr_r10;
-                case gcc_dwarf_gpr_r11:  return gpr_r11;
-                case gcc_dwarf_gpr_r12:  return gpr_r12;
-                case gcc_dwarf_gpr_r13:  return gpr_r13;
-                case gcc_dwarf_gpr_r14:  return gpr_r14;
-                case gcc_dwarf_gpr_r15:  return gpr_r15;
-                case gcc_dwarf_gpr_rip:  return gpr_rip;
-                case gcc_dwarf_fpu_xmm0: return fpu_xmm0;
-                case gcc_dwarf_fpu_xmm1: return fpu_xmm1;
-                case gcc_dwarf_fpu_xmm2: return fpu_xmm2;
-                case gcc_dwarf_fpu_xmm3: return fpu_xmm3;
-                case gcc_dwarf_fpu_xmm4: return fpu_xmm4;
-                case gcc_dwarf_fpu_xmm5: return fpu_xmm5;
-                case gcc_dwarf_fpu_xmm6: return fpu_xmm6;
-                case gcc_dwarf_fpu_xmm7: return fpu_xmm7;
-                case gcc_dwarf_fpu_xmm8: return fpu_xmm8;
-                case gcc_dwarf_fpu_xmm9: return fpu_xmm9;
-                case gcc_dwarf_fpu_xmm10: return fpu_xmm10;
-                case gcc_dwarf_fpu_xmm11: return fpu_xmm11;
-                case gcc_dwarf_fpu_xmm12: return fpu_xmm12;
-                case gcc_dwarf_fpu_xmm13: return fpu_xmm13;
-                case gcc_dwarf_fpu_xmm14: return fpu_xmm14;
-                case gcc_dwarf_fpu_xmm15: return fpu_xmm15;
-                case gcc_dwarf_fpu_stmm0: return fpu_stmm0;
-                case gcc_dwarf_fpu_stmm1: return fpu_stmm1;
-                case gcc_dwarf_fpu_stmm2: return fpu_stmm2;
-                case gcc_dwarf_fpu_stmm3: return fpu_stmm3;
-                case gcc_dwarf_fpu_stmm4: return fpu_stmm4;
-                case gcc_dwarf_fpu_stmm5: return fpu_stmm5;
-                case gcc_dwarf_fpu_stmm6: return fpu_stmm6;
-                case gcc_dwarf_fpu_stmm7: return fpu_stmm7;
-                case gcc_dwarf_fpu_ymm0: return fpu_ymm0;
-                case gcc_dwarf_fpu_ymm1: return fpu_ymm1;
-                case gcc_dwarf_fpu_ymm2: return fpu_ymm2;
-                case gcc_dwarf_fpu_ymm3: return fpu_ymm3;
-                case gcc_dwarf_fpu_ymm4: return fpu_ymm4;
-                case gcc_dwarf_fpu_ymm5: return fpu_ymm5;
-                case gcc_dwarf_fpu_ymm6: return fpu_ymm6;
-                case gcc_dwarf_fpu_ymm7: return fpu_ymm7;
-                case gcc_dwarf_fpu_ymm8: return fpu_ymm8;
-                case gcc_dwarf_fpu_ymm9: return fpu_ymm9;
-                case gcc_dwarf_fpu_ymm10: return fpu_ymm10;
-                case gcc_dwarf_fpu_ymm11: return fpu_ymm11;
-                case gcc_dwarf_fpu_ymm12: return fpu_ymm12;
-                case gcc_dwarf_fpu_ymm13: return fpu_ymm13;
-                case gcc_dwarf_fpu_ymm14: return fpu_ymm14;
-                case gcc_dwarf_fpu_ymm15: return fpu_ymm15;
-                default:
-                    return LLDB_INVALID_REGNUM;
-                }
-            }
-
-            if (kind == eRegisterKindGDB)
-            {
-                switch (num)
-                {
-                case gdb_gpr_rax     : return gpr_rax;
-                case gdb_gpr_rbx     : return gpr_rbx;
-                case gdb_gpr_rcx     : return gpr_rcx;
-                case gdb_gpr_rdx     : return gpr_rdx;
-                case gdb_gpr_rsi     : return gpr_rsi;
-                case gdb_gpr_rdi     : return gpr_rdi;
-                case gdb_gpr_rbp     : return gpr_rbp;
-                case gdb_gpr_rsp     : return gpr_rsp;
-                case gdb_gpr_r8      : return gpr_r8;
-                case gdb_gpr_r9      : return gpr_r9;
-                case gdb_gpr_r10     : return gpr_r10;
-                case gdb_gpr_r11     : return gpr_r11;
-                case gdb_gpr_r12     : return gpr_r12;
-                case gdb_gpr_r13     : return gpr_r13;
-                case gdb_gpr_r14     : return gpr_r14;
-                case gdb_gpr_r15     : return gpr_r15;
-                case gdb_gpr_rip     : return gpr_rip;
-                case gdb_gpr_rflags  : return gpr_rflags;
-                case gdb_gpr_cs      : return gpr_cs;
-                case gdb_gpr_ss      : return gpr_ss;
-                case gdb_gpr_ds      : return gpr_ds;
-                case gdb_gpr_es      : return gpr_es;
-                case gdb_gpr_fs      : return gpr_fs;
-                case gdb_gpr_gs      : return gpr_gs;
-                case gdb_fpu_stmm0   : return fpu_stmm0;
-                case gdb_fpu_stmm1   : return fpu_stmm1;
-                case gdb_fpu_stmm2   : return fpu_stmm2;
-                case gdb_fpu_stmm3   : return fpu_stmm3;
-                case gdb_fpu_stmm4   : return fpu_stmm4;
-                case gdb_fpu_stmm5   : return fpu_stmm5;
-                case gdb_fpu_stmm6   : return fpu_stmm6;
-                case gdb_fpu_stmm7   : return fpu_stmm7;
-                case gdb_fpu_fcw     : return fpu_fcw;
-                case gdb_fpu_fsw     : return fpu_fsw;
-                case gdb_fpu_ftw     : return fpu_ftw;
-                case gdb_fpu_cs_64   : return fpu_cs;
-                case gdb_fpu_ip      : return fpu_ip;
-                case gdb_fpu_ds_64   : return fpu_ds;
-                case gdb_fpu_dp      : return fpu_dp;
-                case gdb_fpu_fop     : return fpu_fop;
-                case gdb_fpu_xmm0    : return fpu_xmm0;
-                case gdb_fpu_xmm1    : return fpu_xmm1;
-                case gdb_fpu_xmm2    : return fpu_xmm2;
-                case gdb_fpu_xmm3    : return fpu_xmm3;
-                case gdb_fpu_xmm4    : return fpu_xmm4;
-                case gdb_fpu_xmm5    : return fpu_xmm5;
-                case gdb_fpu_xmm6    : return fpu_xmm6;
-                case gdb_fpu_xmm7    : return fpu_xmm7;
-                case gdb_fpu_xmm8    : return fpu_xmm8;
-                case gdb_fpu_xmm9    : return fpu_xmm9;
-                case gdb_fpu_xmm10   : return fpu_xmm10;
-                case gdb_fpu_xmm11   : return fpu_xmm11;
-                case gdb_fpu_xmm12   : return fpu_xmm12;
-                case gdb_fpu_xmm13   : return fpu_xmm13;
-                case gdb_fpu_xmm14   : return fpu_xmm14;
-                case gdb_fpu_xmm15   : return fpu_xmm15;
-                case gdb_fpu_mxcsr   : return fpu_mxcsr;
-                case gdb_fpu_ymm0    : return fpu_ymm0;
-                case gdb_fpu_ymm1    : return fpu_ymm1;
-                case gdb_fpu_ymm2    : return fpu_ymm2;
-                case gdb_fpu_ymm3    : return fpu_ymm3;
-                case gdb_fpu_ymm4    : return fpu_ymm4;
-                case gdb_fpu_ymm5    : return fpu_ymm5;
-                case gdb_fpu_ymm6    : return fpu_ymm6;
-                case gdb_fpu_ymm7    : return fpu_ymm7;
-                case gdb_fpu_ymm8    : return fpu_ymm8;
-                case gdb_fpu_ymm9    : return fpu_ymm9;
-                case gdb_fpu_ymm10   : return fpu_ymm10;
-                case gdb_fpu_ymm11   : return fpu_ymm11;
-                case gdb_fpu_ymm12   : return fpu_ymm12;
-                case gdb_fpu_ymm13   : return fpu_ymm13;
-                case gdb_fpu_ymm14   : return fpu_ymm14;
-                case gdb_fpu_ymm15   : return fpu_ymm15;
-                default:
-                    return LLDB_INVALID_REGNUM;
-                }
-            }
-            else if (kind == eRegisterKindLLDB)
-            {
-                return num;
-            }
-        }
-        }
-    }
-
-    return LLDB_INVALID_REGNUM;
-}
-
-uint32_t
-RegisterContext_x86_64::NumSupportedHardwareWatchpoints()
-{
-    // Available debug address registers: dr0, dr1, dr2, dr3
-    return 4;
-}
-
-bool
-RegisterContext_x86_64::IsWatchpointVacant(uint32_t hw_index)
-{
-    bool is_vacant = false;
-    RegisterValue value;
-
-    assert(hw_index < NumSupportedHardwareWatchpoints());
-
-    if (m_watchpoints_initialized == false)
-    {
-        // Reset the debug status and debug control registers
-        RegisterValue zero_bits = RegisterValue(uint64_t(0));
-        if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
-            assert(false && "Could not initialize watchpoint registers");
-        m_watchpoints_initialized = true;
-    }
-
-    if (ReadRegister(dr7, value))
-    {
-        uint64_t val = value.GetAsUInt64();
-        is_vacant = (val & (3 << 2*hw_index)) == 0;
-    }
-
-    return is_vacant;
-}
-
-static uint32_t
-size_and_rw_bits(size_t size, bool read, bool write)
-{
-    uint32_t rw;
-    if (read) {
-        rw = 0x3; // READ or READ/WRITE
-    } else if (write) {
-        rw = 0x1; // WRITE
-    } else {
-        assert(0 && "read and write cannot both be false");
-    }
-
-    switch (size) {
-    case 1:
-        return rw;
-    case 2:
-        return (0x1 << 2) | rw;
-    case 4:
-        return (0x3 << 2) | rw;
-    case 8:
-        return (0x2 << 2) | rw;
-    default:
-        assert(0 && "invalid size, must be one of 1, 2, 4, or 8");
-    }
-}
-
-uint32_t
-RegisterContext_x86_64::SetHardwareWatchpoint(addr_t addr, size_t size,
-                                              bool read, bool write)
-{
-    const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
-    uint32_t hw_index;
-
-    for (hw_index = 0; hw_index < num_hw_watchpoints; ++hw_index)
-    {
-        if (IsWatchpointVacant(hw_index))
-            return SetHardwareWatchpointWithIndex(addr, size,
-                                                  read, write,
-                                                  hw_index);
-    }
-
-    return LLDB_INVALID_INDEX32;
-}
-
-bool
-RegisterContext_x86_64::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,
-                                                       bool read, bool write,
-                                                       uint32_t hw_index)
-{
-    const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
-
-    if (num_hw_watchpoints == 0 || hw_index >= num_hw_watchpoints)
-        return false;
-
-    if (!(size == 1 || size == 2 || size == 4 || size == 8))
-        return false;
-
-    if (read == false && write == false)
-        return false;
-
-    if (!IsWatchpointVacant(hw_index))
-        return false;
-
-    // Set both dr7 (debug control register) and dri (debug address register).
-
-    // dr7{7-0} encodes the local/gloabl enable bits:
-    //  global enable --. .-- local enable
-    //                  | |
-    //                  v v
-    //      dr0 -> bits{1-0}
-    //      dr1 -> bits{3-2}
-    //      dr2 -> bits{5-4}
-    //      dr3 -> bits{7-6}
-    //
-    // dr7{31-16} encodes the rw/len bits:
-    //  b_x+3, b_x+2, b_x+1, b_x
-    //      where bits{x+1, x} => rw
-    //            0b00: execute, 0b01: write, 0b11: read-or-write,
-    //            0b10: io read-or-write (unused)
-    //      and bits{x+3, x+2} => len
-    //            0b00: 1-byte, 0b01: 2-byte, 0b11: 4-byte, 0b10: 8-byte
-    //
-    //      dr0 -> bits{19-16}
-    //      dr1 -> bits{23-20}
-    //      dr2 -> bits{27-24}
-    //      dr3 -> bits{31-28}
-    if (hw_index < num_hw_watchpoints)
-    {
-        RegisterValue current_dr7_bits;
-
-        if (ReadRegister(dr7, current_dr7_bits))
-        {
-            uint64_t new_dr7_bits = current_dr7_bits.GetAsUInt64() |
-                                    (1 << (2*hw_index) |
-                                    size_and_rw_bits(size, read, write) <<
-                                    (16+4*hw_index));
-
-            if (WriteRegister(dr0 + hw_index, RegisterValue(addr)) &&
-                WriteRegister(dr7, RegisterValue(new_dr7_bits)))
-                return true;
-        }
-    }
-
-    return false;
-}
-
-bool
-RegisterContext_x86_64::ClearHardwareWatchpoint(uint32_t hw_index)
-{
-    if (hw_index < NumSupportedHardwareWatchpoints())
-    {
-        RegisterValue current_dr7_bits;
-
-        if (ReadRegister(dr7, current_dr7_bits))
-        {
-            uint64_t new_dr7_bits = current_dr7_bits.GetAsUInt64() & ~(3 << (2*hw_index));
-
-            if (WriteRegister(dr7, RegisterValue(new_dr7_bits)))
-                return true;
-        }
-    }
-
-    return false;
-}
-
-bool
-RegisterContext_x86_64::IsWatchpointHit(uint32_t hw_index)
-{
-    bool is_hit = false;
-
-    if (m_watchpoints_initialized == false)
-    {
-        // Reset the debug status and debug control registers
-        RegisterValue zero_bits = RegisterValue(uint64_t(0));
-        if (!WriteRegister(dr6, zero_bits) || !WriteRegister(dr7, zero_bits))
-            assert(false && "Could not initialize watchpoint registers");
-        m_watchpoints_initialized = true;
-    }
-
-    if (hw_index < NumSupportedHardwareWatchpoints())
-    {
-        RegisterValue value;
-
-        if (ReadRegister(dr6, value))
-        {
-            uint64_t val = value.GetAsUInt64();
-            is_hit = val & (1 << hw_index);
-        }
-    }
-
-    return is_hit;
-}
-
-addr_t
-RegisterContext_x86_64::GetWatchpointAddress(uint32_t hw_index)
-{
-    addr_t wp_monitor_addr = LLDB_INVALID_ADDRESS;
-
-    if (hw_index < NumSupportedHardwareWatchpoints())
-    {
-        if (!IsWatchpointVacant(hw_index))
-        {
-            RegisterValue value;
-
-            if (ReadRegister(dr0 + hw_index, value))
-                wp_monitor_addr = value.GetAsUInt64();
-        }
-    }
-
-    return wp_monitor_addr;
-}
-
-
-bool
-RegisterContext_x86_64::ClearWatchpointHits()
-{
-    return WriteRegister(dr6, RegisterValue((uint64_t)0));
-}
-
-bool
-RegisterContext_x86_64::HardwareSingleStep(bool enable)
-{
-    enum { TRACE_BIT = 0x100 };
-    uint64_t rflags;
-
-    if ((rflags = ReadRegisterAsUnsigned(gpr_rflags, -1UL)) == -1UL)
-        return false;
-    
-    if (enable)
-    {
-        if (rflags & TRACE_BIT)
-            return true;
-
-        rflags |= TRACE_BIT;
-    }
-    else
-    {
-        if (!(rflags & TRACE_BIT))
-            return false;
-
-        rflags &= ~TRACE_BIT;
-    }
-
-    return WriteRegisterFromUnsigned(gpr_rflags, rflags);
-}
-
-#if defined(__linux__) or defined(__FreeBSD__)
-
-ProcessMonitor &
-RegisterContext_x86_64::GetMonitor()
-{
-    ProcessSP base = CalculateProcess();
-    ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());
-    return process->GetMonitor();
-}
-
-bool
-RegisterContext_x86_64::ReadGPR()
-{
-     ProcessMonitor &monitor = GetMonitor();
-     return monitor.ReadGPR(m_thread.GetID(), &m_gpr, GetGPRSize());
-}
-
-bool
-RegisterContext_x86_64::ReadFPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    if (m_fpr_type == eFXSAVE)
-        return monitor.ReadFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-
-    if (m_fpr_type == eXSAVE)
-        return monitor.ReadRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteGPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.WriteGPR(m_thread.GetID(), &m_gpr, GetGPRSize());
-}
-
-bool
-RegisterContext_x86_64::WriteFPR()
-{
-    ProcessMonitor &monitor = GetMonitor();
-    if (m_fpr_type == eFXSAVE)
-        return monitor.WriteFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-
-    if (m_fpr_type == eXSAVE)
-        return monitor.WriteRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
-    return false;
-}
-
-bool
-RegisterContext_x86_64::ReadRegister(const unsigned reg,
-                                     RegisterValue &value)
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.ReadRegisterValue(m_thread.GetID(),
-                                     GetRegisterOffset(reg),
-                                     GetRegisterName(reg),
-                                     GetRegisterSize(reg),
-                                     value);
-}
-
-bool
-RegisterContext_x86_64::WriteRegister(const unsigned reg,
-                                      const RegisterValue &value)
-{
-    ProcessMonitor &monitor = GetMonitor();
-    return monitor.WriteRegisterValue(m_thread.GetID(),
-                                      GetRegisterOffset(reg),
-                                      GetRegisterName(reg),
-                                      value);
-}
-
-#else
-
-bool
-RegisterContext_x86_64::ReadGPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::ReadFPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteGPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteFPR()
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::ReadRegister(const unsigned reg,
-                                     RegisterValue &value)
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-bool
-RegisterContext_x86_64::WriteRegister(const unsigned reg,
-                                      const RegisterValue &value)
-{
-    llvm_unreachable("not implemented");
-    return false;
-}
-
-#endif
Index: source/Plugins/Process/POSIX/RegisterContext_x86_64.h
===================================================================
--- source/Plugins/Process/POSIX/RegisterContext_x86_64.h
+++ source/Plugins/Process/POSIX/RegisterContext_x86_64.h
@@ -1,347 +0,0 @@
-//===-- RegisterContext_x86_64.h ---------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_RegisterContext_x86_64_H_
-#define liblldb_RegisterContext_x86_64_H_
-
-#include "lldb/Core/Log.h"
-#include "RegisterContextPOSIX.h"
-
-class ProcessMonitor;
-
-// Internal codes for all x86_64 registers.
-enum
-{
-    k_first_gpr,
-    gpr_rax = k_first_gpr,
-    gpr_rbx,
-    gpr_rcx,
-    gpr_rdx,
-    gpr_rdi,
-    gpr_rsi,
-    gpr_rbp,
-    gpr_rsp,
-    gpr_r8,
-    gpr_r9,
-    gpr_r10,
-    gpr_r11,
-    gpr_r12,
-    gpr_r13,
-    gpr_r14,
-    gpr_r15,
-    gpr_rip,
-    gpr_rflags,
-    gpr_cs,
-    gpr_fs,
-    gpr_gs,
-    gpr_ss,
-    gpr_ds,
-    gpr_es,
-    k_first_i386,
-    gpr_eax = k_first_i386,
-    gpr_ebx,
-    gpr_ecx,
-    gpr_edx,
-    gpr_edi,
-    gpr_esi,
-    gpr_ebp,
-    gpr_esp,
-    gpr_eip,
-    gpr_eflags, // eRegisterKindLLDB == 33
-    k_last_i386 = gpr_eflags,
-    k_last_gpr = gpr_eflags,
-
-    k_first_fpr,
-    fpu_fcw = k_first_fpr,
-    fpu_fsw,
-    fpu_ftw,
-    fpu_fop,
-    fpu_ip,
-    fpu_cs,
-    fpu_dp,
-    fpu_ds,
-    fpu_mxcsr,
-    fpu_mxcsrmask,
-    fpu_stmm0,
-    fpu_stmm1,
-    fpu_stmm2,
-    fpu_stmm3,
-    fpu_stmm4,
-    fpu_stmm5,
-    fpu_stmm6,
-    fpu_stmm7,
-    fpu_xmm0,
-    fpu_xmm1,
-    fpu_xmm2,
-    fpu_xmm3,
-    fpu_xmm4,
-    fpu_xmm5,
-    fpu_xmm6,
-    fpu_xmm7,
-    fpu_xmm8,
-    fpu_xmm9,
-    fpu_xmm10,
-    fpu_xmm11,
-    fpu_xmm12,
-    fpu_xmm13,
-    fpu_xmm14,
-    fpu_xmm15,
-    k_last_fpr = fpu_xmm15,
-    k_first_avx,
-    fpu_ymm0 = k_first_avx,
-    fpu_ymm1,
-    fpu_ymm2,
-    fpu_ymm3,
-    fpu_ymm4,
-    fpu_ymm5,
-    fpu_ymm6,
-    fpu_ymm7,
-    fpu_ymm8,
-    fpu_ymm9,
-    fpu_ymm10,
-    fpu_ymm11,
-    fpu_ymm12,
-    fpu_ymm13,
-    fpu_ymm14,
-    fpu_ymm15,
-    k_last_avx = fpu_ymm15,
-
-    dr0,
-    dr1,
-    dr2,
-    dr3,
-    dr4,
-    dr5,
-    dr6,
-    dr7,
-
-    k_num_registers,
-    k_num_gpr_registers = k_last_gpr - k_first_gpr + 1,
-    k_num_fpr_registers = k_last_fpr - k_first_fpr + 1,
-    k_num_avx_registers = k_last_avx - k_first_avx + 1
-};
-
-class RegisterContext_x86_64
-  : public RegisterContextPOSIX
-{
-public:
-    RegisterContext_x86_64 (lldb_private::Thread &thread,
-                            uint32_t concrete_frame_idx);
-
-    ~RegisterContext_x86_64();
-
-    void
-    Invalidate();
-
-    void
-    InvalidateAllRegisters();
-
-    size_t
-    GetRegisterCount();
-
-    virtual size_t
-    GetGPRSize() = 0;
-
-    virtual unsigned
-    GetRegisterSize(unsigned reg);
-
-    virtual unsigned
-    GetRegisterOffset(unsigned reg);
-
-    const lldb_private::RegisterInfo *
-    GetRegisterInfoAtIndex(size_t reg);
-
-    size_t
-    GetRegisterSetCount();
-
-    const lldb_private::RegisterSet *
-    GetRegisterSet(size_t set);
-
-    unsigned
-    GetRegisterIndexFromOffset(unsigned offset);
-
-    const char *
-    GetRegisterName(unsigned reg);
-
-    virtual bool
-    ReadRegister(const lldb_private::RegisterInfo *reg_info,
-                 lldb_private::RegisterValue &value);
-
-    bool
-    ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
-
-    virtual bool
-    WriteRegister(const lldb_private::RegisterInfo *reg_info,
-                  const lldb_private::RegisterValue &value);
-
-    bool
-    WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
-
-    uint32_t
-    ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num);
-
-    uint32_t
-    NumSupportedHardwareWatchpoints();
-
-    uint32_t
-    SetHardwareWatchpoint(lldb::addr_t, size_t size, bool read, bool write);
-
-    bool
-    SetHardwareWatchpointWithIndex(lldb::addr_t, size_t size, bool read,
-                                   bool write, uint32_t hw_index);
-
-    bool
-    ClearHardwareWatchpoint(uint32_t hw_index);
-
-    bool
-    HardwareSingleStep(bool enable);
-
-    bool
-    UpdateAfterBreakpoint();
-
-    bool
-    IsWatchpointVacant(uint32_t hw_index);
-
-    bool
-    IsWatchpointHit (uint32_t hw_index);
-
-    lldb::addr_t
-    GetWatchpointAddress (uint32_t hw_index);
-
-    bool
-    ClearWatchpointHits();
-
-    //---------------------------------------------------------------------------
-    // Generic floating-point registers
-    //---------------------------------------------------------------------------
-
-    struct MMSReg
-    {
-        uint8_t bytes[10];
-        uint8_t pad[6];
-    };
-
-    struct XMMReg
-    {
-        uint8_t bytes[16]; // 128-bits for each XMM register
-    };
-
-    struct FXSAVE
-    {
-        uint16_t fcw;
-        uint16_t fsw;
-        uint16_t ftw;
-        uint16_t fop;
-        uint64_t ip;
-        uint64_t dp;
-        uint32_t mxcsr;
-        uint32_t mxcsrmask;
-        MMSReg   stmm[8];
-        XMMReg   xmm[16];
-        uint32_t padding[24];
-    };
-
-    //---------------------------------------------------------------------------
-    // Extended floating-point registers
-    //---------------------------------------------------------------------------
-    struct YMMHReg
-    {
-        uint8_t  bytes[16];     // 16 * 8 bits for the high bytes of each YMM register
-    };
-
-    struct YMMReg
-    {
-        uint8_t  bytes[32];     // 16 * 16 bits for each YMM register
-    };
-
-    struct YMM
-    {
-        YMMReg   ymm[16];       // assembled from ymmh and xmm registers
-    };
-
-    struct XSAVE_HDR
-    {
-        uint64_t  xstate_bv;    // OS enabled xstate mask to determine the extended states supported by the processor
-        uint64_t  reserved1[2];
-        uint64_t  reserved2[5];
-    } __attribute__((packed));
-
-    // x86 extensions to FXSAVE (i.e. for AVX processors) 
-    struct XSAVE 
-    {
-        FXSAVE    i387;         // floating point registers typical in i387_fxsave_struct
-        XSAVE_HDR header;       // The xsave_hdr_struct can be used to determine if the following extensions are usable
-        YMMHReg   ymmh[16];     // High 16 bytes of each of 16 YMM registers (the low bytes are in FXSAVE.xmm for compatibility with SSE)
-        // Slot any extensions to the register file here
-    } __attribute__((packed, aligned (64)));
-
-    struct IOVEC
-    {
-        void    *iov_base;      // pointer to XSAVE
-        size_t   iov_len;       // sizeof(XSAVE)
-    };
-
-    //---------------------------------------------------------------------------
-    // Note: prefer kernel definitions over user-land
-    //---------------------------------------------------------------------------
-    enum FPRType
-    {
-        eNotValid = 0,
-        eFSAVE,  // TODO
-        eFXSAVE,
-        eSOFT,   // TODO
-        eXSAVE
-    };
-
-    // Floating-point registers
-    struct FPR
-    {
-        // Thread state for the floating-point unit of the processor read by ptrace.
-        union XSTATE {
-            FXSAVE   fxsave;    // Generic floating-point registers.
-            XSAVE    xsave;     // x86 extended processor state.
-        } xstate;
-    };
-
-protected:
-    // Determines if an extended register set is supported on the processor running the inferior process.
-    virtual bool
-    IsRegisterSetAvailable(size_t set_index);
-
-    virtual const lldb_private::RegisterInfo *
-    GetRegisterInfo();
-
-    virtual bool
-    ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
-
-    virtual bool
-    WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value);
-
-private:
-    uint64_t m_gpr[k_num_gpr_registers]; // general purpose registers.
-    FPRType  m_fpr_type;                 // determines the type of data stored by union FPR, if any.
-    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.
-
-    ProcessMonitor &GetMonitor();
-    lldb::ByteOrder GetByteOrder();
-
-    bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order);
-    bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);
-    bool IsFPR(unsigned reg, FPRType fpr_type);
-
-    bool ReadGPR();
-    bool ReadFPR();
-
-    bool WriteGPR();
-    bool WriteFPR();
-};
-
-#endif // #ifndef liblldb_RegisterContext_x86_64_H_
Index: source/Plugins/Process/elf-core/CMakeLists.txt
===================================================================
--- source/Plugins/Process/elf-core/CMakeLists.txt
+++ source/Plugins/Process/elf-core/CMakeLists.txt
@@ -5,6 +5,5 @@
 add_lldb_library(lldbPluginProcessElfCore
   ProcessElfCore.cpp
   ThreadElfCore.cpp
-  RegisterContextCoreLinux_x86_64.cpp
-  RegisterContextCoreFreeBSD_x86_64.cpp
+  RegisterContextPOSIXCore_x86_64.cpp
   )
Index: source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.cpp
===================================================================
--- source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//===-- RegisterContextCoreFreeBSD_x86_64.cpp -------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/RegisterValue.h"
-#include "lldb/Target/Thread.h"
-#include "RegisterContextCoreFreeBSD_x86_64.h"
-
-using namespace lldb_private;
-
-RegisterContextCoreFreeBSD_x86_64::RegisterContextCoreFreeBSD_x86_64(Thread &thread,
-                        const DataExtractor &gpregset, const DataExtractor &fpregset)
-    : RegisterContextFreeBSD_x86_64(thread, 0)
-{
-    size_t size, len;
-
-    size = GetGPRSize();
-    m_gpregset = new uint8_t[size];
-    len = gpregset.ExtractBytes(0, size, lldb::eByteOrderLittle, m_gpregset);
-    assert(len == size);
-}
-
-RegisterContextCoreFreeBSD_x86_64::~RegisterContextCoreFreeBSD_x86_64()
-{
-    delete [] m_gpregset;
-}
-
-bool
-RegisterContextCoreFreeBSD_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
-{
-    value = *(uint64_t *)(m_gpregset + reg_info->byte_offset);
-    return true;
-}
-
-bool
-RegisterContextCoreFreeBSD_x86_64::ReadAllRegisterValues(lldb::DataBufferSP &data_sp)
-{
-    return false;
-}
-
-bool
-RegisterContextCoreFreeBSD_x86_64::WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value)
-{
-    return false;
-}
-
-bool
-RegisterContextCoreFreeBSD_x86_64::WriteAllRegisterValues(const lldb::DataBufferSP &data_sp)
-{
-    return false;
-}
-
-bool
-RegisterContextCoreFreeBSD_x86_64::UpdateAfterBreakpoint()
-{
-    return false;
-}
-
-bool
-RegisterContextCoreFreeBSD_x86_64::HardwareSingleStep(bool enable)
-{
-    return false;
-}
-
Index: source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.h
===================================================================
--- source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.h
+++ /dev/null
@@ -1,45 +0,0 @@
-//===-- RegisterContextCoreFreeBSD_x86_64.h ----------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef liblldb_RegisterContextCoreFreeBSD_x86_64_H_
-#define liblldb_RegisterContextCoreFreeBSD_x86_64_H_
-
-#include "Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h"
-
-class RegisterContextCoreFreeBSD_x86_64: public RegisterContextFreeBSD_x86_64
-{
-public:
-    RegisterContextCoreFreeBSD_x86_64 (lldb_private::Thread &thread, const lldb_private::DataExtractor &gpregset,
-                                       const lldb_private::DataExtractor &fpregset);
-
-    ~RegisterContextCoreFreeBSD_x86_64();
-
-    virtual bool
-    ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value);
-
-    bool
-    ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
-
-    virtual bool
-    WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value);
-
-    bool
-    WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
-
-    bool
-    HardwareSingleStep(bool enable);
-
-    bool
-    UpdateAfterBreakpoint();
-
-private:
-    uint8_t *m_gpregset;
-};
-
-#endif // #ifndef liblldb_RegisterContextCoreFreeBSD_x86_64_H_
Index: source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp
===================================================================
--- source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp
+++ source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp
@@ -1,70 +0,0 @@
-//===-- RegisterContextCoreLinux_x86_64.cpp -------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/RegisterValue.h"
-#include "lldb/Target/Thread.h"
-#include "RegisterContextCoreLinux_x86_64.h"
-
-using namespace lldb_private;
-
-RegisterContextCoreLinux_x86_64::RegisterContextCoreLinux_x86_64(Thread &thread,
-                                                const DataExtractor &gpregset,
-                                                const DataExtractor &fpregset)
-    : RegisterContextLinux_x86_64(thread, 0)
-{
-    size_t size, len;
-
-    size = GetGPRSize();
-    m_gpregset = new uint8_t[size];
-    len = gpregset.ExtractBytes(0, size, lldb::eByteOrderLittle, m_gpregset);
-    assert(len == size);
-}
-
-RegisterContextCoreLinux_x86_64::~RegisterContextCoreLinux_x86_64()
-{
-    delete [] m_gpregset;
-}
-
-bool
-RegisterContextCoreLinux_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
-{
-    value = *(uint64_t *)(m_gpregset + reg_info->byte_offset);
-    return true;
-}
-
-bool
-RegisterContextCoreLinux_x86_64::ReadAllRegisterValues(lldb::DataBufferSP &data_sp)
-{
-    return false;
-}
-
-bool
-RegisterContextCoreLinux_x86_64::WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value)
-{
-    return false;
-}
-
-bool
-RegisterContextCoreLinux_x86_64::WriteAllRegisterValues(const lldb::DataBufferSP &data_sp)
-{
-    return false;
-}
-
-bool
-RegisterContextCoreLinux_x86_64::UpdateAfterBreakpoint()
-{
-    return false;
-}
-
-bool
-RegisterContextCoreLinux_x86_64::HardwareSingleStep(bool enable)
-{
-    return false;
-}
Index: source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h
===================================================================
--- source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h
+++ source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h
@@ -1,52 +0,0 @@
-//===-- RegisterContextCoreLinux_x86_64.h ----------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-
-#ifndef liblldb_RegisterContextCoreLinux_x86_64_H_
-#define liblldb_RegisterContextCoreLinux_x86_64_H_
-
-#include "Plugins/Process/POSIX/RegisterContextLinux_x86_64.h"
-
-class RegisterContextCoreLinux_x86_64: public RegisterContextLinux_x86_64
-{
-public:
-    RegisterContextCoreLinux_x86_64 (lldb_private::Thread &thread, const lldb_private::DataExtractor &gpregset,
-                                     const lldb_private::DataExtractor &fpregset);
-
-    ~RegisterContextCoreLinux_x86_64();
-
-    virtual bool
-    ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value);
-
-    bool
-    ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
-
-    virtual bool
-    WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value);
-
-    bool
-    WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
-
-    bool
-    HardwareSingleStep(bool enable);
-
-    bool
-    UpdateAfterBreakpoint();
-
-protected:
-    bool
-    ReadFPR()
-    {
-        assert(0);
-    }
-
-private:
-    uint8_t *m_gpregset;
-};
-
-#endif // #ifndef liblldb_RegisterContextCoreLinux_x86_64_H_
Index: source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
===================================================================
--- source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
+++ source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
@@ -1,4 +1,4 @@
-//===-- RegisterContextCoreLinux_x86_64.cpp -------------------------*- C++ -*-===//
+//===-- RegisterContextCorePOSIX_x86_64.cpp -------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -10,14 +10,16 @@
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/RegisterValue.h"
 #include "lldb/Target/Thread.h"
-#include "RegisterContextCoreLinux_x86_64.h"
+#include "RegisterContextPOSIX.h"
+#include "RegisterContextPOSIXCore_x86_64.h"
 
 using namespace lldb_private;
 
-RegisterContextCoreLinux_x86_64::RegisterContextCoreLinux_x86_64(Thread &thread,
-                                                const DataExtractor &gpregset,
-                                                const DataExtractor &fpregset)
-    : RegisterContextLinux_x86_64(thread, 0)
+RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(Thread &thread,
+                                                                 RegisterInfoInterface *register_info,
+                                                                 const DataExtractor &gpregset,
+                                                                 const DataExtractor &fpregset)
+    : RegisterContextPOSIX_x86_64(thread, 0, register_info)
 {
     size_t size, len;
 
@@ -27,44 +29,70 @@
     assert(len == size);
 }
 
-RegisterContextCoreLinux_x86_64::~RegisterContextCoreLinux_x86_64()
+RegisterContextCorePOSIX_x86_64::~RegisterContextCorePOSIX_x86_64()
 {
     delete [] m_gpregset;
 }
 
 bool
-RegisterContextCoreLinux_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
+RegisterContextCorePOSIX_x86_64::ReadGPR()
+{
+    return m_gpregset != NULL;
+}
+
+bool
+RegisterContextCorePOSIX_x86_64::ReadFPR()
+{
+    return false;
+}
+
+bool
+RegisterContextCorePOSIX_x86_64::WriteGPR()
+{
+    assert(0);
+    return false;
+}
+
+bool
+RegisterContextCorePOSIX_x86_64::WriteFPR()
+{
+    assert(0);
+    return false;
+}
+
+bool
+RegisterContextCorePOSIX_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
 {
     value = *(uint64_t *)(m_gpregset + reg_info->byte_offset);
     return true;
 }
 
 bool
-RegisterContextCoreLinux_x86_64::ReadAllRegisterValues(lldb::DataBufferSP &data_sp)
+RegisterContextCorePOSIX_x86_64::ReadAllRegisterValues(lldb::DataBufferSP &data_sp)
 {
     return false;
 }
 
 bool
-RegisterContextCoreLinux_x86_64::WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value)
+RegisterContextCorePOSIX_x86_64::WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value)
 {
     return false;
 }
 
 bool
-RegisterContextCoreLinux_x86_64::WriteAllRegisterValues(const lldb::DataBufferSP &data_sp)
+RegisterContextCorePOSIX_x86_64::WriteAllRegisterValues(const lldb::DataBufferSP &data_sp)
 {
     return false;
 }
 
 bool
-RegisterContextCoreLinux_x86_64::UpdateAfterBreakpoint()
+RegisterContextCorePOSIX_x86_64::UpdateAfterBreakpoint()
 {
     return false;
 }
 
 bool
-RegisterContextCoreLinux_x86_64::HardwareSingleStep(bool enable)
+RegisterContextCorePOSIX_x86_64::HardwareSingleStep(bool enable)
 {
     return false;
 }
Index: source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
===================================================================
--- source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
+++ source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
@@ -1,24 +1,27 @@
-//===-- RegisterContextCoreLinux_x86_64.h ----------------------*- C++ -*-===//
+//===-- RegisterContextCorePOSIX_x86_64.h ----------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===---------------------------------------------------------------------===//
 
-#ifndef liblldb_RegisterContextCoreLinux_x86_64_H_
-#define liblldb_RegisterContextCoreLinux_x86_64_H_
+#ifndef liblldb_RegisterContextCorePOSIX_x86_64_H_
+#define liblldb_RegisterContextCorePOSIX_x86_64_H_
 
-#include "Plugins/Process/POSIX/RegisterContextLinux_x86_64.h"
+#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h"
 
-class RegisterContextCoreLinux_x86_64: public RegisterContextLinux_x86_64
+class RegisterContextCorePOSIX_x86_64 :
+    public RegisterContextPOSIX_x86_64
 {
 public:
-    RegisterContextCoreLinux_x86_64 (lldb_private::Thread &thread, const lldb_private::DataExtractor &gpregset,
+    RegisterContextCorePOSIX_x86_64 (lldb_private::Thread &thread,
+                                     RegisterInfoInterface *register_info,
+                                     const lldb_private::DataExtractor &gpregset,
                                      const lldb_private::DataExtractor &fpregset);
 
-    ~RegisterContextCoreLinux_x86_64();
+    ~RegisterContextCorePOSIX_x86_64();
 
     virtual bool
     ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value);
@@ -40,13 +43,22 @@
 
 protected:
     bool
-    ReadFPR()
-    {
-        assert(0);
-    }
+    ReadGPR();
+
+    bool
+    ReadFPR();
+
+    bool
+    WriteGPR();
+
+    bool
+    WriteFPR();
+
+    bool ReadRegister(const unsigned reg, lldb_private::RegisterValue &value) { return false; }
+    bool WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value) { return false; }
 
 private:
     uint8_t *m_gpregset;
 };
 
-#endif // #ifndef liblldb_RegisterContextCoreLinux_x86_64_H_
+#endif // #ifndef liblldb_RegisterContextCorePOSIX_x86_64_H_
Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp
===================================================================
--- source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -16,8 +16,9 @@
 
 #include "ThreadElfCore.h"
 #include "ProcessElfCore.h"
-#include "RegisterContextCoreFreeBSD_x86_64.h"
-#include "RegisterContextCoreLinux_x86_64.h"
+#include "RegisterContextLinux_x86_64.h"
+#include "RegisterContextFreeBSD_x86_64.h"
+#include "RegisterContextPOSIXCore_x86_64.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -88,10 +89,10 @@
                 switch (arch.GetTriple().getOS())
                 {
                     case llvm::Triple::FreeBSD:
-                        m_thread_reg_ctx_sp.reset(new RegisterContextCoreFreeBSD_x86_64 (*this, m_gpregset_data, m_fpregset_data));
+                        m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64 (*this, new RegisterContextFreeBSD_x86_64(), m_gpregset_data, m_fpregset_data));
                         break;
                     case llvm::Triple::Linux:
-                        m_thread_reg_ctx_sp.reset(new RegisterContextCoreLinux_x86_64 (*this, m_gpregset_data, m_fpregset_data));
+                        m_thread_reg_ctx_sp.reset(new RegisterContextCorePOSIX_x86_64 (*this, new RegisterContextLinux_x86_64(), m_gpregset_data, m_fpregset_data));
                         break;
                     default:
                         if (log)
