[Lldb-commits] [lldb] r190647 - Cleanup POSIX RegisterContext class hierarchies.
Michael Sartain
mikesart at valvesoftware.com
Fri Sep 13 14:36:45 PDT 2013
> Is this something that you could restore in a separate commit? Thanks,
Definitely. I'm right in the middle of another refactor - I'll send that
out, get feedback, and once that's in I'll fix this up. Hopefully early
next week.
Thanks for looking this over Ashok.
-Mike
On Fri, Sep 13, 2013 at 11:56 AM, Thirumurthi, Ashok <
ashok.thirumurthi at intel.com> wrote:
> Great work on the refactoring, Mike, it's really a solid and thoughtful
> effort and should move us in the direction of loading an ELF core on OS/X.
> Everything looks good and tests well, but I see that you also reinvented
> the container for RegisterInfo:
>
> // Use a singleton function to avoid global constructors in shared
> libraries.
> RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64()
> {
> static std::vector<RegisterInfo> g_register_infos;
> return g_register_infos;
> }
>
> -->
>
> std::vector<lldb_private::RegisterInfo> m_register_infos
>
> The resulting code is very readable and maintainable, which is a great
> asset. I took the same path myself until I realized that the static
> register set is more efficient. Essentially, we frequently create a
> RegisterContext (i.e. each frame of each thread is a candidate), however
> once the architecture is known, the register information can be pinned down
> once for all frames. Hence all the hoops to allow a class hierarchy to use
> a static container.
>
> Is this something that you could restore in a separate commit? Thanks,
>
> - Ashok
>
>
> -----Original Message-----
> From: lldb-commits-bounces at cs.uiuc.edu [mailto:
> lldb-commits-bounces at cs.uiuc.edu] On Behalf Of Michael Sartain
> Sent: Thursday, September 12, 2013 8:18 PM
> To: lldb-commits at cs.uiuc.edu
> Subject: [Lldb-commits] [lldb] r190647 - Cleanup POSIX RegisterContext
> class hierarchies.
>
> Author: mikesart
> Date: Thu Sep 12 19:18:17 2013
> New Revision: 190647
>
> URL: http://llvm.org/viewvc/llvm-project?rev=190647&view=rev
> Log:
> Cleanup POSIX RegisterContext class hierarchies.
>
> Added:
>
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp
>
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h
>
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp
>
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp
> - copied, changed from r190549,
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h
> - copied, changed from r190549,
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
> - copied, changed from r190549,
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h
> - copied, changed from r190549,
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h
>
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
> - copied, changed from r190549,
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp
>
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
> - copied, changed from r190549,
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h
> Removed:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h
>
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.cpp
>
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.h
>
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp
>
> lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h
> Modified:
> lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt
> lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
>
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h
> lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt
> lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp
>
> Modified: lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt?rev=190647&r1=190646&r2=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt Thu Sep 12
> 19:18:17 2013
> @@ -10,8 +10,10 @@ add_lldb_library(lldbPluginProcessPOSIX
> 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
> )
>
> Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=190647&r1=190646&r2=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Thu Sep 12
> 19:18:17 2013
> @@ -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 @@ POSIXThread::GetRegisterContext()
> 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");
>
> Modified:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp?rev=190647&r1=190646&r2=190647&view=diff
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
> (original)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
> Thu Sep 12 19:18:17 2013
> @@ -7,8 +7,8 @@
> //
>
> //===---------------------------------------------------------------------===//
>
> +#include "RegisterContextPOSIX_x86_64.h"
> #include "RegisterContextFreeBSD_x86_64.h"
> -#include <vector>
>
> using namespace lldb_private;
>
> @@ -19,13 +19,13 @@ using namespace lldb_private;
> // 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 @@ typedef struct _GPR
> 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 @@ RegisterContextFreeBSD_x86_64::GetGPRSiz
> }
>
> 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
>
> Modified:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h?rev=190647&r1=190646&r2=190647&view=diff
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h
> (original)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h Thu
> Sep 12 19:18:17 2013
> @@ -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
>
> Modified:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp?rev=190647&r1=190646&r2=190647&view=diff
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
> (original)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp Thu
> Sep 12 19:18:17 2013
> @@ -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,13 +20,13 @@ using namespace lldb_private;
> // 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)
> \
> @@ -34,8 +34,8 @@ do {
>
> #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 @@ typedef struct _GPR
> uint64_t gs;
> } GPR;
>
> -typedef RegisterContext_x86_64::FXSAVE FXSAVE;
> +typedef RegisterContextPOSIX_x86_64::FXSAVE FXSAVE;
>
> struct UserArea
> {
> @@ -94,14 +94,11 @@ struct UserArea
> 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 @@ RegisterContextLinux_x86_64::GetGPRSize(
> }
>
> 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
>
> Modified:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h?rev=190647&r1=190646&r2=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h
> Thu Sep 12 19:18:17 2013
> @@ -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
>
> Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h?rev=190647&r1=190646&r2=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h Thu Sep
> 12 19:18:17 2013
> @@ -67,4 +67,21 @@ protected:
> 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_
> +
>
> Added:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp?rev=190647&view=auto
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp
> (added)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp
> Thu Sep 12 19:18:17 2013
> @@ -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);
> +}
>
> Added:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h?rev=190647&view=auto
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h
> (added)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h
> Thu Sep 12 19:18:17 2013
> @@ -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
>
> Added:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp?rev=190647&view=auto
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp
> (added)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp
> Thu Sep 12 19:18:17 2013
> @@ -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);
> +}
>
> Added:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h?rev=190647&view=auto
>
> ==============================================================================
> ---
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h
> (added)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h
> Thu Sep 12 19:18:17 2013
> @@ -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
>
> Copied:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp (from
> r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp)
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp&r1=190549&r2=190647&rev=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp
> Thu Sep 12 19:18:17 2013
> @@ -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 @@ g_reg_sets[k_num_register_sets] =
>
> // 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 @@ g_register_infos[k_num_registers] =
> 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,13 +294,13 @@ RegisterContext_i386::GetRegisterInfoAtI
> }
>
> 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];
> @@ -317,7 +309,7 @@ RegisterContext_i386::GetRegisterSet(siz
> }
>
> 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 @@ RegisterContext_i386::GetRegisterIndexFr
> }
>
> 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 @@ RegisterContext_i386::UpdateAfterBreakpo
> }
>
> uint32_t
> -RegisterContext_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,
> +RegisterContextPOSIX_i386::ConvertRegisterKindToRegisterNumber(uint32_t
> kind,
> uint32_t
> num)
> {
> if (kind == eRegisterKindGeneric)
> @@ -490,7 +463,7 @@ RegisterContext_i386::ConvertRegisterKin
> }
>
> bool
> -RegisterContext_i386::HardwareSingleStep(bool enable)
> +RegisterContextPOSIX_i386::HardwareSingleStep(bool enable)
> {
> enum { TRACE_BIT = 0x100 };
> uint64_t eflags;
> @@ -517,7 +490,7 @@ RegisterContext_i386::HardwareSingleStep
> }
>
> 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 @@ RegisterContext_i386::LogGPR(const char
> 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));
> -}
>
> Copied:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h (from
> r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h)
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h&r1=190549&r2=190647&rev=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h
> Thu Sep 12 19:18:17 2013
> @@ -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 @@ public:
>
> 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 @@ public:
>
> 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 @@ public:
> 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_
>
> Copied:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
> (from r190549,
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp)
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp&r1=190549&r2=190647&rev=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
> (original)
> +++
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp Thu
> Sep 12 19:18:17 2013
> @@ -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 @@ g_reg_sets[k_num_register_sets] =
>
> // 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 @@ static uint32_t value_regs = LLDB_INVALI
> { 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,100 +456,118 @@ g_register_infos[k_num_registers] =
> 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];
> @@ -566,7 +576,7 @@ RegisterContext_x86_64::GetRegisterInfoA
> }
>
> 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,7 +587,7 @@ RegisterContext_x86_64::GetRegisterSetCo
> }
>
> const RegisterSet *
> -RegisterContext_x86_64::GetRegisterSet(size_t set)
> +RegisterContextPOSIX_x86_64::GetRegisterSet(size_t set)
> {
> if (IsRegisterSetAvailable(set))
> return &g_reg_sets[set];
> @@ -586,7 +596,7 @@ RegisterContext_x86_64::GetRegisterSet(s
> }
>
> 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 @@ RegisterContext_x86_64::GetRegisterIndex
> }
>
> 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,7 +628,7 @@ RegisterContext_x86_64::GetByteOrder()
> }
>
> // 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;
> @@ -626,27 +636,27 @@ bool RegisterContext_x86_64::CopyYMMtoXS
> 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;
> @@ -654,44 +664,44 @@ bool RegisterContext_x86_64::CopyXSTATEt
> 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 @@ RegisterContext_x86_64::ReadRegister(con
> }
> 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 @@ RegisterContext_x86_64::ReadRegister(con
> }
>
> 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 @@ RegisterContext_x86_64::ReadAllRegisterV
> ::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,7 +804,7 @@ RegisterContext_x86_64::ReadAllRegisterV
> }
>
> 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];
> @@ -802,7 +812,7 @@ RegisterContext_x86_64::WriteRegister(co
> return WriteRegister(reg, value);
> }
>
> - if (IsFPR(reg, m_fpr_type)) {
> + if (IsFPR(reg, GetFPRType())) {
> switch (reg)
> {
> default:
> @@ -816,7 +826,7 @@ RegisterContext_x86_64::WriteRegister(co
> ::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 @@ RegisterContext_x86_64::WriteRegister(co
> }
>
> 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 @@ RegisterContext_x86_64::WriteAllRegister
>
> 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 @@ RegisterContext_x86_64::WriteAllRegister
> }
>
> 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 @@ RegisterContext_x86_64::UpdateAfterBreak
> }
>
> 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 @@ RegisterContext_x86_64::ConvertRegisterK
> }
>
> 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 @@ size_and_rw_bits(size_t size, bool read,
> }
>
> 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 @@ RegisterContext_x86_64::SetHardwareWatch
> }
>
> 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 @@ RegisterContext_x86_64::SetHardwareWatch
> }
>
> 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 @@ RegisterContext_x86_64::ClearHardwareWat
> }
>
> 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 @@ RegisterContext_x86_64::IsWatchpointHit(
> }
>
> 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 @@ RegisterContext_x86_64::GetWatchpointAdd
>
>
> 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 @@ RegisterContext_x86_64::HardwareSingleSt
>
> 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
>
> Copied:
> lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h (from
> r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h)
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h&r1=190549&r2=190647&rev=190647&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h
> Thu Sep 12 19:18:17 2013
> @@ -1,4 +1,4 @@
> -//===-- RegisterContext_x86_64.h ---------------------------*- C++
> -*-===//
> +//===-- RegisterContextPOSIX_x86_64.h ---------------------------*- C++
> -*-===//
> //
> // The LLVM Compiler Infrastructure
> //
> @@ -7,8 +7,8 @@
> //
>
> //===----------------------------------------------------------------------===//
>
> -#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 @@ enum
> 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 @@ public:
> GetRegisterCount();
>
> virtual size_t
> - GetGPRSize() = 0;
> + GetGPRSize();
>
> virtual unsigned
> GetRegisterSize(unsigned reg);
> @@ -318,30 +319,38 @@ protected:
> 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_
>
> Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp?rev=190646&view=auto
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp
> (removed)
> @@ -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));
> -}
>
> Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h?rev=190646&view=auto
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h
> (removed)
> @@ -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_
>
> Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp?rev=190646&view=auto
>
> ==============================================================================
> --- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
> (original)
> +++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp
> (removed)
> @@ -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, kind
> ...
>
> [Message clipped]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130913/b0b5cc9b/attachment.html>
More information about the lldb-commits
mailing list