[Lldb-commits] [lldb] r192332 - Merge RegisterContextPOSIX_x86_64 and RegisterContextPOSIX_i386 into RegisterContextPOSIX_x86
Michael Sartain
mikesart at valvesoftware.com
Wed Oct 9 17:16:11 PDT 2013
Author: mikesart
Date: Wed Oct 9 19:16:10 2013
New Revision: 192332
URL: http://llvm.org/viewvc/llvm-project?rev=192332&view=rev
Log:
Merge RegisterContextPOSIX_x86_64 and RegisterContextPOSIX_i386 into RegisterContextPOSIX_x86
Added:
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp
- copied, changed from r192323, lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h
- copied, changed from r192323, lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.cpp
- copied, changed from r192323, lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.h
- copied, changed from r192323, lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h
Removed:
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
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_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_i386.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp
lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_i386.h
lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_x86_64.h
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
lldb/trunk/source/Symbol/UnwindTable.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=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt Wed Oct 9 19:16:10 2013
@@ -10,12 +10,10 @@ add_lldb_library(lldbPluginProcessPOSIX
ProcessMessage.cpp
ProcessPOSIX.cpp
ProcessPOSIXLog.cpp
- RegisterContextPOSIX_i386.cpp
- RegisterContextPOSIX_x86_64.cpp
+ RegisterContextPOSIX_x86.cpp
+ RegisterContextPOSIXProcessMonitor_x86.cpp
RegisterContextFreeBSD_i386.cpp
RegisterContextFreeBSD_x86_64.cpp
RegisterContextLinux_i386.cpp
RegisterContextLinux_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=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Wed Oct 9 19:16:10 2013
@@ -29,9 +29,7 @@
#include "ProcessPOSIX.h"
#include "ProcessPOSIXLog.h"
#include "ProcessMonitor.h"
-#include "RegisterContextPOSIX_i386.h"
-#include "RegisterContextPOSIXProcessMonitor_i386.h"
-#include "RegisterContextPOSIXProcessMonitor_x86_64.h"
+#include "RegisterContextPOSIXProcessMonitor_x86.h"
#include "RegisterContextLinux_i386.h"
#include "RegisterContextLinux_x86_64.h"
#include "RegisterContextFreeBSD_i386.h"
@@ -143,67 +141,27 @@ POSIXThread::GetRegisterContext()
{
m_posix_thread = NULL;
+ RegisterInfoInterface *reg_interface = NULL;
const ArchSpec &target_arch = GetProcess()->GetTarget().GetArchitecture();
- const ArchSpec &host_arch = Host::GetArchitecture();
- switch (host_arch.GetCore())
- {
- default:
- assert(false && "CPU type not supported!");
- break;
-
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
- {
- RegisterInfoInterface *reg_interface = NULL;
- switch (target_arch.GetTriple().getOS())
- {
- case llvm::Triple::FreeBSD:
- reg_interface = new RegisterContextFreeBSD_i386(target_arch);
- break;
- case llvm::Triple::Linux:
- reg_interface = new RegisterContextLinux_i386(target_arch);
- break;
- default:
- assert(false && "OS not supported");
- break;
- }
-
- if (reg_interface)
- {
- RegisterContextPOSIXProcessMonitor_i386 *reg_ctx = new RegisterContextPOSIXProcessMonitor_i386(*this, 0, reg_interface);
- m_posix_thread = reg_ctx;
- m_reg_context_sp.reset(reg_ctx);
- }
- break;
+ switch (target_arch.GetTriple().getOS())
+ {
+ case llvm::Triple::FreeBSD:
+ reg_interface = new RegisterContextFreeBSD_x86_64(target_arch);
+ break;
+ case llvm::Triple::Linux:
+ reg_interface = new RegisterContextLinux_x86_64(target_arch);
+ break;
+ default:
+ assert(false && "OS not supported");
+ break;
}
- case ArchSpec::eCore_x86_64_x86_64:
+ if (reg_interface)
{
- RegisterInfoInterface *reg_interface = NULL;
-
- switch (target_arch.GetTriple().getOS())
- {
- case llvm::Triple::FreeBSD:
- reg_interface = new RegisterContextFreeBSD_x86_64(target_arch);
- break;
- case llvm::Triple::Linux:
- reg_interface = new RegisterContextLinux_x86_64(target_arch);
- break;
- default:
- assert(false && "OS not supported");
- break;
- }
-
- if (reg_interface)
- {
- RegisterContextPOSIXProcessMonitor_x86_64 *reg_ctx = new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, reg_interface);
- m_posix_thread = reg_ctx;
- m_reg_context_sp.reset(reg_ctx);
- }
- break;
- }
+ RegisterContextPOSIXProcessMonitor_x86_64 *reg_ctx = new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, reg_interface);
+ m_posix_thread = reg_ctx;
+ m_reg_context_sp.reset(reg_ctx);
}
}
return m_reg_context_sp;
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_i386.cpp?rev=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_i386.cpp Wed Oct 9 19:16:10 2013
@@ -7,7 +7,7 @@
//
//===---------------------------------------------------------------------===//
-#include "RegisterContextPOSIX_i386.h"
+#include "RegisterContextPOSIX_x86.h"
#include "RegisterContextFreeBSD_i386.h"
using namespace lldb_private;
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=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp Wed Oct 9 19:16:10 2013
@@ -8,8 +8,7 @@
//===---------------------------------------------------------------------===//
#include <vector>
-#include "RegisterContextPOSIX_i386.h"
-#include "RegisterContextPOSIX_x86_64.h"
+#include "RegisterContextPOSIX_x86.h"
#include "RegisterContextFreeBSD_i386.h"
#include "RegisterContextFreeBSD_x86_64.h"
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp?rev=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp Wed Oct 9 19:16:10 2013
@@ -7,7 +7,7 @@
//
//===---------------------------------------------------------------------===//
-#include "RegisterContextPOSIX_i386.h"
+#include "RegisterContextPOSIX_x86.h"
#include "RegisterContextLinux_i386.h"
using namespace lldb_private;
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=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp Wed Oct 9 19:16:10 2013
@@ -8,8 +8,7 @@
//===---------------------------------------------------------------------===//
#include <vector>
-#include "RegisterContextPOSIX_i386.h"
-#include "RegisterContextPOSIX_x86_64.h"
+#include "RegisterContextPOSIX_x86.h"
#include "RegisterContextLinux_i386.h"
#include "RegisterContextLinux_x86_64.h"
Removed: 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=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp (removed)
@@ -1,75 +0,0 @@
-//===-- 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,
- RegisterInfoInterface *register_info)
- : RegisterContextPOSIX_i386(thread, concrete_frame_idx, register_info)
-{
-}
-
-ProcessMonitor &
-RegisterContextPOSIXProcessMonitor_i386::GetMonitor()
-{
- ProcessSP base = CalculateProcess();
- ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());
- return process->GetMonitor();
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_i386::ReadGPR()
-{
- assert(false);
- return false;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_i386::ReadFPR()
-{
- assert(false);
- return false;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_i386::WriteGPR()
-{
- assert(false);
- return false;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_i386::WriteFPR()
-{
- assert(false);
- return false;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_i386::ReadRegister(const RegisterInfo *reg_info,
- RegisterValue &value)
-{
- assert(false);
- return false;
-}
-
-bool RegisterContextPOSIXProcessMonitor_i386::WriteRegister(const RegisterInfo *reg_info,
- const RegisterValue &value)
-{
- assert(false);
- return false;
-}
Removed: 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=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h (removed)
@@ -1,76 +0,0 @@
-//===-- 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 POSIXBreakpointProtocol
-{
-public:
- RegisterContextPOSIXProcessMonitor_i386(lldb_private::Thread &thread,
- uint32_t concrete_frame_idx,
- RegisterInfoInterface *register_info);
-
-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);
-
- // POSIXBreakpointProtocol
- virtual bool
- UpdateAfterBreakpoint() { return true; }
-
- virtual unsigned
- GetRegisterIndexFromOffset(unsigned offset) { return LLDB_INVALID_REGNUM; }
-
- virtual bool
- IsWatchpointHit (uint32_t hw_index) { return false; }
-
- virtual bool
- ClearWatchpointHits () { return false; }
-
- virtual lldb::addr_t
- GetWatchpointAddress (uint32_t hw_index) { return LLDB_INVALID_ADDRESS; }
-
- virtual bool
- IsWatchpointVacant (uint32_t hw_index) { return false; }
-
- virtual bool
- SetHardwareWatchpointWithIndex (lldb::addr_t addr, size_t size,
- bool read, bool write,
- uint32_t hw_index) { return false; }
-
- // From lldb_private::RegisterContext
- virtual uint32_t
- NumSupportedHardwareWatchpoints () { return 0; }
-
-private:
- ProcessMonitor &
- GetMonitor();
-};
-
-#endif
Copied: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp (from r192323, 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.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp&r1=192323&r2=192332&rev=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp Wed Oct 9 19:16:10 2013
@@ -1,4 +1,4 @@
-//===-- RegisterContextPOSIXProcessMonitor_x86_64.h ------------*- C++ -*-===//
+//===-- RegisterContextPOSIXProcessMonitor_x86.h ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,9 +10,8 @@
#include "lldb/Target/Thread.h"
#include "lldb/Core/RegisterValue.h"
-#include "RegisterContextPOSIX_i386.h"
#include "ProcessPOSIX.h"
-#include "RegisterContextPOSIXProcessMonitor_x86_64.h"
+#include "RegisterContextPOSIXProcessMonitor_x86.h"
#include "ProcessMonitor.h"
using namespace lldb_private;
@@ -55,7 +54,7 @@ size_and_rw_bits(size_t size, bool read,
RegisterContextPOSIXProcessMonitor_x86_64::RegisterContextPOSIXProcessMonitor_x86_64(Thread &thread,
uint32_t concrete_frame_idx,
RegisterInfoInterface *register_info)
- : RegisterContextPOSIX_x86_64(thread, concrete_frame_idx, register_info)
+ : RegisterContextPOSIX_x86(thread, concrete_frame_idx, register_info)
{
}
Copied: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h (from r192323, 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.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h&r1=192323&r2=192332&rev=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.h Wed Oct 9 19:16:10 2013
@@ -1,4 +1,4 @@
-//===-- RegisterContextPOSIXProcessMonitor_x86_64.h -------------*- C++ -*-===//
+//===-- RegisterContextPOSIXProcessMonitor_x86.h ----------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,13 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_RegisterContextPOSIXProcessMonitor_x86_64_H_
-#define liblldb_RegisterContextPOSIXProcessMonitor_x86_64_H_
+#ifndef liblldb_RegisterContextPOSIXProcessMonitor_x86_H_
+#define liblldb_RegisterContextPOSIXProcessMonitor_x86_H_
-#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h"
+#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86.h"
class RegisterContextPOSIXProcessMonitor_x86_64:
- public RegisterContextPOSIX_x86_64,
+ public RegisterContextPOSIX_x86,
public POSIXBreakpointProtocol
{
public:
Removed: 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=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp (removed)
@@ -1,635 +0,0 @@
-//===-- 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 "lldb/Core/RegisterValue.h"
-
-#include "RegisterContextPOSIX_i386.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
-
-#define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(FPR))
-
-static uint32_t
-size_and_rw_bits(size_t size, bool read, bool write)
-{
- uint32_t rw;
-
- if (read)
- rw = 0x3; // READ or READ/WRITE
- else if (write)
- rw = 0x1; // WRITE
- else
- assert(0 && "read and write cannot both be false");
-
- switch (size)
- {
- case 1:
- return rw;
- case 2:
- return (0x1 << 2) | rw;
- case 4:
- return (0x3 << 2) | rw;
- case 8:
- return (0x2 << 2) | rw;
- default:
- assert(0 && "invalid size, must be one of 1, 2, 4, or 8");
- }
-}
-
-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_x86_64, GetGPRSize());
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::ReadFPR()
-{
- ProcessMonitor &monitor = GetMonitor();
- if (GetFPRType() == eFXSAVE)
- return monitor.ReadFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-
- if (GetFPRType() == 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_x86_64, GetGPRSize());
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::WriteFPR()
-{
- ProcessMonitor &monitor = GetMonitor();
- if (GetFPRType() == eFXSAVE)
- return monitor.WriteFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-
- if (GetFPRType() == 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)
-{
- unsigned reg_to_write = reg;
- RegisterValue value_to_write = value;
-
- // Check if this is a subregister of a full register.
- const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg);
- if (reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM))
- {
- RegisterValue full_value;
- uint32_t full_reg = reg_info->invalidate_regs[0];
- const RegisterInfo *full_reg_info = GetRegisterInfoAtIndex(full_reg);
-
- // Read the full register.
- if (ReadRegister(full_reg_info, full_value))
- {
- Error error;
- ByteOrder byte_order = GetByteOrder();
- uint8_t dst[RegisterValue::kMaxRegisterByteSize];
-
- // Get the bytes for the full register.
- const uint32_t dest_size = full_value.GetAsMemoryData (full_reg_info,
- dst,
- sizeof(dst),
- byte_order,
- error);
- if (error.Success() && dest_size)
- {
- uint8_t src[RegisterValue::kMaxRegisterByteSize];
-
- // Get the bytes for the source data.
- const uint32_t src_size = value.GetAsMemoryData (reg_info, src, sizeof(src), byte_order, error);
- if (error.Success() && src_size && (src_size < dest_size))
- {
- // Copy the src bytes to the destination.
- memcpy (dst + (reg_info->byte_offset & 0x1), src, src_size);
- // Set this full register as the value to write.
- value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order);
- value_to_write.SetType(full_reg_info);
- reg_to_write = full_reg;
- }
- }
- }
- }
-
- ProcessMonitor &monitor = GetMonitor();
- return monitor.WriteRegisterValue(m_thread.GetID(),
- GetRegisterOffset(reg_to_write),
- GetRegisterName(reg_to_write),
- value_to_write);
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_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, GetFPRType()))
- {
- if (!ReadFPR())
- return false;
- }
- else
- {
- uint32_t full_reg = reg;
- bool is_subreg = reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM);
-
- if (is_subreg)
- {
- // Read the full aligned 64-bit register.
- full_reg = reg_info->invalidate_regs[0];
- }
-
- bool success = ReadRegister(full_reg, value);
-
- if (success)
- {
- // If our read was not aligned (for ah,bh,ch,dh), shift our returned value one byte to the right.
- if (is_subreg && (reg_info->byte_offset & 0x1))
- value.SetUInt64(value.GetAsUInt64() >> 8);
-
- // If our return byte size was greater than the return value reg size, then
- // use the type specified by reg_info rather than the uint64_t default
- if (value.GetByteSize() > reg_info->byte_size)
- value.SetType(reg_info);
- }
- return success;
- }
-
- if (reg_info->encoding == eEncodingVector)
- {
- ByteOrder byte_order = GetByteOrder();
-
- if (byte_order != ByteOrder::eByteOrderInvalid)
- {
- if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)
- value.SetBytes(m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_st].bytes, reg_info->byte_size, byte_order);
- if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)
- value.SetBytes(m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_mm].bytes, reg_info->byte_size, byte_order);
- if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)
- value.SetBytes(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_xmm].bytes, reg_info->byte_size, byte_order);
- if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm)
- {
- // Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes
- if (GetFPRType() == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))
- value.SetBytes(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, reg_info->byte_size, byte_order);
- else
- return false;
- }
- return value.GetType() == RegisterValue::eTypeBytes;
- }
- return false;
- }
-
- // Get pointer to m_fpr.xstate.fxsave variable and set the data from it.
- assert (reg_info->byte_offset < sizeof(m_fpr));
- uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset;
- switch (reg_info->byte_size)
- {
- case 2:
- value.SetUInt16(*(uint16_t *)src);
- return true;
- case 4:
- value.SetUInt32(*(uint32_t *)src);
- return true;
- case 8:
- value.SetUInt64(*(uint64_t *)src);
- return true;
- default:
- assert(false && "Unhandled data size.");
- return false;
- }
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value)
-{
- const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
-
- if (IsGPR(reg))
- return WriteRegister(reg, value);
-
- if (IsFPR(reg, GetFPRType()))
- {
- if (reg_info->encoding == eEncodingVector)
- {
- if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)
- ::memcpy (m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_st].bytes, value.GetBytes(), value.GetByteSize());
-
- if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)
- ::memcpy (m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_mm].bytes, value.GetBytes(), value.GetByteSize());
-
- if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)
- ::memcpy (m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_xmm].bytes, value.GetBytes(), value.GetByteSize());
-
- if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm)
- {
- 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
- ::memcpy (m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, value.GetBytes(), value.GetByteSize());
- if (false == CopyYMMtoXSTATE(reg, GetByteOrder()))
- return false;
- }
- }
- else
- {
- // Get pointer to m_fpr.xstate.fxsave variable and set the data to it.
- assert (reg_info->byte_offset < sizeof(m_fpr));
- uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset;
- switch (reg_info->byte_size)
- {
- case 2:
- *(uint16_t *)dst = value.GetAsUInt16();
- break;
- case 4:
- *(uint32_t *)dst = value.GetAsUInt32();
- break;
- case 8:
- *(uint64_t *)dst = value.GetAsUInt64();
- break;
- default:
- assert(false && "Unhandled data size.");
- return false;
- }
- }
-
- if (WriteFPR())
- {
- if (IsAVX(reg))
- return CopyYMMtoXSTATE(reg, GetByteOrder());
- return true;
- }
- }
- return false;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp)
-{
- bool success = false;
- data_sp.reset (new DataBufferHeap (REG_CONTEXT_SIZE, 0));
- if (data_sp && ReadGPR () && ReadFPR ())
- {
- uint8_t *dst = data_sp->GetBytes();
- success = dst != 0;
-
- if (success)
- {
- ::memcpy (dst, &m_gpr_x86_64, GetGPRSize());
- dst += GetGPRSize();
- }
- if (GetFPRType() == eFXSAVE)
- ::memcpy (dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));
-
- if (GetFPRType() == eXSAVE)
- {
- ByteOrder byte_order = GetByteOrder();
-
- // Assemble the YMM register content from the register halves.
- for (uint32_t reg = m_reg_info.first_ymm; success && reg <= m_reg_info.last_ymm; ++reg)
- success = CopyXSTATEtoYMM(reg, byte_order);
-
- if (success)
- {
- // Copy the extended register state including the assembled ymm registers.
- ::memcpy (dst, &m_fpr, sizeof(m_fpr));
- }
- }
- }
- return success;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::WriteAllRegisterValues(const DataBufferSP &data_sp)
-{
- bool success = false;
- if (data_sp && data_sp->GetByteSize() == REG_CONTEXT_SIZE)
- {
- uint8_t *src = data_sp->GetBytes();
- if (src)
- {
- ::memcpy (&m_gpr_x86_64, src, GetGPRSize());
-
- if (WriteGPR())
- {
- src += GetGPRSize();
- if (GetFPRType() == eFXSAVE)
- ::memcpy (&m_fpr.xstate.fxsave, src, sizeof(m_fpr.xstate.fxsave));
- if (GetFPRType() == eXSAVE)
- ::memcpy (&m_fpr.xstate.xsave, src, sizeof(m_fpr.xstate.xsave));
-
- success = WriteFPR();
- if (success)
- {
- success = true;
-
- if (GetFPRType() == eXSAVE)
- {
- ByteOrder byte_order = GetByteOrder();
-
- // Parse the YMM register content from the register halves.
- for (uint32_t reg = m_reg_info.first_ymm; success && reg <= m_reg_info.last_ymm; ++reg)
- success = CopyYMMtoXSTATE(reg, byte_order);
- }
- }
- }
- }
- }
- return success;
-}
-
-uint32_t
-RegisterContextPOSIXProcessMonitor_x86_64::SetHardwareWatchpoint(addr_t addr, size_t size,
- bool read, bool write)
-{
- const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
- uint32_t hw_index;
-
- for (hw_index = 0; hw_index < num_hw_watchpoints; ++hw_index)
- {
- if (IsWatchpointVacant(hw_index))
- return SetHardwareWatchpointWithIndex(addr, size,
- read, write,
- hw_index);
- }
-
- return LLDB_INVALID_INDEX32;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::ClearHardwareWatchpoint(uint32_t hw_index)
-{
- if (hw_index < NumSupportedHardwareWatchpoints())
- {
- RegisterValue current_dr7_bits;
-
- if (ReadRegister(m_reg_info.first_dr + 7, current_dr7_bits))
- {
- uint64_t new_dr7_bits = current_dr7_bits.GetAsUInt64() & ~(3 << (2*hw_index));
-
- if (WriteRegister(m_reg_info.first_dr + 7, RegisterValue(new_dr7_bits)))
- return true;
- }
- }
-
- return false;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::HardwareSingleStep(bool enable)
-{
- enum { TRACE_BIT = 0x100 };
- uint64_t rflags;
-
- if ((rflags = ReadRegisterAsUnsigned(m_reg_info.gpr_flags, -1UL)) == -1UL)
- return false;
-
- if (enable)
- {
- if (rflags & TRACE_BIT)
- return true;
-
- rflags |= TRACE_BIT;
- }
- else
- {
- if (!(rflags & TRACE_BIT))
- return false;
-
- rflags &= ~TRACE_BIT;
- }
-
- return WriteRegisterFromUnsigned(m_reg_info.gpr_flags, rflags);
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::UpdateAfterBreakpoint()
-{
- // PC points one byte past the int3 responsible for the breakpoint.
- lldb::addr_t pc;
-
- if ((pc = GetPC()) == LLDB_INVALID_ADDRESS)
- return false;
-
- SetPC(pc - 1);
- return true;
-}
-
-unsigned
-RegisterContextPOSIXProcessMonitor_x86_64::GetRegisterIndexFromOffset(unsigned offset)
-{
- unsigned reg;
- for (reg = 0; reg < m_reg_info.num_registers; reg++)
- {
- if (GetRegisterInfo()[reg].byte_offset == offset)
- break;
- }
- assert(reg < m_reg_info.num_registers && "Invalid register offset.");
- return reg;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::IsWatchpointHit(uint32_t hw_index)
-{
- bool is_hit = false;
-
- if (m_watchpoints_initialized == false)
- {
- // Reset the debug status and debug control registers
- RegisterValue zero_bits = RegisterValue(uint64_t(0));
- if (!WriteRegister(m_reg_info.first_dr + 6, zero_bits) || !WriteRegister(m_reg_info.first_dr + 7, zero_bits))
- assert(false && "Could not initialize watchpoint registers");
- m_watchpoints_initialized = true;
- }
-
- if (hw_index < NumSupportedHardwareWatchpoints())
- {
- RegisterValue value;
-
- if (ReadRegister(m_reg_info.first_dr + 6, value))
- {
- uint64_t val = value.GetAsUInt64();
- is_hit = val & (1 << hw_index);
- }
- }
-
- return is_hit;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::ClearWatchpointHits()
-{
- return WriteRegister(m_reg_info.first_dr + 6, RegisterValue((uint64_t)0));
-}
-
-addr_t
-RegisterContextPOSIXProcessMonitor_x86_64::GetWatchpointAddress(uint32_t hw_index)
-{
- addr_t wp_monitor_addr = LLDB_INVALID_ADDRESS;
-
- if (hw_index < NumSupportedHardwareWatchpoints())
- {
- if (!IsWatchpointVacant(hw_index))
- {
- RegisterValue value;
-
- if (ReadRegister(m_reg_info.first_dr + hw_index, value))
- wp_monitor_addr = value.GetAsUInt64();
- }
- }
-
- return wp_monitor_addr;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::IsWatchpointVacant(uint32_t hw_index)
-{
- bool is_vacant = false;
- RegisterValue value;
-
- assert(hw_index < NumSupportedHardwareWatchpoints());
-
- if (m_watchpoints_initialized == false)
- {
- // Reset the debug status and debug control registers
- RegisterValue zero_bits = RegisterValue(uint64_t(0));
- if (!WriteRegister(m_reg_info.first_dr + 6, zero_bits) || !WriteRegister(m_reg_info.first_dr + 7, zero_bits))
- assert(false && "Could not initialize watchpoint registers");
- m_watchpoints_initialized = true;
- }
-
- if (ReadRegister(m_reg_info.first_dr + 7, value))
- {
- uint64_t val = value.GetAsUInt64();
- is_vacant = (val & (3 << 2*hw_index)) == 0;
- }
-
- return is_vacant;
-}
-
-bool
-RegisterContextPOSIXProcessMonitor_x86_64::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,
- bool read, bool write,
- uint32_t hw_index)
-{
- const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
-
- if (num_hw_watchpoints == 0 || hw_index >= num_hw_watchpoints)
- return false;
-
- if (!(size == 1 || size == 2 || size == 4 || size == 8))
- return false;
-
- if (read == false && write == false)
- return false;
-
- if (!IsWatchpointVacant(hw_index))
- return false;
-
- // Set both dr7 (debug control register) and dri (debug address register).
-
- // dr7{7-0} encodes the local/global enable bits:
- // global enable --. .-- local enable
- // | |
- // v v
- // dr0 -> bits{1-0}
- // dr1 -> bits{3-2}
- // dr2 -> bits{5-4}
- // dr3 -> bits{7-6}
- //
- // dr7{31-16} encodes the rw/len bits:
- // b_x+3, b_x+2, b_x+1, b_x
- // where bits{x+1, x} => rw
- // 0b00: execute, 0b01: write, 0b11: read-or-write,
- // 0b10: io read-or-write (unused)
- // and bits{x+3, x+2} => len
- // 0b00: 1-byte, 0b01: 2-byte, 0b11: 4-byte, 0b10: 8-byte
- //
- // dr0 -> bits{19-16}
- // dr1 -> bits{23-20}
- // dr2 -> bits{27-24}
- // dr3 -> bits{31-28}
- if (hw_index < num_hw_watchpoints)
- {
- RegisterValue current_dr7_bits;
-
- if (ReadRegister(m_reg_info.first_dr + 7, current_dr7_bits))
- {
- uint64_t new_dr7_bits = current_dr7_bits.GetAsUInt64() |
- (1 << (2*hw_index) |
- size_and_rw_bits(size, read, write) <<
- (16+4*hw_index));
-
- if (WriteRegister(m_reg_info.first_dr + hw_index, RegisterValue(addr)) &&
- WriteRegister(m_reg_info.first_dr + 7, RegisterValue(new_dr7_bits)))
- return true;
- }
- }
-
- return false;
-}
-
-uint32_t
-RegisterContextPOSIXProcessMonitor_x86_64::NumSupportedHardwareWatchpoints()
-{
- // Available debug address registers: dr0, dr1, dr2, dr3
- return 4;
-}
-
Removed: 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=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h (removed)
@@ -1,95 +0,0 @@
-//===-- 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 POSIXBreakpointProtocol
-{
-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();
-
- // lldb_private::RegisterContext
- bool
- ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);
-
- bool
- WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value);
-
- 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);
-
- bool
- ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
-
- bool
- WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
-
- uint32_t
- SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write);
-
- bool
- ClearHardwareWatchpoint(uint32_t hw_index);
-
- bool
- HardwareSingleStep(bool enable);
-
- // POSIXBreakpointProtocol
- bool
- UpdateAfterBreakpoint();
-
- unsigned
- GetRegisterIndexFromOffset(unsigned offset);
-
- bool
- IsWatchpointHit(uint32_t hw_index);
-
- bool
- ClearWatchpointHits();
-
- lldb::addr_t
- GetWatchpointAddress(uint32_t hw_index);
-
- bool
- IsWatchpointVacant(uint32_t hw_index);
-
- bool
- SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size, bool read, bool write, uint32_t hw_index);
-
- uint32_t
- NumSupportedHardwareWatchpoints();
-
-private:
- ProcessMonitor &
- GetMonitor();
-};
-
-#endif
Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp?rev=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp (removed)
@@ -1,295 +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 "RegisterContextPOSIX_i386.h"
-#include "RegisterContext_x86.h"
-
-using namespace lldb_private;
-using namespace lldb;
-
-const uint32_t
-RegisterContextPOSIX_i386::g_gpr_regnums[] =
-{
- gpr_eax_i386,
- gpr_ebx_i386,
- gpr_ecx_i386,
- gpr_edx_i386,
- gpr_edi_i386,
- gpr_esi_i386,
- gpr_ebp_i386,
- gpr_esp_i386,
- gpr_eip_i386,
- gpr_eflags_i386,
- gpr_cs_i386,
- gpr_fs_i386,
- gpr_gs_i386,
- gpr_ss_i386,
- gpr_ds_i386,
- gpr_es_i386,
- gpr_ax_i386,
- gpr_bx_i386,
- gpr_cx_i386,
- gpr_dx_i386,
- gpr_di_i386,
- gpr_si_i386,
- gpr_bp_i386,
- gpr_sp_i386,
- gpr_ah_i386,
- gpr_bh_i386,
- gpr_ch_i386,
- gpr_dh_i386,
- gpr_al_i386,
- gpr_bl_i386,
- gpr_cl_i386,
- gpr_dl_i386
-};
-static_assert((sizeof(RegisterContextPOSIX_i386::g_gpr_regnums) / sizeof(RegisterContextPOSIX_i386::g_gpr_regnums[0])) == k_num_gpr_registers_i386,
- "g_gpr_regnums has wrong number of register infos");
-
-const uint32_t
-RegisterContextPOSIX_i386::g_fpu_regnums[] =
-{
- fpu_fctrl_i386,
- fpu_fstat_i386,
- fpu_ftag_i386,
- fpu_fop_i386,
- fpu_fiseg_i386,
- fpu_fioff_i386,
- fpu_foseg_i386,
- fpu_fooff_i386,
- fpu_mxcsr_i386,
- fpu_mxcsrmask_i386,
- fpu_st0_i386,
- fpu_st1_i386,
- fpu_st2_i386,
- fpu_st3_i386,
- fpu_st4_i386,
- fpu_st5_i386,
- fpu_st6_i386,
- fpu_st7_i386,
- fpu_mm0_i386,
- fpu_mm1_i386,
- fpu_mm2_i386,
- fpu_mm3_i386,
- fpu_mm4_i386,
- fpu_mm5_i386,
- fpu_mm6_i386,
- fpu_mm7_i386,
- fpu_xmm0_i386,
- fpu_xmm1_i386,
- fpu_xmm2_i386,
- fpu_xmm3_i386,
- fpu_xmm4_i386,
- fpu_xmm5_i386,
- fpu_xmm6_i386,
- fpu_xmm7_i386
-};
-static_assert((sizeof(RegisterContextPOSIX_i386::g_fpu_regnums) / sizeof(RegisterContextPOSIX_i386::g_fpu_regnums[0])) == k_num_fpr_registers_i386,
- "g_gpr_regnums has wrong number of register infos");
-
-const uint32_t
-RegisterContextPOSIX_i386::g_avx_regnums[] =
-{
- fpu_ymm0_i386,
- fpu_ymm1_i386,
- fpu_ymm2_i386,
- fpu_ymm3_i386,
- fpu_ymm4_i386,
- fpu_ymm5_i386,
- fpu_ymm6_i386,
- fpu_ymm7_i386
-};
-static_assert((sizeof(RegisterContextPOSIX_i386::g_avx_regnums) / sizeof(RegisterContextPOSIX_i386::g_avx_regnums[0])) == k_num_avx_registers_i386,
- "g_gpr_regnums has wrong number of register infos");
-
-uint32_t RegisterContextPOSIX_i386::g_contained_eax[] = { gpr_eax_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_contained_ebx[] = { gpr_ebx_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_contained_ecx[] = { gpr_ecx_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_contained_edx[] = { gpr_edx_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_contained_edi[] = { gpr_edi_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_contained_esi[] = { gpr_esi_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_contained_ebp[] = { gpr_ebp_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_contained_esp[] = { gpr_esp_i386, LLDB_INVALID_REGNUM };
-
-uint32_t RegisterContextPOSIX_i386::g_invalidate_eax[] = { gpr_eax_i386, gpr_ax_i386, gpr_ah_i386, gpr_al_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_invalidate_ebx[] = { gpr_ebx_i386, gpr_bx_i386, gpr_bh_i386, gpr_bl_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_invalidate_ecx[] = { gpr_ecx_i386, gpr_cx_i386, gpr_ch_i386, gpr_cl_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_invalidate_edx[] = { gpr_edx_i386, gpr_dx_i386, gpr_dh_i386, gpr_dl_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_invalidate_edi[] = { gpr_edi_i386, gpr_di_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_invalidate_esi[] = { gpr_esi_i386, gpr_si_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_invalidate_ebp[] = { gpr_ebp_i386, gpr_bp_i386, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_i386::g_invalidate_esp[] = { gpr_esp_i386, gpr_sp_i386, LLDB_INVALID_REGNUM };
-
-// 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_i386, RegisterContextPOSIX_i386::g_gpr_regnums },
- { "Floating Point Registers", "fpu", k_num_fpr_registers_i386, RegisterContextPOSIX_i386::g_fpu_regnums },
- { "Advanced Vector Extensions", "avx", k_num_avx_registers_i386, RegisterContextPOSIX_i386::g_avx_regnums }
-};
-
-
-RegisterContextPOSIX_i386::RegisterContextPOSIX_i386(Thread &thread,
- uint32_t concrete_frame_idx,
- RegisterInfoInterface *register_info)
- : RegisterContext(thread, concrete_frame_idx)
-{
- m_register_info_ap.reset(register_info);
-}
-
-RegisterContextPOSIX_i386::~RegisterContextPOSIX_i386()
-{
-}
-
-RegisterContextPOSIX_i386::FPRType RegisterContextPOSIX_i386::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
-RegisterContextPOSIX_i386::Invalidate()
-{
-}
-
-void
-RegisterContextPOSIX_i386::InvalidateAllRegisters()
-{
-}
-
-unsigned RegisterContextPOSIX_i386::GetRegisterOffset(unsigned reg)
-{
- assert(reg < k_num_registers_i386 && "Invalid register number.");
- return GetRegisterInfo()[reg].byte_offset;
-}
-
-unsigned RegisterContextPOSIX_i386::GetRegisterSize(unsigned reg)
-{
- assert(reg < k_num_registers_i386 && "Invalid register number.");
- return GetRegisterInfo()[reg].byte_size;
-}
-
-const RegisterInfo *
-RegisterContextPOSIX_i386::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 m_register_info_ap->GetRegisterInfo ();
-}
-
-size_t
-RegisterContextPOSIX_i386::GetRegisterCount()
-{
- size_t num_registers = k_num_gpr_registers_i386 + k_num_fpr_registers_i386;
- if (GetFPRType() == eXSAVE)
- return num_registers + k_num_avx_registers_i386;
- return num_registers;
-}
-
-const RegisterInfo *
-RegisterContextPOSIX_i386::GetRegisterInfoAtIndex(size_t reg)
-{
- if (reg < k_num_registers_i386)
- return &GetRegisterInfo()[reg];
- else
- return NULL;
-}
-
-size_t
-RegisterContextPOSIX_i386::GetRegisterSetCount()
-{
- return k_num_register_sets;
-}
-
-const RegisterSet *
-RegisterContextPOSIX_i386::GetRegisterSet(size_t set)
-{
- if (set < k_num_register_sets)
- return &g_reg_sets[set];
- else
- return NULL;
-}
-
-const char *
-RegisterContextPOSIX_i386::GetRegisterName(unsigned reg)
-{
- assert(reg < k_num_registers_i386 && "Invalid register offset.");
- return GetRegisterInfo()[reg].name;
-}
-
-bool
-RegisterContextPOSIX_i386::ReadAllRegisterValues(DataBufferSP &data_sp)
-{
- return false;
-}
-
-bool
-RegisterContextPOSIX_i386::WriteAllRegisterValues(const DataBufferSP &data)
-{
- return false;
-}
-
-bool
-RegisterContextPOSIX_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
-RegisterContextPOSIX_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,
- uint32_t num)
-{
- const uint32_t num_regs = GetRegisterCount();
-
- assert (kind < kNumRegisterKinds);
- for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx)
- {
- const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg_idx);
-
- if (reg_info->kinds[kind] == num)
- return reg_idx;
- }
-
- return LLDB_INVALID_REGNUM;
-
-}
-
-bool
-RegisterContextPOSIX_i386::HardwareSingleStep(bool enable)
-{
- return false;
-}
Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h?rev=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h (removed)
@@ -1,250 +0,0 @@
-//===-- RegisterContextPOSIX_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"
-#include "RegisterContext_x86.h"
-
-//---------------------------------------------------------------------------
-// Internal codes for all i386 registers.
-//---------------------------------------------------------------------------
-enum
-{
- k_first_gpr_i386,
- gpr_eax_i386 = k_first_gpr_i386,
- gpr_ebx_i386,
- gpr_ecx_i386,
- gpr_edx_i386,
- gpr_edi_i386,
- gpr_esi_i386,
- gpr_ebp_i386,
- gpr_esp_i386,
- gpr_eip_i386,
- gpr_eflags_i386,
- gpr_cs_i386,
- gpr_fs_i386,
- gpr_gs_i386,
- gpr_ss_i386,
- gpr_ds_i386,
- gpr_es_i386,
-
- k_first_alias_i386,
- gpr_ax_i386 = k_first_alias_i386,
- gpr_bx_i386,
- gpr_cx_i386,
- gpr_dx_i386,
- gpr_di_i386,
- gpr_si_i386,
- gpr_bp_i386,
- gpr_sp_i386,
- gpr_ah_i386,
- gpr_bh_i386,
- gpr_ch_i386,
- gpr_dh_i386,
- gpr_al_i386,
- gpr_bl_i386,
- gpr_cl_i386,
- gpr_dl_i386,
- k_last_alias_i386 = gpr_dl_i386,
-
- k_last_gpr_i386 = k_last_alias_i386,
-
- k_first_fpr_i386,
- fpu_fctrl_i386 = k_first_fpr_i386,
- fpu_fstat_i386,
- fpu_ftag_i386,
- fpu_fop_i386,
- fpu_fiseg_i386,
- fpu_fioff_i386,
- fpu_foseg_i386,
- fpu_fooff_i386,
- fpu_mxcsr_i386,
- fpu_mxcsrmask_i386,
- fpu_st0_i386,
- fpu_st1_i386,
- fpu_st2_i386,
- fpu_st3_i386,
- fpu_st4_i386,
- fpu_st5_i386,
- fpu_st6_i386,
- fpu_st7_i386,
- fpu_mm0_i386,
- fpu_mm1_i386,
- fpu_mm2_i386,
- fpu_mm3_i386,
- fpu_mm4_i386,
- fpu_mm5_i386,
- fpu_mm6_i386,
- fpu_mm7_i386,
- fpu_xmm0_i386,
- fpu_xmm1_i386,
- fpu_xmm2_i386,
- fpu_xmm3_i386,
- fpu_xmm4_i386,
- fpu_xmm5_i386,
- fpu_xmm6_i386,
- fpu_xmm7_i386,
- k_last_fpr_i386 = fpu_xmm7_i386,
-
- k_first_avx_i386,
- fpu_ymm0_i386 = k_first_avx_i386,
- fpu_ymm1_i386,
- fpu_ymm2_i386,
- fpu_ymm3_i386,
- fpu_ymm4_i386,
- fpu_ymm5_i386,
- fpu_ymm6_i386,
- fpu_ymm7_i386,
- k_last_avx_i386 = fpu_ymm7_i386,
-
- dr0_i386,
- dr1_i386,
- dr2_i386,
- dr3_i386,
- dr4_i386,
- dr5_i386,
- dr6_i386,
- dr7_i386,
-
- k_num_registers_i386,
- k_num_gpr_registers_i386 = k_last_gpr_i386 - k_first_gpr_i386 + 1,
- k_num_fpr_registers_i386 = k_last_fpr_i386 - k_first_fpr_i386 + 1,
- k_num_avx_registers_i386 = k_last_avx_i386 - k_first_avx_i386 + 1
-};
-
-class RegisterContextPOSIX_i386 :
- public lldb_private::RegisterContext
-{
-public:
- RegisterContextPOSIX_i386(lldb_private::Thread &thread,
- uint32_t concreate_frame_idx,
- RegisterInfoInterface *register_info);
-
- ~RegisterContextPOSIX_i386();
-
- void
- Invalidate();
-
- void
- InvalidateAllRegisters();
-
- size_t
- GetRegisterCount();
-
- virtual unsigned
- GetRegisterSize(unsigned reg);
-
- virtual unsigned
- GetRegisterOffset(unsigned reg);
-
- const lldb_private::RegisterInfo *
- GetRegisterInfoAtIndex(size_t reg);
-
- size_t
- GetRegisterSetCount();
-
- const lldb_private::RegisterSet *
- GetRegisterSet(size_t set);
-
- 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) = 0;
-
- 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) = 0;
-
- bool
- WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);
-
- uint32_t
- ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num);
-
- bool
- HardwareSingleStep(bool enable);
-
- bool
- UpdateAfterBreakpoint();
-
- //---------------------------------------------------------------------------
- // Note: prefer kernel definitions over user-land
- //---------------------------------------------------------------------------
- enum FPRType
- {
- eNotValid = 0,
- eFSAVE, // TODO
- eFXSAVE,
- eSOFT, // TODO
- eXSAVE
- };
-
- static uint32_t g_contained_eax[];
- static uint32_t g_contained_ebx[];
- static uint32_t g_contained_ecx[];
- static uint32_t g_contained_edx[];
- static uint32_t g_contained_edi[];
- static uint32_t g_contained_esi[];
- static uint32_t g_contained_ebp[];
- static uint32_t g_contained_esp[];
-
- static uint32_t g_invalidate_eax[];
- static uint32_t g_invalidate_ebx[];
- static uint32_t g_invalidate_ecx[];
- static uint32_t g_invalidate_edx[];
- static uint32_t g_invalidate_edi[];
- static uint32_t g_invalidate_esi[];
- static uint32_t g_invalidate_ebp[];
- static uint32_t g_invalidate_esp[];
-
- static const uint32_t g_gpr_regnums[]; // k_num_gpr_registers_i386
- static const uint32_t g_fpu_regnums[]; // k_num_fpr_registers_i386
- static const uint32_t g_avx_regnums[]; // k_num_avx_registers_i386
-
-protected:
- virtual const lldb_private::RegisterInfo *
- GetRegisterInfo();
-
- FPRType m_fpr_type; // determines the type of data stored by union FPR, if any.
- std::unique_ptr<RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)
-
- FPRType GetFPRType();
-
- 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.cpp (from r192323, lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp&r1=192323&r2=192332&rev=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.cpp Wed Oct 9 19:16:10 2013
@@ -1,4 +1,4 @@
-//===-- RegisterContextPOSIX_x86_64.cpp -------------------------*- C++ -*-===//
+//===-- RegisterContextPOSIX_x86.cpp ----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -21,16 +21,110 @@
#include "llvm/Support/Compiler.h"
#include "ProcessPOSIX.h"
-#include "RegisterContextPOSIX_i386.h"
#include "RegisterContext_x86.h"
-#include "RegisterContextPOSIX_x86_64.h"
+#include "RegisterContextPOSIX_x86.h"
#include "Plugins/Process/elf-core/ProcessElfCore.h"
using namespace lldb_private;
using namespace lldb;
+const uint32_t
+g_gpr_regnums_i386[] =
+{
+ gpr_eax_i386,
+ gpr_ebx_i386,
+ gpr_ecx_i386,
+ gpr_edx_i386,
+ gpr_edi_i386,
+ gpr_esi_i386,
+ gpr_ebp_i386,
+ gpr_esp_i386,
+ gpr_eip_i386,
+ gpr_eflags_i386,
+ gpr_cs_i386,
+ gpr_fs_i386,
+ gpr_gs_i386,
+ gpr_ss_i386,
+ gpr_ds_i386,
+ gpr_es_i386,
+ gpr_ax_i386,
+ gpr_bx_i386,
+ gpr_cx_i386,
+ gpr_dx_i386,
+ gpr_di_i386,
+ gpr_si_i386,
+ gpr_bp_i386,
+ gpr_sp_i386,
+ gpr_ah_i386,
+ gpr_bh_i386,
+ gpr_ch_i386,
+ gpr_dh_i386,
+ gpr_al_i386,
+ gpr_bl_i386,
+ gpr_cl_i386,
+ gpr_dl_i386
+};
+static_assert((sizeof(g_gpr_regnums_i386) / sizeof(g_gpr_regnums_i386[0])) == k_num_gpr_registers_i386,
+ "g_gpr_regnums_i386 has wrong number of register infos");
+
+const uint32_t
+g_fpu_regnums_i386[] =
+{
+ fpu_fctrl_i386,
+ fpu_fstat_i386,
+ fpu_ftag_i386,
+ fpu_fop_i386,
+ fpu_fiseg_i386,
+ fpu_fioff_i386,
+ fpu_foseg_i386,
+ fpu_fooff_i386,
+ fpu_mxcsr_i386,
+ fpu_mxcsrmask_i386,
+ fpu_st0_i386,
+ fpu_st1_i386,
+ fpu_st2_i386,
+ fpu_st3_i386,
+ fpu_st4_i386,
+ fpu_st5_i386,
+ fpu_st6_i386,
+ fpu_st7_i386,
+ fpu_mm0_i386,
+ fpu_mm1_i386,
+ fpu_mm2_i386,
+ fpu_mm3_i386,
+ fpu_mm4_i386,
+ fpu_mm5_i386,
+ fpu_mm6_i386,
+ fpu_mm7_i386,
+ fpu_xmm0_i386,
+ fpu_xmm1_i386,
+ fpu_xmm2_i386,
+ fpu_xmm3_i386,
+ fpu_xmm4_i386,
+ fpu_xmm5_i386,
+ fpu_xmm6_i386,
+ fpu_xmm7_i386
+};
+static_assert((sizeof(g_fpu_regnums_i386) / sizeof(g_fpu_regnums_i386[0])) == k_num_fpr_registers_i386,
+ "g_fpu_regnums_i386 has wrong number of register infos");
+
+const uint32_t
+g_avx_regnums_i386[] =
+{
+ fpu_ymm0_i386,
+ fpu_ymm1_i386,
+ fpu_ymm2_i386,
+ fpu_ymm3_i386,
+ fpu_ymm4_i386,
+ fpu_ymm5_i386,
+ fpu_ymm6_i386,
+ fpu_ymm7_i386
+};
+static_assert((sizeof(g_avx_regnums_i386) / sizeof(g_avx_regnums_i386[0])) == k_num_avx_registers_i386,
+ " g_avx_regnums_i386 has wrong number of register infos");
+
static const
-uint32_t g_gpr_regnums[] =
+uint32_t g_gpr_regnums_x86_64[] =
{
gpr_rax_x86_64,
gpr_rbx_x86_64,
@@ -109,11 +203,11 @@ uint32_t g_gpr_regnums[] =
gpr_r14l_x86_64, // Low 8 bits or r14
gpr_r15l_x86_64, // Low 8 bits or r15
};
-static_assert((sizeof(g_gpr_regnums) / sizeof(g_gpr_regnums[0])) == k_num_gpr_registers_x86_64,
- "g_gpr_regnums has wrong number of register infos");
+static_assert((sizeof(g_gpr_regnums_x86_64) / sizeof(g_gpr_regnums_x86_64[0])) == k_num_gpr_registers_x86_64,
+ "g_gpr_regnums_x86_64 has wrong number of register infos");
static const uint32_t
-g_fpu_regnums[] =
+g_fpu_regnums_x86_64[] =
{
fpu_fctrl_x86_64,
fpu_fstat_x86_64,
@@ -158,11 +252,11 @@ g_fpu_regnums[] =
fpu_xmm14_x86_64,
fpu_xmm15_x86_64
};
-static_assert((sizeof(g_fpu_regnums) / sizeof(g_fpu_regnums[0])) == k_num_fpr_registers_x86_64,
- "g_gpr_regnums has wrong number of register infos");
+static_assert((sizeof(g_fpu_regnums_x86_64) / sizeof(g_fpu_regnums_x86_64[0])) == k_num_fpr_registers_x86_64,
+ "g_fpu_regnums_x86_64 has wrong number of register infos");
static const uint32_t
-g_avx_regnums[] =
+g_avx_regnums_x86_64[] =
{
fpu_ymm0_x86_64,
fpu_ymm1_x86_64,
@@ -181,42 +275,60 @@ g_avx_regnums[] =
fpu_ymm14_x86_64,
fpu_ymm15_x86_64
};
-static_assert((sizeof(g_avx_regnums) / sizeof(g_gpr_regnums[0])) == k_num_avx_registers_x86_64,
- "g_gpr_regnums has wrong number of register infos");
+static_assert((sizeof(g_avx_regnums_x86_64) / sizeof(g_avx_regnums_x86_64[0])) == k_num_avx_registers_x86_64,
+ "g_avx_regnums_x86_64 has wrong number of register infos");
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rax[] = { gpr_rax_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rbx[] = { gpr_rbx_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rcx[] = { gpr_rcx_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rdx[] = { gpr_rdx_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rdi[] = { gpr_rdi_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rsi[] = { gpr_rsi_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rbp[] = { gpr_rbp_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rsp[] = { gpr_rsp_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r8[] = { gpr_r8_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r9[] = { gpr_r9_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r10[] = { gpr_r10_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r11[] = { gpr_r11_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r12[] = { gpr_r12_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r13[] = { gpr_r13_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r14[] = { gpr_r14_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r15[] = { gpr_r15_x86_64, LLDB_INVALID_REGNUM };
-
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rax[] = { gpr_rax_x86_64, gpr_eax_x86_64, gpr_ax_x86_64, gpr_ah_x86_64, gpr_al_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rbx[] = { gpr_rbx_x86_64, gpr_ebx_x86_64, gpr_bx_x86_64, gpr_bh_x86_64, gpr_bl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rcx[] = { gpr_rcx_x86_64, gpr_ecx_x86_64, gpr_cx_x86_64, gpr_ch_x86_64, gpr_cl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rdx[] = { gpr_rdx_x86_64, gpr_edx_x86_64, gpr_dx_x86_64, gpr_dh_x86_64, gpr_dl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rdi[] = { gpr_rdi_x86_64, gpr_edi_x86_64, gpr_di_x86_64, gpr_dil_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rsi[] = { gpr_rsi_x86_64, gpr_esi_x86_64, gpr_si_x86_64, gpr_sil_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rbp[] = { gpr_rbp_x86_64, gpr_ebp_x86_64, gpr_bp_x86_64, gpr_bpl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rsp[] = { gpr_rsp_x86_64, gpr_esp_x86_64, gpr_sp_x86_64, gpr_spl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r8[] = { gpr_r8_x86_64, gpr_r8d_x86_64, gpr_r8w_x86_64, gpr_r8l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r9[] = { gpr_r9_x86_64, gpr_r9d_x86_64, gpr_r9w_x86_64, gpr_r9l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r10[] = { gpr_r10_x86_64, gpr_r10d_x86_64, gpr_r10w_x86_64, gpr_r10l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r11[] = { gpr_r11_x86_64, gpr_r11d_x86_64, gpr_r11w_x86_64, gpr_r11l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r12[] = { gpr_r12_x86_64, gpr_r12d_x86_64, gpr_r12w_x86_64, gpr_r12l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r13[] = { gpr_r13_x86_64, gpr_r13d_x86_64, gpr_r13w_x86_64, gpr_r13l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r14[] = { gpr_r14_x86_64, gpr_r14d_x86_64, gpr_r14w_x86_64, gpr_r14l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r15[] = { gpr_r15_x86_64, gpr_r15d_x86_64, gpr_r15w_x86_64, gpr_r15l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_eax[] = { gpr_eax_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_ebx[] = { gpr_ebx_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_ecx[] = { gpr_ecx_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_edx[] = { gpr_edx_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_edi[] = { gpr_edi_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_esi[] = { gpr_esi_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_ebp[] = { gpr_ebp_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_esp[] = { gpr_esp_i386, LLDB_INVALID_REGNUM };
+
+uint32_t RegisterContextPOSIX_x86::g_invalidate_eax[] = { gpr_eax_i386, gpr_ax_i386, gpr_ah_i386, gpr_al_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_ebx[] = { gpr_ebx_i386, gpr_bx_i386, gpr_bh_i386, gpr_bl_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_ecx[] = { gpr_ecx_i386, gpr_cx_i386, gpr_ch_i386, gpr_cl_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_edx[] = { gpr_edx_i386, gpr_dx_i386, gpr_dh_i386, gpr_dl_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_edi[] = { gpr_edi_i386, gpr_di_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_esi[] = { gpr_esi_i386, gpr_si_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_ebp[] = { gpr_ebp_i386, gpr_bp_i386, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_esp[] = { gpr_esp_i386, gpr_sp_i386, LLDB_INVALID_REGNUM };
+
+uint32_t RegisterContextPOSIX_x86::g_contained_rax[] = { gpr_rax_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_rbx[] = { gpr_rbx_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_rcx[] = { gpr_rcx_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_rdx[] = { gpr_rdx_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_rdi[] = { gpr_rdi_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_rsi[] = { gpr_rsi_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_rbp[] = { gpr_rbp_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_rsp[] = { gpr_rsp_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r8[] = { gpr_r8_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r9[] = { gpr_r9_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r10[] = { gpr_r10_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r11[] = { gpr_r11_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r12[] = { gpr_r12_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r13[] = { gpr_r13_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r14[] = { gpr_r14_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_contained_r15[] = { gpr_r15_x86_64, LLDB_INVALID_REGNUM };
+
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rax[] = { gpr_rax_x86_64, gpr_eax_x86_64, gpr_ax_x86_64, gpr_ah_x86_64, gpr_al_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rbx[] = { gpr_rbx_x86_64, gpr_ebx_x86_64, gpr_bx_x86_64, gpr_bh_x86_64, gpr_bl_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rcx[] = { gpr_rcx_x86_64, gpr_ecx_x86_64, gpr_cx_x86_64, gpr_ch_x86_64, gpr_cl_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rdx[] = { gpr_rdx_x86_64, gpr_edx_x86_64, gpr_dx_x86_64, gpr_dh_x86_64, gpr_dl_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rdi[] = { gpr_rdi_x86_64, gpr_edi_x86_64, gpr_di_x86_64, gpr_dil_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rsi[] = { gpr_rsi_x86_64, gpr_esi_x86_64, gpr_si_x86_64, gpr_sil_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rbp[] = { gpr_rbp_x86_64, gpr_ebp_x86_64, gpr_bp_x86_64, gpr_bpl_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_rsp[] = { gpr_rsp_x86_64, gpr_esp_x86_64, gpr_sp_x86_64, gpr_spl_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r8[] = { gpr_r8_x86_64, gpr_r8d_x86_64, gpr_r8w_x86_64, gpr_r8l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r9[] = { gpr_r9_x86_64, gpr_r9d_x86_64, gpr_r9w_x86_64, gpr_r9l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r10[] = { gpr_r10_x86_64, gpr_r10d_x86_64, gpr_r10w_x86_64, gpr_r10l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r11[] = { gpr_r11_x86_64, gpr_r11d_x86_64, gpr_r11w_x86_64, gpr_r11l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r12[] = { gpr_r12_x86_64, gpr_r12d_x86_64, gpr_r12w_x86_64, gpr_r12l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r13[] = { gpr_r13_x86_64, gpr_r13d_x86_64, gpr_r13w_x86_64, gpr_r13l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r14[] = { gpr_r14_x86_64, gpr_r14d_x86_64, gpr_r14w_x86_64, gpr_r14l_x86_64, LLDB_INVALID_REGNUM };
+uint32_t RegisterContextPOSIX_x86::g_invalidate_r15[] = { gpr_r15_x86_64, gpr_r15d_x86_64, gpr_r15w_x86_64, gpr_r15l_x86_64, LLDB_INVALID_REGNUM };
// Number of register sets provided by this context.
enum
@@ -226,37 +338,37 @@ enum
};
static const RegisterSet
-g_reg_sets_x86_64[k_num_register_sets] =
+g_reg_sets_i386[k_num_register_sets] =
{
- { "General Purpose Registers", "gpr", k_num_gpr_registers_x86_64, g_gpr_regnums },
- { "Floating Point Registers", "fpu", k_num_fpr_registers_x86_64, g_fpu_regnums },
- { "Advanced Vector Extensions", "avx", k_num_avx_registers_x86_64, g_avx_regnums }
+ { "General Purpose Registers", "gpr", k_num_gpr_registers_i386, g_gpr_regnums_i386 },
+ { "Floating Point Registers", "fpu", k_num_fpr_registers_i386, g_fpu_regnums_i386 },
+ { "Advanced Vector Extensions", "avx", k_num_avx_registers_i386, g_avx_regnums_i386 }
};
static const RegisterSet
-g_reg_sets_i386[k_num_register_sets] =
+g_reg_sets_x86_64[k_num_register_sets] =
{
- { "General Purpose Registers", "gpr", k_num_gpr_registers_i386, RegisterContextPOSIX_i386::g_gpr_regnums },
- { "Floating Point Registers", "fpu", k_num_fpr_registers_i386, RegisterContextPOSIX_i386::g_fpu_regnums },
- { "Advanced Vector Extensions", "avx", k_num_avx_registers_i386, RegisterContextPOSIX_i386::g_avx_regnums }
+ { "General Purpose Registers", "gpr", k_num_gpr_registers_x86_64, g_gpr_regnums_x86_64 },
+ { "Floating Point Registers", "fpu", k_num_fpr_registers_x86_64, g_fpu_regnums_x86_64 },
+ { "Advanced Vector Extensions", "avx", k_num_avx_registers_x86_64, g_avx_regnums_x86_64 }
};
-bool RegisterContextPOSIX_x86_64::IsGPR(unsigned reg)
+bool RegisterContextPOSIX_x86::IsGPR(unsigned reg)
{
return reg <= m_reg_info.last_gpr; // GPR's come first.
}
-bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg)
+bool RegisterContextPOSIX_x86::IsFPR(unsigned reg)
{
return (m_reg_info.first_fpr <= reg && reg <= m_reg_info.last_fpr);
}
-bool RegisterContextPOSIX_x86_64::IsAVX(unsigned reg)
+bool RegisterContextPOSIX_x86::IsAVX(unsigned reg)
{
return (m_reg_info.first_ymm <= reg && reg <= m_reg_info.last_ymm);
}
-bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg, FPRType fpr_type)
+bool RegisterContextPOSIX_x86::IsFPR(unsigned reg, FPRType fpr_type)
{
bool generic_fpr = IsFPR(reg);
@@ -265,9 +377,9 @@ bool RegisterContextPOSIX_x86_64::IsFPR(
return generic_fpr;
}
-RegisterContextPOSIX_x86_64::RegisterContextPOSIX_x86_64(Thread &thread,
- uint32_t concrete_frame_idx,
- RegisterInfoInterface *register_info)
+RegisterContextPOSIX_x86::RegisterContextPOSIX_x86(Thread &thread,
+ uint32_t concrete_frame_idx,
+ RegisterInfoInterface *register_info)
: RegisterContext(thread, concrete_frame_idx)
{
m_register_info_ap.reset(register_info);
@@ -335,11 +447,11 @@ RegisterContextPOSIX_x86_64::RegisterCon
m_fpr_type = eNotValid;
}
-RegisterContextPOSIX_x86_64::~RegisterContextPOSIX_x86_64()
+RegisterContextPOSIX_x86::~RegisterContextPOSIX_x86()
{
}
-RegisterContextPOSIX_x86_64::FPRType RegisterContextPOSIX_x86_64::GetFPRType()
+RegisterContextPOSIX_x86::FPRType RegisterContextPOSIX_x86::GetFPRType()
{
if (m_fpr_type == eNotValid)
{
@@ -352,31 +464,31 @@ RegisterContextPOSIX_x86_64::FPRType Reg
}
void
-RegisterContextPOSIX_x86_64::Invalidate()
+RegisterContextPOSIX_x86::Invalidate()
{
}
void
-RegisterContextPOSIX_x86_64::InvalidateAllRegisters()
+RegisterContextPOSIX_x86::InvalidateAllRegisters()
{
}
unsigned
-RegisterContextPOSIX_x86_64::GetRegisterOffset(unsigned reg)
+RegisterContextPOSIX_x86::GetRegisterOffset(unsigned reg)
{
assert(reg < m_reg_info.num_registers && "Invalid register number.");
return GetRegisterInfo()[reg].byte_offset;
}
unsigned
-RegisterContextPOSIX_x86_64::GetRegisterSize(unsigned reg)
+RegisterContextPOSIX_x86::GetRegisterSize(unsigned reg)
{
assert(reg < m_reg_info.num_registers && "Invalid register number.");
return GetRegisterInfo()[reg].byte_size;
}
size_t
-RegisterContextPOSIX_x86_64::GetRegisterCount()
+RegisterContextPOSIX_x86::GetRegisterCount()
{
size_t num_registers = m_reg_info.num_gpr_registers + m_reg_info.num_fpr_registers;
if (GetFPRType() == eXSAVE)
@@ -385,13 +497,13 @@ RegisterContextPOSIX_x86_64::GetRegister
}
size_t
-RegisterContextPOSIX_x86_64::GetGPRSize()
+RegisterContextPOSIX_x86::GetGPRSize()
{
return m_register_info_ap->GetGPRSize ();
}
const RegisterInfo *
-RegisterContextPOSIX_x86_64::GetRegisterInfo()
+RegisterContextPOSIX_x86::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.
@@ -399,7 +511,7 @@ RegisterContextPOSIX_x86_64::GetRegister
}
const RegisterInfo *
-RegisterContextPOSIX_x86_64::GetRegisterInfoAtIndex(size_t reg)
+RegisterContextPOSIX_x86::GetRegisterInfoAtIndex(size_t reg)
{
if (reg < m_reg_info.num_registers)
return &GetRegisterInfo()[reg];
@@ -408,7 +520,7 @@ RegisterContextPOSIX_x86_64::GetRegister
}
size_t
-RegisterContextPOSIX_x86_64::GetRegisterSetCount()
+RegisterContextPOSIX_x86::GetRegisterSetCount()
{
size_t sets = 0;
for (size_t set = 0; set < k_num_register_sets; ++set)
@@ -421,7 +533,7 @@ RegisterContextPOSIX_x86_64::GetRegister
}
const RegisterSet *
-RegisterContextPOSIX_x86_64::GetRegisterSet(size_t set)
+RegisterContextPOSIX_x86::GetRegisterSet(size_t set)
{
if (IsRegisterSetAvailable(set))
{
@@ -442,14 +554,14 @@ RegisterContextPOSIX_x86_64::GetRegister
}
const char *
-RegisterContextPOSIX_x86_64::GetRegisterName(unsigned reg)
+RegisterContextPOSIX_x86::GetRegisterName(unsigned reg)
{
assert(reg < m_reg_info.num_registers && "Invalid register offset.");
return GetRegisterInfo()[reg].name;
}
lldb::ByteOrder
-RegisterContextPOSIX_x86_64::GetByteOrder()
+RegisterContextPOSIX_x86::GetByteOrder()
{
// Get the target process whose privileged thread was used for the register read.
lldb::ByteOrder byte_order = eByteOrderInvalid;
@@ -461,7 +573,7 @@ RegisterContextPOSIX_x86_64::GetByteOrde
}
// Parse ymm registers and into xmm.bytes and ymmh.bytes.
-bool RegisterContextPOSIX_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
+bool RegisterContextPOSIX_x86::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
{
if (!IsAVX(reg))
return false;
@@ -491,7 +603,7 @@ bool RegisterContextPOSIX_x86_64::CopyYM
}
// Concatenate xmm.bytes with ymmh.bytes
-bool RegisterContextPOSIX_x86_64::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
+bool RegisterContextPOSIX_x86::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
{
if (!IsAVX(reg))
return false;
@@ -521,7 +633,7 @@ bool RegisterContextPOSIX_x86_64::CopyXS
}
bool
-RegisterContextPOSIX_x86_64::IsRegisterSetAvailable(size_t set_index)
+RegisterContextPOSIX_x86::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;
@@ -535,7 +647,7 @@ RegisterContextPOSIX_x86_64::IsRegisterS
// Used when parsing DWARF and EH frame information and any other
// object file sections that contain register numbers in them.
uint32_t
-RegisterContextPOSIX_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind,
+RegisterContextPOSIX_x86::ConvertRegisterKindToRegisterNumber(uint32_t kind,
uint32_t num)
{
const uint32_t num_regs = GetRegisterCount();
Copied: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.h (from r192323, lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h&r1=192323&r2=192332&rev=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86.h Wed Oct 9 19:16:10 2013
@@ -1,4 +1,4 @@
-//===-- RegisterContextPOSIX_x86_64.h ---------------------------*- C++ -*-===//
+//===-- RegisterContextPOSIX_x86.h ------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_RegisterContextPOSIX_x86_64_H_
-#define liblldb_RegisterContextPOSIX_x86_64_H_
+#ifndef liblldb_RegisterContextPOSIX_x86_H_
+#define liblldb_RegisterContextPOSIX_x86_H_
#include "lldb/Core/Log.h"
#include "RegisterContextPOSIX.h"
@@ -17,6 +17,113 @@
class ProcessMonitor;
//---------------------------------------------------------------------------
+// Internal codes for all i386 registers.
+//---------------------------------------------------------------------------
+enum
+{
+ k_first_gpr_i386,
+ gpr_eax_i386 = k_first_gpr_i386,
+ gpr_ebx_i386,
+ gpr_ecx_i386,
+ gpr_edx_i386,
+ gpr_edi_i386,
+ gpr_esi_i386,
+ gpr_ebp_i386,
+ gpr_esp_i386,
+ gpr_eip_i386,
+ gpr_eflags_i386,
+ gpr_cs_i386,
+ gpr_fs_i386,
+ gpr_gs_i386,
+ gpr_ss_i386,
+ gpr_ds_i386,
+ gpr_es_i386,
+
+ k_first_alias_i386,
+ gpr_ax_i386 = k_first_alias_i386,
+ gpr_bx_i386,
+ gpr_cx_i386,
+ gpr_dx_i386,
+ gpr_di_i386,
+ gpr_si_i386,
+ gpr_bp_i386,
+ gpr_sp_i386,
+ gpr_ah_i386,
+ gpr_bh_i386,
+ gpr_ch_i386,
+ gpr_dh_i386,
+ gpr_al_i386,
+ gpr_bl_i386,
+ gpr_cl_i386,
+ gpr_dl_i386,
+ k_last_alias_i386 = gpr_dl_i386,
+
+ k_last_gpr_i386 = k_last_alias_i386,
+
+ k_first_fpr_i386,
+ fpu_fctrl_i386 = k_first_fpr_i386,
+ fpu_fstat_i386,
+ fpu_ftag_i386,
+ fpu_fop_i386,
+ fpu_fiseg_i386,
+ fpu_fioff_i386,
+ fpu_foseg_i386,
+ fpu_fooff_i386,
+ fpu_mxcsr_i386,
+ fpu_mxcsrmask_i386,
+ fpu_st0_i386,
+ fpu_st1_i386,
+ fpu_st2_i386,
+ fpu_st3_i386,
+ fpu_st4_i386,
+ fpu_st5_i386,
+ fpu_st6_i386,
+ fpu_st7_i386,
+ fpu_mm0_i386,
+ fpu_mm1_i386,
+ fpu_mm2_i386,
+ fpu_mm3_i386,
+ fpu_mm4_i386,
+ fpu_mm5_i386,
+ fpu_mm6_i386,
+ fpu_mm7_i386,
+ fpu_xmm0_i386,
+ fpu_xmm1_i386,
+ fpu_xmm2_i386,
+ fpu_xmm3_i386,
+ fpu_xmm4_i386,
+ fpu_xmm5_i386,
+ fpu_xmm6_i386,
+ fpu_xmm7_i386,
+ k_last_fpr_i386 = fpu_xmm7_i386,
+
+ k_first_avx_i386,
+ fpu_ymm0_i386 = k_first_avx_i386,
+ fpu_ymm1_i386,
+ fpu_ymm2_i386,
+ fpu_ymm3_i386,
+ fpu_ymm4_i386,
+ fpu_ymm5_i386,
+ fpu_ymm6_i386,
+ fpu_ymm7_i386,
+ k_last_avx_i386 = fpu_ymm7_i386,
+
+ dr0_i386,
+ dr1_i386,
+ dr2_i386,
+ dr3_i386,
+ dr4_i386,
+ dr5_i386,
+ dr6_i386,
+ dr7_i386,
+
+ k_num_registers_i386,
+ k_num_gpr_registers_i386 = k_last_gpr_i386 - k_first_gpr_i386 + 1,
+ k_num_fpr_registers_i386 = k_last_fpr_i386 - k_first_fpr_i386 + 1,
+ k_num_avx_registers_i386 = k_last_avx_i386 - k_first_avx_i386 + 1
+};
+
+//---------------------------------------------------------------------------
// Internal codes for all x86_64 registers.
//---------------------------------------------------------------------------
enum
@@ -183,15 +290,15 @@ enum
k_num_avx_registers_x86_64 = k_last_avx_x86_64 - k_first_avx_x86_64 + 1
};
-class RegisterContextPOSIX_x86_64
+class RegisterContextPOSIX_x86
: public lldb_private::RegisterContext
{
public:
- RegisterContextPOSIX_x86_64 (lldb_private::Thread &thread,
+ RegisterContextPOSIX_x86 (lldb_private::Thread &thread,
uint32_t concrete_frame_idx,
RegisterInfoInterface *register_info);
- ~RegisterContextPOSIX_x86_64();
+ ~RegisterContextPOSIX_x86();
void
Invalidate();
@@ -238,6 +345,24 @@ public:
eXSAVE
};
+ static uint32_t g_contained_eax[];
+ static uint32_t g_contained_ebx[];
+ static uint32_t g_contained_ecx[];
+ static uint32_t g_contained_edx[];
+ static uint32_t g_contained_edi[];
+ static uint32_t g_contained_esi[];
+ static uint32_t g_contained_ebp[];
+ static uint32_t g_contained_esp[];
+
+ static uint32_t g_invalidate_eax[];
+ static uint32_t g_invalidate_ebx[];
+ static uint32_t g_invalidate_ecx[];
+ static uint32_t g_invalidate_edx[];
+ static uint32_t g_invalidate_edi[];
+ static uint32_t g_invalidate_esi[];
+ static uint32_t g_invalidate_ebp[];
+ static uint32_t g_invalidate_esp[];
+
static uint32_t g_contained_rax[];
static uint32_t g_contained_rbx[];
static uint32_t g_contained_rcx[];
@@ -334,4 +459,4 @@ protected:
virtual bool WriteFPR() = 0;
};
-#endif // #ifndef liblldb_RegisterContextPOSIX_x86_64_H_
+#endif // #ifndef liblldb_RegisterContextPOSIX_x86_H_
Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp?rev=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp (removed)
@@ -1,554 +0,0 @@
-//===-- RegisterContextPOSIX_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"
-#include "RegisterContextPOSIX_i386.h"
-#include "RegisterContext_x86.h"
-#include "RegisterContextPOSIX_x86_64.h"
-#include "Plugins/Process/elf-core/ProcessElfCore.h"
-
-using namespace lldb_private;
-using namespace lldb;
-
-static const
-uint32_t g_gpr_regnums[] =
-{
- gpr_rax_x86_64,
- gpr_rbx_x86_64,
- gpr_rcx_x86_64,
- gpr_rdx_x86_64,
- gpr_rdi_x86_64,
- gpr_rsi_x86_64,
- gpr_rbp_x86_64,
- gpr_rsp_x86_64,
- gpr_r8_x86_64,
- gpr_r9_x86_64,
- gpr_r10_x86_64,
- gpr_r11_x86_64,
- gpr_r12_x86_64,
- gpr_r13_x86_64,
- gpr_r14_x86_64,
- gpr_r15_x86_64,
- gpr_rip_x86_64,
- gpr_rflags_x86_64,
- gpr_cs_x86_64,
- gpr_fs_x86_64,
- gpr_gs_x86_64,
- gpr_ss_x86_64,
- gpr_ds_x86_64,
- gpr_es_x86_64,
- gpr_eax_x86_64,
- gpr_ebx_x86_64,
- gpr_ecx_x86_64,
- gpr_edx_x86_64,
- gpr_edi_x86_64,
- gpr_esi_x86_64,
- gpr_ebp_x86_64,
- gpr_esp_x86_64,
- gpr_r8d_x86_64, // Low 32 bits or r8
- gpr_r9d_x86_64, // Low 32 bits or r9
- gpr_r10d_x86_64, // Low 32 bits or r10
- gpr_r11d_x86_64, // Low 32 bits or r11
- gpr_r12d_x86_64, // Low 32 bits or r12
- gpr_r13d_x86_64, // Low 32 bits or r13
- gpr_r14d_x86_64, // Low 32 bits or r14
- gpr_r15d_x86_64, // Low 32 bits or r15
- gpr_ax_x86_64,
- gpr_bx_x86_64,
- gpr_cx_x86_64,
- gpr_dx_x86_64,
- gpr_di_x86_64,
- gpr_si_x86_64,
- gpr_bp_x86_64,
- gpr_sp_x86_64,
- gpr_r8w_x86_64, // Low 16 bits or r8
- gpr_r9w_x86_64, // Low 16 bits or r9
- gpr_r10w_x86_64, // Low 16 bits or r10
- gpr_r11w_x86_64, // Low 16 bits or r11
- gpr_r12w_x86_64, // Low 16 bits or r12
- gpr_r13w_x86_64, // Low 16 bits or r13
- gpr_r14w_x86_64, // Low 16 bits or r14
- gpr_r15w_x86_64, // Low 16 bits or r15
- gpr_ah_x86_64,
- gpr_bh_x86_64,
- gpr_ch_x86_64,
- gpr_dh_x86_64,
- gpr_al_x86_64,
- gpr_bl_x86_64,
- gpr_cl_x86_64,
- gpr_dl_x86_64,
- gpr_dil_x86_64,
- gpr_sil_x86_64,
- gpr_bpl_x86_64,
- gpr_spl_x86_64,
- gpr_r8l_x86_64, // Low 8 bits or r8
- gpr_r9l_x86_64, // Low 8 bits or r9
- gpr_r10l_x86_64, // Low 8 bits or r10
- gpr_r11l_x86_64, // Low 8 bits or r11
- gpr_r12l_x86_64, // Low 8 bits or r12
- gpr_r13l_x86_64, // Low 8 bits or r13
- gpr_r14l_x86_64, // Low 8 bits or r14
- gpr_r15l_x86_64, // Low 8 bits or r15
-};
-static_assert((sizeof(g_gpr_regnums) / sizeof(g_gpr_regnums[0])) == k_num_gpr_registers_x86_64,
- "g_gpr_regnums has wrong number of register infos");
-
-static const uint32_t
-g_fpu_regnums[] =
-{
- fpu_fctrl_x86_64,
- fpu_fstat_x86_64,
- fpu_ftag_x86_64,
- fpu_fop_x86_64,
- fpu_fiseg_x86_64,
- fpu_fioff_x86_64,
- fpu_foseg_x86_64,
- fpu_fooff_x86_64,
- fpu_mxcsr_x86_64,
- fpu_mxcsrmask_x86_64,
- fpu_st0_x86_64,
- fpu_st1_x86_64,
- fpu_st2_x86_64,
- fpu_st3_x86_64,
- fpu_st4_x86_64,
- fpu_st5_x86_64,
- fpu_st6_x86_64,
- fpu_st7_x86_64,
- fpu_mm0_x86_64,
- fpu_mm1_x86_64,
- fpu_mm2_x86_64,
- fpu_mm3_x86_64,
- fpu_mm4_x86_64,
- fpu_mm5_x86_64,
- fpu_mm6_x86_64,
- fpu_mm7_x86_64,
- fpu_xmm0_x86_64,
- fpu_xmm1_x86_64,
- fpu_xmm2_x86_64,
- fpu_xmm3_x86_64,
- fpu_xmm4_x86_64,
- fpu_xmm5_x86_64,
- fpu_xmm6_x86_64,
- fpu_xmm7_x86_64,
- fpu_xmm8_x86_64,
- fpu_xmm9_x86_64,
- fpu_xmm10_x86_64,
- fpu_xmm11_x86_64,
- fpu_xmm12_x86_64,
- fpu_xmm13_x86_64,
- fpu_xmm14_x86_64,
- fpu_xmm15_x86_64
-};
-static_assert((sizeof(g_fpu_regnums) / sizeof(g_fpu_regnums[0])) == k_num_fpr_registers_x86_64,
- "g_gpr_regnums has wrong number of register infos");
-
-static const uint32_t
-g_avx_regnums[] =
-{
- fpu_ymm0_x86_64,
- fpu_ymm1_x86_64,
- fpu_ymm2_x86_64,
- fpu_ymm3_x86_64,
- fpu_ymm4_x86_64,
- fpu_ymm5_x86_64,
- fpu_ymm6_x86_64,
- fpu_ymm7_x86_64,
- fpu_ymm8_x86_64,
- fpu_ymm9_x86_64,
- fpu_ymm10_x86_64,
- fpu_ymm11_x86_64,
- fpu_ymm12_x86_64,
- fpu_ymm13_x86_64,
- fpu_ymm14_x86_64,
- fpu_ymm15_x86_64
-};
-static_assert((sizeof(g_avx_regnums) / sizeof(g_gpr_regnums[0])) == k_num_avx_registers_x86_64,
- "g_gpr_regnums has wrong number of register infos");
-
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rax[] = { gpr_rax_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rbx[] = { gpr_rbx_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rcx[] = { gpr_rcx_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rdx[] = { gpr_rdx_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rdi[] = { gpr_rdi_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rsi[] = { gpr_rsi_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rbp[] = { gpr_rbp_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_rsp[] = { gpr_rsp_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r8[] = { gpr_r8_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r9[] = { gpr_r9_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r10[] = { gpr_r10_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r11[] = { gpr_r11_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r12[] = { gpr_r12_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r13[] = { gpr_r13_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r14[] = { gpr_r14_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_contained_r15[] = { gpr_r15_x86_64, LLDB_INVALID_REGNUM };
-
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rax[] = { gpr_rax_x86_64, gpr_eax_x86_64, gpr_ax_x86_64, gpr_ah_x86_64, gpr_al_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rbx[] = { gpr_rbx_x86_64, gpr_ebx_x86_64, gpr_bx_x86_64, gpr_bh_x86_64, gpr_bl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rcx[] = { gpr_rcx_x86_64, gpr_ecx_x86_64, gpr_cx_x86_64, gpr_ch_x86_64, gpr_cl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rdx[] = { gpr_rdx_x86_64, gpr_edx_x86_64, gpr_dx_x86_64, gpr_dh_x86_64, gpr_dl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rdi[] = { gpr_rdi_x86_64, gpr_edi_x86_64, gpr_di_x86_64, gpr_dil_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rsi[] = { gpr_rsi_x86_64, gpr_esi_x86_64, gpr_si_x86_64, gpr_sil_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rbp[] = { gpr_rbp_x86_64, gpr_ebp_x86_64, gpr_bp_x86_64, gpr_bpl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_rsp[] = { gpr_rsp_x86_64, gpr_esp_x86_64, gpr_sp_x86_64, gpr_spl_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r8[] = { gpr_r8_x86_64, gpr_r8d_x86_64, gpr_r8w_x86_64, gpr_r8l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r9[] = { gpr_r9_x86_64, gpr_r9d_x86_64, gpr_r9w_x86_64, gpr_r9l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r10[] = { gpr_r10_x86_64, gpr_r10d_x86_64, gpr_r10w_x86_64, gpr_r10l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r11[] = { gpr_r11_x86_64, gpr_r11d_x86_64, gpr_r11w_x86_64, gpr_r11l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r12[] = { gpr_r12_x86_64, gpr_r12d_x86_64, gpr_r12w_x86_64, gpr_r12l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r13[] = { gpr_r13_x86_64, gpr_r13d_x86_64, gpr_r13w_x86_64, gpr_r13l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r14[] = { gpr_r14_x86_64, gpr_r14d_x86_64, gpr_r14w_x86_64, gpr_r14l_x86_64, LLDB_INVALID_REGNUM };
-uint32_t RegisterContextPOSIX_x86_64::g_invalidate_r15[] = { gpr_r15_x86_64, gpr_r15d_x86_64, gpr_r15w_x86_64, gpr_r15l_x86_64, LLDB_INVALID_REGNUM };
-
-// 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_x86_64[k_num_register_sets] =
-{
- { "General Purpose Registers", "gpr", k_num_gpr_registers_x86_64, g_gpr_regnums },
- { "Floating Point Registers", "fpu", k_num_fpr_registers_x86_64, g_fpu_regnums },
- { "Advanced Vector Extensions", "avx", k_num_avx_registers_x86_64, g_avx_regnums }
-};
-
-static const RegisterSet
-g_reg_sets_i386[k_num_register_sets] =
-{
- { "General Purpose Registers", "gpr", k_num_gpr_registers_i386, RegisterContextPOSIX_i386::g_gpr_regnums },
- { "Floating Point Registers", "fpu", k_num_fpr_registers_i386, RegisterContextPOSIX_i386::g_fpu_regnums },
- { "Advanced Vector Extensions", "avx", k_num_avx_registers_i386, RegisterContextPOSIX_i386::g_avx_regnums }
-};
-
-bool RegisterContextPOSIX_x86_64::IsGPR(unsigned reg)
-{
- return reg <= m_reg_info.last_gpr; // GPR's come first.
-}
-
-bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg)
-{
- return (m_reg_info.first_fpr <= reg && reg <= m_reg_info.last_fpr);
-}
-
-bool RegisterContextPOSIX_x86_64::IsAVX(unsigned reg)
-{
- return (m_reg_info.first_ymm <= reg && reg <= m_reg_info.last_ymm);
-}
-
-bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg, FPRType fpr_type)
-{
- bool generic_fpr = IsFPR(reg);
-
- if (fpr_type == eXSAVE)
- return generic_fpr || IsAVX(reg);
- return generic_fpr;
-}
-
-RegisterContextPOSIX_x86_64::RegisterContextPOSIX_x86_64(Thread &thread,
- uint32_t concrete_frame_idx,
- RegisterInfoInterface *register_info)
- : RegisterContext(thread, concrete_frame_idx)
-{
- m_register_info_ap.reset(register_info);
-
- switch (register_info->m_target_arch.GetCore())
- {
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
- m_reg_info.num_registers = k_num_registers_i386;
- m_reg_info.num_gpr_registers = k_num_gpr_registers_i386;
- m_reg_info.num_fpr_registers = k_num_fpr_registers_i386;
- m_reg_info.num_avx_registers = k_num_avx_registers_i386;
- m_reg_info.last_gpr = k_last_gpr_i386;
- m_reg_info.first_fpr = k_first_fpr_i386;
- m_reg_info.last_fpr = k_last_fpr_i386;
- m_reg_info.first_st = fpu_st0_i386;
- m_reg_info.last_st = fpu_st7_i386;
- m_reg_info.first_mm = fpu_mm0_i386;
- m_reg_info.last_mm = fpu_mm7_i386;
- m_reg_info.first_xmm = fpu_xmm0_i386;
- m_reg_info.last_xmm = fpu_xmm7_i386;
- m_reg_info.first_ymm = fpu_ymm0_i386;
- m_reg_info.last_ymm = fpu_ymm7_i386;
- m_reg_info.first_dr = dr0_i386;
- m_reg_info.gpr_flags = gpr_eflags_i386;
- break;
- case ArchSpec::eCore_x86_64_x86_64:
- m_reg_info.num_registers = k_num_registers_x86_64;
- m_reg_info.num_gpr_registers = k_num_gpr_registers_x86_64;
- m_reg_info.num_fpr_registers = k_num_fpr_registers_x86_64;
- m_reg_info.num_avx_registers = k_num_avx_registers_x86_64;
- m_reg_info.last_gpr = k_last_gpr_x86_64;
- m_reg_info.first_fpr = k_first_fpr_x86_64;
- m_reg_info.last_fpr = k_last_fpr_x86_64;
- m_reg_info.first_st = fpu_st0_x86_64;
- m_reg_info.last_st = fpu_st7_x86_64;
- m_reg_info.first_mm = fpu_mm0_x86_64;
- m_reg_info.last_mm = fpu_mm7_x86_64;
- m_reg_info.first_xmm = fpu_xmm0_x86_64;
- m_reg_info.last_xmm = fpu_xmm15_x86_64;
- m_reg_info.first_ymm = fpu_ymm0_x86_64;
- m_reg_info.last_ymm = fpu_ymm15_x86_64;
- m_reg_info.first_dr = dr0_x86_64;
- m_reg_info.gpr_flags = gpr_rflags_x86_64;
- break;
- default:
- assert(false && "Unhandled target architecture.");
- break;
- }
-
- // 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(FPR));
-
- // elf-core yet to support ReadFPR()
- ProcessSP base = CalculateProcess();
- if (base.get()->GetPluginName() == ProcessElfCore::GetPluginNameStatic())
- return;
-
- m_fpr_type = eNotValid;
-}
-
-RegisterContextPOSIX_x86_64::~RegisterContextPOSIX_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
-RegisterContextPOSIX_x86_64::Invalidate()
-{
-}
-
-void
-RegisterContextPOSIX_x86_64::InvalidateAllRegisters()
-{
-}
-
-unsigned
-RegisterContextPOSIX_x86_64::GetRegisterOffset(unsigned reg)
-{
- assert(reg < m_reg_info.num_registers && "Invalid register number.");
- return GetRegisterInfo()[reg].byte_offset;
-}
-
-unsigned
-RegisterContextPOSIX_x86_64::GetRegisterSize(unsigned reg)
-{
- assert(reg < m_reg_info.num_registers && "Invalid register number.");
- return GetRegisterInfo()[reg].byte_size;
-}
-
-size_t
-RegisterContextPOSIX_x86_64::GetRegisterCount()
-{
- size_t num_registers = m_reg_info.num_gpr_registers + m_reg_info.num_fpr_registers;
- if (GetFPRType() == eXSAVE)
- return num_registers + m_reg_info.num_avx_registers;
- return num_registers;
-}
-
-size_t
-RegisterContextPOSIX_x86_64::GetGPRSize()
-{
- return m_register_info_ap->GetGPRSize ();
-}
-
-const RegisterInfo *
-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 m_register_info_ap->GetRegisterInfo ();
-}
-
-const RegisterInfo *
-RegisterContextPOSIX_x86_64::GetRegisterInfoAtIndex(size_t reg)
-{
- if (reg < m_reg_info.num_registers)
- return &GetRegisterInfo()[reg];
- else
- return NULL;
-}
-
-size_t
-RegisterContextPOSIX_x86_64::GetRegisterSetCount()
-{
- size_t sets = 0;
- for (size_t set = 0; set < k_num_register_sets; ++set)
- {
- if (IsRegisterSetAvailable(set))
- ++sets;
- }
-
- return sets;
-}
-
-const RegisterSet *
-RegisterContextPOSIX_x86_64::GetRegisterSet(size_t set)
-{
- if (IsRegisterSetAvailable(set))
- {
- switch (m_register_info_ap->m_target_arch.GetCore())
- {
- case ArchSpec::eCore_x86_32_i386:
- case ArchSpec::eCore_x86_32_i486:
- case ArchSpec::eCore_x86_32_i486sx:
- return &g_reg_sets_i386[set];
- case ArchSpec::eCore_x86_64_x86_64:
- return &g_reg_sets_x86_64[set];
- default:
- assert(false && "Unhandled target architecture.");
- return NULL;
- }
- }
- return NULL;
-}
-
-const char *
-RegisterContextPOSIX_x86_64::GetRegisterName(unsigned reg)
-{
- assert(reg < m_reg_info.num_registers && "Invalid register offset.");
- return GetRegisterInfo()[reg].name;
-}
-
-lldb::ByteOrder
-RegisterContextPOSIX_x86_64::GetByteOrder()
-{
- // Get the target process whose privileged thread was used for the register read.
- lldb::ByteOrder byte_order = eByteOrderInvalid;
- Process *process = CalculateProcess().get();
-
- if (process)
- byte_order = process->GetByteOrder();
- return byte_order;
-}
-
-// Parse ymm registers and into xmm.bytes and ymmh.bytes.
-bool RegisterContextPOSIX_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)
-{
- if (!IsAVX(reg))
- return false;
-
- if (byte_order == eByteOrderLittle)
- {
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
- sizeof(XMMReg));
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
- sizeof(YMMHReg));
- return true;
- }
-
- if (byte_order == eByteOrderBig)
- {
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
- sizeof(XMMReg));
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
- sizeof(YMMHReg));
- return true;
- }
- return false; // unsupported or invalid byte order
-}
-
-// Concatenate xmm.bytes with ymmh.bytes
-bool RegisterContextPOSIX_x86_64::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)
-{
- if (!IsAVX(reg))
- return false;
-
- if (byte_order == eByteOrderLittle)
- {
- ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
- m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
- sizeof(XMMReg));
- ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
- m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
- sizeof(YMMHReg));
- return true;
- }
-
- if (byte_order == eByteOrderBig)
- {
- ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),
- m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,
- sizeof(XMMReg));
- ::memcpy(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,
- m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,
- sizeof(YMMHReg));
- return true;
- }
- return false; // unsupported or invalid byte order
-}
-
-bool
-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 (GetFPRType() == eXSAVE) // ...and to start with AVX registers.
- ++num_sets;
- return (set_index < num_sets);
-}
-
-
-// Used when parsing DWARF and EH frame information and any other
-// object file sections that contain register numbers in them.
-uint32_t
-RegisterContextPOSIX_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind,
- uint32_t num)
-{
- const uint32_t num_regs = GetRegisterCount();
-
- assert (kind < kNumRegisterKinds);
- for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx)
- {
- const RegisterInfo *reg_info = GetRegisterInfoAtIndex (reg_idx);
-
- if (reg_info->kinds[kind] == num)
- return reg_idx;
- }
-
- return LLDB_INVALID_REGNUM;
-}
-
Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h?rev=192331&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h (removed)
@@ -1,337 +0,0 @@
-//===-- RegisterContextPOSIX_x86_64.h ---------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_RegisterContextPOSIX_x86_64_H_
-#define liblldb_RegisterContextPOSIX_x86_64_H_
-
-#include "lldb/Core/Log.h"
-#include "RegisterContextPOSIX.h"
-#include "RegisterContext_x86.h"
-
-class ProcessMonitor;
-
-//---------------------------------------------------------------------------
-// Internal codes for all x86_64 registers.
-//---------------------------------------------------------------------------
-enum
-{
- k_first_gpr_x86_64,
- gpr_rax_x86_64 = k_first_gpr_x86_64,
- gpr_rbx_x86_64,
- gpr_rcx_x86_64,
- gpr_rdx_x86_64,
- gpr_rdi_x86_64,
- gpr_rsi_x86_64,
- gpr_rbp_x86_64,
- gpr_rsp_x86_64,
- gpr_r8_x86_64,
- gpr_r9_x86_64,
- gpr_r10_x86_64,
- gpr_r11_x86_64,
- gpr_r12_x86_64,
- gpr_r13_x86_64,
- gpr_r14_x86_64,
- gpr_r15_x86_64,
- gpr_rip_x86_64,
- gpr_rflags_x86_64,
- gpr_cs_x86_64,
- gpr_fs_x86_64,
- gpr_gs_x86_64,
- gpr_ss_x86_64,
- gpr_ds_x86_64,
- gpr_es_x86_64,
-
- k_first_alias_x86_64,
- gpr_eax_x86_64 = k_first_alias_x86_64,
- gpr_ebx_x86_64,
- gpr_ecx_x86_64,
- gpr_edx_x86_64,
- gpr_edi_x86_64,
- gpr_esi_x86_64,
- gpr_ebp_x86_64,
- gpr_esp_x86_64,
- gpr_r8d_x86_64, // Low 32 bits of r8
- gpr_r9d_x86_64, // Low 32 bits of r9
- gpr_r10d_x86_64, // Low 32 bits of r10
- gpr_r11d_x86_64, // Low 32 bits of r11
- gpr_r12d_x86_64, // Low 32 bits of r12
- gpr_r13d_x86_64, // Low 32 bits of r13
- gpr_r14d_x86_64, // Low 32 bits of r14
- gpr_r15d_x86_64, // Low 32 bits of r15
- gpr_ax_x86_64,
- gpr_bx_x86_64,
- gpr_cx_x86_64,
- gpr_dx_x86_64,
- gpr_di_x86_64,
- gpr_si_x86_64,
- gpr_bp_x86_64,
- gpr_sp_x86_64,
- gpr_r8w_x86_64, // Low 16 bits of r8
- gpr_r9w_x86_64, // Low 16 bits of r9
- gpr_r10w_x86_64, // Low 16 bits of r10
- gpr_r11w_x86_64, // Low 16 bits of r11
- gpr_r12w_x86_64, // Low 16 bits of r12
- gpr_r13w_x86_64, // Low 16 bits of r13
- gpr_r14w_x86_64, // Low 16 bits of r14
- gpr_r15w_x86_64, // Low 16 bits of r15
- gpr_ah_x86_64,
- gpr_bh_x86_64,
- gpr_ch_x86_64,
- gpr_dh_x86_64,
- gpr_al_x86_64,
- gpr_bl_x86_64,
- gpr_cl_x86_64,
- gpr_dl_x86_64,
- gpr_dil_x86_64,
- gpr_sil_x86_64,
- gpr_bpl_x86_64,
- gpr_spl_x86_64,
- gpr_r8l_x86_64, // Low 8 bits of r8
- gpr_r9l_x86_64, // Low 8 bits of r9
- gpr_r10l_x86_64, // Low 8 bits of r10
- gpr_r11l_x86_64, // Low 8 bits of r11
- gpr_r12l_x86_64, // Low 8 bits of r12
- gpr_r13l_x86_64, // Low 8 bits of r13
- gpr_r14l_x86_64, // Low 8 bits of r14
- gpr_r15l_x86_64, // Low 8 bits of r15
- k_last_alias_x86_64 = gpr_r15l_x86_64,
-
- k_last_gpr_x86_64 = k_last_alias_x86_64,
-
- k_first_fpr_x86_64,
- fpu_fctrl_x86_64 = k_first_fpr_x86_64,
- fpu_fstat_x86_64,
- fpu_ftag_x86_64,
- fpu_fop_x86_64,
- fpu_fiseg_x86_64,
- fpu_fioff_x86_64,
- fpu_foseg_x86_64,
- fpu_fooff_x86_64,
- fpu_mxcsr_x86_64,
- fpu_mxcsrmask_x86_64,
- fpu_st0_x86_64,
- fpu_st1_x86_64,
- fpu_st2_x86_64,
- fpu_st3_x86_64,
- fpu_st4_x86_64,
- fpu_st5_x86_64,
- fpu_st6_x86_64,
- fpu_st7_x86_64,
- fpu_mm0_x86_64,
- fpu_mm1_x86_64,
- fpu_mm2_x86_64,
- fpu_mm3_x86_64,
- fpu_mm4_x86_64,
- fpu_mm5_x86_64,
- fpu_mm6_x86_64,
- fpu_mm7_x86_64,
- fpu_xmm0_x86_64,
- fpu_xmm1_x86_64,
- fpu_xmm2_x86_64,
- fpu_xmm3_x86_64,
- fpu_xmm4_x86_64,
- fpu_xmm5_x86_64,
- fpu_xmm6_x86_64,
- fpu_xmm7_x86_64,
- fpu_xmm8_x86_64,
- fpu_xmm9_x86_64,
- fpu_xmm10_x86_64,
- fpu_xmm11_x86_64,
- fpu_xmm12_x86_64,
- fpu_xmm13_x86_64,
- fpu_xmm14_x86_64,
- fpu_xmm15_x86_64,
- k_last_fpr_x86_64 = fpu_xmm15_x86_64,
-
- k_first_avx_x86_64,
- fpu_ymm0_x86_64 = k_first_avx_x86_64,
- fpu_ymm1_x86_64,
- fpu_ymm2_x86_64,
- fpu_ymm3_x86_64,
- fpu_ymm4_x86_64,
- fpu_ymm5_x86_64,
- fpu_ymm6_x86_64,
- fpu_ymm7_x86_64,
- fpu_ymm8_x86_64,
- fpu_ymm9_x86_64,
- fpu_ymm10_x86_64,
- fpu_ymm11_x86_64,
- fpu_ymm12_x86_64,
- fpu_ymm13_x86_64,
- fpu_ymm14_x86_64,
- fpu_ymm15_x86_64,
- k_last_avx_x86_64 = fpu_ymm15_x86_64,
-
- dr0_x86_64,
- dr1_x86_64,
- dr2_x86_64,
- dr3_x86_64,
- dr4_x86_64,
- dr5_x86_64,
- dr6_x86_64,
- dr7_x86_64,
-
- k_num_registers_x86_64,
- k_num_gpr_registers_x86_64 = k_last_gpr_x86_64 - k_first_gpr_x86_64 + 1,
- k_num_fpr_registers_x86_64 = k_last_fpr_x86_64 - k_first_fpr_x86_64 + 1,
- k_num_avx_registers_x86_64 = k_last_avx_x86_64 - k_first_avx_x86_64 + 1
-};
-
-class RegisterContextPOSIX_x86_64
- : public lldb_private::RegisterContext
-{
-public:
- RegisterContextPOSIX_x86_64 (lldb_private::Thread &thread,
- uint32_t concrete_frame_idx,
- RegisterInfoInterface *register_info);
-
- ~RegisterContextPOSIX_x86_64();
-
- void
- Invalidate();
-
- void
- InvalidateAllRegisters();
-
- size_t
- GetRegisterCount();
-
- virtual size_t
- GetGPRSize();
-
- virtual unsigned
- GetRegisterSize(unsigned reg);
-
- virtual unsigned
- GetRegisterOffset(unsigned reg);
-
- const lldb_private::RegisterInfo *
- GetRegisterInfoAtIndex(size_t reg);
-
- size_t
- GetRegisterSetCount();
-
- const lldb_private::RegisterSet *
- GetRegisterSet(size_t set);
-
- const char *
- GetRegisterName(unsigned reg);
-
- uint32_t
- ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num);
-
- //---------------------------------------------------------------------------
- // Note: prefer kernel definitions over user-land
- //---------------------------------------------------------------------------
- enum FPRType
- {
- eNotValid = 0,
- eFSAVE, // TODO
- eFXSAVE,
- eSOFT, // TODO
- eXSAVE
- };
-
- static uint32_t g_contained_rax[];
- static uint32_t g_contained_rbx[];
- static uint32_t g_contained_rcx[];
- static uint32_t g_contained_rdx[];
- static uint32_t g_contained_rdi[];
- static uint32_t g_contained_rsi[];
- static uint32_t g_contained_rbp[];
- static uint32_t g_contained_rsp[];
- static uint32_t g_contained_r8[];
- static uint32_t g_contained_r9[];
- static uint32_t g_contained_r10[];
- static uint32_t g_contained_r11[];
- static uint32_t g_contained_r12[];
- static uint32_t g_contained_r13[];
- static uint32_t g_contained_r14[];
- static uint32_t g_contained_r15[];
-
- static uint32_t g_invalidate_rax[];
- static uint32_t g_invalidate_rbx[];
- static uint32_t g_invalidate_rcx[];
- static uint32_t g_invalidate_rdx[];
- static uint32_t g_invalidate_rdi[];
- static uint32_t g_invalidate_rsi[];
- static uint32_t g_invalidate_rbp[];
- static uint32_t g_invalidate_rsp[];
- static uint32_t g_invalidate_r8[];
- static uint32_t g_invalidate_r9[];
- static uint32_t g_invalidate_r10[];
- static uint32_t g_invalidate_r11[];
- static uint32_t g_invalidate_r12[];
- static uint32_t g_invalidate_r13[];
- static uint32_t g_invalidate_r14[];
- static uint32_t g_invalidate_r15[];
-
-protected:
- struct RegInfo
- {
- uint32_t num_registers;
- uint32_t num_gpr_registers;
- uint32_t num_fpr_registers;
- uint32_t num_avx_registers;
-
- uint32_t last_gpr;
- uint32_t first_fpr;
- uint32_t last_fpr;
-
- uint32_t first_st;
- uint32_t last_st;
- uint32_t first_mm;
- uint32_t last_mm;
- uint32_t first_xmm;
- uint32_t last_xmm;
- uint32_t first_ymm;
- uint32_t last_ymm;
-
- uint32_t first_dr;
- uint32_t gpr_flags;
- };
-
- uint64_t m_gpr_x86_64[k_num_gpr_registers_x86_64]; // 64-bit general purpose registers.
- RegInfo m_reg_info;
- 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)
-
- // Determines if an extended register set is supported on the processor running the inferior process.
- virtual bool
- IsRegisterSetAvailable(size_t set_index);
-
- virtual const lldb_private::RegisterInfo *
- GetRegisterInfo();
-
- bool
- IsGPR(unsigned reg);
-
- bool
- IsFPR(unsigned reg);
-
- bool
- IsAVX(unsigned reg);
-
- 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();
-
- virtual bool ReadGPR() = 0;
- virtual bool ReadFPR() = 0;
- virtual bool WriteGPR() = 0;
- virtual bool WriteFPR() = 0;
-};
-
-#endif // #ifndef liblldb_RegisterContextPOSIX_x86_64_H_
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_i386.h?rev=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_i386.h Wed Oct 9 19:16:10 2013
@@ -77,13 +77,13 @@
#define DEFINE_GPR_PSEUDO_16(reg16, reg32) \
{ #reg16, NULL, 2, GPR_OFFSET(reg32), eEncodingUint, \
- eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg16##_i386 }, RegisterContextPOSIX_i386::g_contained_##reg32, RegisterContextPOSIX_i386::g_invalidate_##reg32 }
+ eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg16##_i386 }, RegisterContextPOSIX_x86::g_contained_##reg32, RegisterContextPOSIX_x86::g_invalidate_##reg32 }
#define DEFINE_GPR_PSEUDO_8H(reg8, reg32) \
{ #reg8, NULL, 1, GPR_OFFSET(reg32)+1, eEncodingUint, \
- eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_i386 }, RegisterContextPOSIX_i386::g_contained_##reg32, RegisterContextPOSIX_i386::g_invalidate_##reg32 }
+ eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_i386 }, RegisterContextPOSIX_x86::g_contained_##reg32, RegisterContextPOSIX_x86::g_invalidate_##reg32 }
#define DEFINE_GPR_PSEUDO_8L(reg8, reg32) \
{ #reg8, NULL, 1, GPR_OFFSET(reg32), eEncodingUint, \
- eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_i386 }, RegisterContextPOSIX_i386::g_contained_##reg32, RegisterContextPOSIX_i386::g_invalidate_##reg32 }
+ eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_i386 }, RegisterContextPOSIX_x86::g_contained_##reg32, RegisterContextPOSIX_x86::g_invalidate_##reg32 }
static RegisterInfo
g_register_infos_i386[] =
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_x86_64.h?rev=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterInfos_x86_64.h Wed Oct 9 19:16:10 2013
@@ -74,20 +74,18 @@
{ LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM }, NULL, NULL }
-#define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(RegisterContextPOSIX_x86_64::FPR))
-
#define DEFINE_GPR_PSEUDO_32(reg32, reg64) \
{ #reg32, NULL, 4, GPR_OFFSET(reg64), eEncodingUint, \
- eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg32##_x86_64 }, RegisterContextPOSIX_x86_64::g_contained_##reg64, RegisterContextPOSIX_x86_64::g_invalidate_##reg64 }
+ eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg32##_x86_64 }, RegisterContextPOSIX_x86::g_contained_##reg64, RegisterContextPOSIX_x86::g_invalidate_##reg64 }
#define DEFINE_GPR_PSEUDO_16(reg16, reg64) \
{ #reg16, NULL, 2, GPR_OFFSET(reg64), eEncodingUint, \
- eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg16##_x86_64 }, RegisterContextPOSIX_x86_64::g_contained_##reg64, RegisterContextPOSIX_x86_64::g_invalidate_##reg64 }
+ eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg16##_x86_64 }, RegisterContextPOSIX_x86::g_contained_##reg64, RegisterContextPOSIX_x86::g_invalidate_##reg64 }
#define DEFINE_GPR_PSEUDO_8H(reg8, reg64) \
{ #reg8, NULL, 1, GPR_OFFSET(reg64)+1, eEncodingUint, \
- eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_x86_64 }, RegisterContextPOSIX_x86_64::g_contained_##reg64, RegisterContextPOSIX_x86_64::g_invalidate_##reg64 }
+ eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_x86_64 }, RegisterContextPOSIX_x86::g_contained_##reg64, RegisterContextPOSIX_x86::g_invalidate_##reg64 }
#define DEFINE_GPR_PSEUDO_8L(reg8, reg64) \
{ #reg8, NULL, 1, GPR_OFFSET(reg64), eEncodingUint, \
- eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_x86_64 }, RegisterContextPOSIX_x86_64::g_contained_##reg64, RegisterContextPOSIX_x86_64::g_invalidate_##reg64 }
+ eFormatHex, { LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gpr_##reg8##_x86_64 }, RegisterContextPOSIX_x86::g_contained_##reg64, RegisterContextPOSIX_x86::g_invalidate_##reg64 }
static RegisterInfo
g_register_infos_x86_64[] =
@@ -260,7 +258,6 @@ static_assert((sizeof(g_register_infos_x
#undef DEFINE_XMM
#undef DEFINE_YMM
#undef DEFINE_DR
-#undef REG_CONTEXT_SIZE
#undef DEFINE_GPR_PSEUDO_32
#undef DEFINE_GPR_PSEUDO_16
#undef DEFINE_GPR_PSEUDO_8H
Modified: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp?rev=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp Wed Oct 9 19:16:10 2013
@@ -1,4 +1,4 @@
-//===-- RegisterContextCorePOSIX_x86_64.cpp -------------------------*- C++ -*-===//
+//===-- RegisterContextCorePOSIX_x86_64.cpp ---------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -19,7 +19,7 @@ RegisterContextCorePOSIX_x86_64::Registe
RegisterInfoInterface *register_info,
const DataExtractor &gpregset,
const DataExtractor &fpregset)
- : RegisterContextPOSIX_x86_64 (thread, 0, register_info)
+ : RegisterContextPOSIX_x86 (thread, 0, register_info)
{
size_t size, len;
Modified: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h?rev=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h Wed Oct 9 19:16:10 2013
@@ -10,10 +10,10 @@
#ifndef liblldb_RegisterContextCorePOSIX_x86_64_H_
#define liblldb_RegisterContextCorePOSIX_x86_64_H_
-#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h"
+#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86.h"
class RegisterContextCorePOSIX_x86_64 :
- public RegisterContextPOSIX_x86_64
+ public RegisterContextPOSIX_x86
{
public:
RegisterContextCorePOSIX_x86_64 (lldb_private::Thread &thread,
Modified: lldb/trunk/source/Symbol/UnwindTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindTable.cpp?rev=192332&r1=192331&r2=192332&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindTable.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindTable.cpp Wed Oct 9 19:16:10 2013
@@ -102,7 +102,7 @@ UnwindTable::GetFuncUnwindersContainingA
FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, m_assembly_profiler, range));
m_unwinds.insert (insert_pos, std::make_pair(range.GetBaseAddress().GetFileAddress(), func_unwinder_sp));
-// StreamFile s(stdout);
+// StreamFile s(stdout, false);
// Dump (s);
return func_unwinder_sp;
}
More information about the lldb-commits
mailing list