<div dir="ltr">> <span style="font-family:arial,sans-serif;font-size:13px">Is this something that you could restore in a separate commit? Thanks,</span><br><div class="gmail_extra"><br></div><div class="gmail_extra">Definitely. I'm right in the middle of another refactor - I'll send that out, get feedback, and once that's in I'll fix this up. Hopefully early next week.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Thanks for looking this over Ashok.</div><div class="gmail_extra"> -Mike<br><br><div class="gmail_quote">On Fri, Sep 13, 2013 at 11:56 AM, Thirumurthi, Ashok <span dir="ltr"><<a href="mailto:ashok.thirumurthi@intel.com" target="_blank">ashok.thirumurthi@intel.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Great work on the refactoring, Mike, it's really a solid and thoughtful effort and should move us in the direction of loading an ELF core on OS/X. Everything looks good and tests well, but I see that you also reinvented the container for RegisterInfo:<br>
<div class="im"><br>
// Use a singleton function to avoid global constructors in shared libraries.<br>
</div>RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64()<br>
{<br>
<div class="im"> static std::vector<RegisterInfo> g_register_infos;<br>
</div> return g_register_infos;<br>
}<br>
<br>
--><br>
<div class="im"><br>
std::vector<lldb_private::RegisterInfo> m_register_infos<br>
<br>
</div>The resulting code is very readable and maintainable, which is a great asset. I took the same path myself until I realized that the static register set is more efficient. Essentially, we frequently create a RegisterContext (i.e. each frame of each thread is a candidate), however once the architecture is known, the register information can be pinned down once for all frames. Hence all the hoops to allow a class hierarchy to use a static container.<br>
<br>
Is this something that you could restore in a separate commit? Thanks,<br>
<br>
- Ashok<br>
<div class=""><div class="h5"><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:lldb-commits-bounces@cs.uiuc.edu">lldb-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:lldb-commits-bounces@cs.uiuc.edu">lldb-commits-bounces@cs.uiuc.edu</a>] On Behalf Of Michael Sartain<br>
Sent: Thursday, September 12, 2013 8:18 PM<br>
To: <a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
Subject: [Lldb-commits] [lldb] r190647 - Cleanup POSIX RegisterContext class hierarchies.<br>
<br>
Author: mikesart<br>
Date: Thu Sep 12 19:18:17 2013<br>
New Revision: 190647<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=190647&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=190647&view=rev</a><br>
Log:<br>
Cleanup POSIX RegisterContext class hierarchies.<br>
<br>
Added:<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp<br>
- copied, changed from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h<br>
- copied, changed from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp<br>
- copied, changed from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h<br>
- copied, changed from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h<br>
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp<br>
- copied, changed from r190549, lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.h<br>
- copied, changed from r190549, lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h<br>
Removed:<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h<br>
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreFreeBSD_x86_64.h<br>
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextCoreLinux_x86_64.h<br>
Modified:<br>
lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt<br>
lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h<br>
lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h<br>
lldb/trunk/source/Plugins/Process/elf-core/CMakeLists.txt<br>
lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt?rev=190647&r1=190646&r2=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt?rev=190647&r1=190646&r2=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/CMakeLists.txt Thu Sep 12 19:18:17 2013<br>
@@ -10,8 +10,10 @@ add_lldb_library(lldbPluginProcessPOSIX<br>
ProcessMessage.cpp<br>
ProcessPOSIX.cpp<br>
ProcessPOSIXLog.cpp<br>
+ RegisterContextPOSIX_i386.cpp<br>
+ RegisterContextPOSIX_x86_64.cpp<br>
RegisterContextFreeBSD_x86_64.cpp<br>
- RegisterContext_i386.cpp<br>
RegisterContextLinux_x86_64.cpp<br>
- RegisterContext_x86_64.cpp<br>
+ RegisterContextPOSIXProcessMonitor_i386.cpp<br>
+ RegisterContextPOSIXProcessMonitor_x86_64.cpp<br>
)<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=190647&r1=190646&r2=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp?rev=190647&r1=190646&r2=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/POSIXThread.cpp Thu Sep 12 19:18:17 2013<br>
@@ -29,9 +29,9 @@<br>
#include "ProcessPOSIX.h"<br>
#include "ProcessPOSIXLog.h"<br>
#include "ProcessMonitor.h"<br>
-#include "RegisterContext_i386.h"<br>
-#include "RegisterContext_x86_64.h"<br>
-#include "RegisterContextPOSIX.h"<br>
+#include "RegisterContextPOSIX_i386.h"<br>
+#include "RegisterContextPOSIXProcessMonitor_i386.h"<br>
+#include "RegisterContextPOSIXProcessMonitor_x86_64.h"<br>
#include "RegisterContextLinux_x86_64.h"<br>
#include "RegisterContextFreeBSD_x86_64.h"<br>
<br>
@@ -149,17 +149,17 @@ POSIXThread::GetRegisterContext()<br>
case ArchSpec::eCore_x86_32_i386:<br>
case ArchSpec::eCore_x86_32_i486:<br>
case ArchSpec::eCore_x86_32_i486sx:<br>
- m_reg_context_sp.reset(new RegisterContext_i386(*this, 0));<br>
+ m_reg_context_sp.reset(new RegisterContextPOSIXProcessMonitor_i386(*this, 0));<br>
break;<br>
<br>
case ArchSpec::eCore_x86_64_x86_64:<br>
switch (arch.GetTriple().getOS())<br>
{<br>
case llvm::Triple::FreeBSD:<br>
- m_reg_context_sp.reset(new RegisterContextFreeBSD_x86_64(*this, 0));<br>
+ m_reg_context_sp.reset(new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, new RegisterContextFreeBSD_x86_64()));<br>
break;<br>
case llvm::Triple::Linux:<br>
- m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0));<br>
+ m_reg_context_sp.reset(new RegisterContextPOSIXProcessMonitor_x86_64(*this, 0, new RegisterContextLinux_x86_64()));<br>
break;<br>
default:<br>
assert(false && "OS not supported");<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp?rev=190647&r1=190646&r2=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp?rev=190647&r1=190646&r2=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.cpp Thu Sep 12 19:18:17 2013<br>
@@ -7,8 +7,8 @@<br>
//<br>
//===---------------------------------------------------------------------===//<br>
<br>
+#include "RegisterContextPOSIX_x86_64.h"<br>
#include "RegisterContextFreeBSD_x86_64.h"<br>
-#include <vector><br>
<br>
using namespace lldb_private;<br>
<br>
@@ -19,13 +19,13 @@ using namespace lldb_private;<br>
// Update the FreeBSD specific information (offset and size).<br>
#define UPDATE_GPR_INFO(reg) \<br>
do { \<br>
- GetRegisterContext()[gpr_##reg].byte_size = sizeof(GPR::reg); \<br>
- GetRegisterContext()[gpr_##reg].byte_offset = GPR_OFFSET(reg); \<br>
+ m_register_infos[gpr_##reg].byte_size = sizeof(GPR::reg); \<br>
+ m_register_infos[gpr_##reg].byte_offset = GPR_OFFSET(reg); \<br>
} while(false);<br>
<br>
#define UPDATE_I386_GPR_INFO(i386_reg, reg) \<br>
do { \<br>
- GetRegisterContext()[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg); \<br>
+ m_register_infos[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg); \<br>
} while(false);<br>
<br>
typedef struct _GPR<br>
@@ -58,15 +58,11 @@ typedef struct _GPR<br>
uint64_t ss;<br>
} GPR;<br>
<br>
-// Use a singleton function to avoid global constructors in shared libraries.<br>
-static std::vector<RegisterInfo> & GetRegisterContext () {<br>
- static std::vector<RegisterInfo> g_register_infos;<br>
- return g_register_infos;<br>
+RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64()<br>
+{<br>
}<br>
<br>
-<br>
-RegisterContextFreeBSD_x86_64::RegisterContextFreeBSD_x86_64(Thread &thread, uint32_t concrete_frame_idx):<br>
- RegisterContext_x86_64(thread, concrete_frame_idx)<br>
+RegisterContextFreeBSD_x86_64::~RegisterContextFreeBSD_x86_64()<br>
{<br>
}<br>
<br>
@@ -77,21 +73,17 @@ RegisterContextFreeBSD_x86_64::GetGPRSiz<br>
}<br>
<br>
const RegisterInfo *<br>
-RegisterContextFreeBSD_x86_64::GetRegisterInfo()<br>
+RegisterContextFreeBSD_x86_64::GetRegisterInfo(const RegisterInfo *base_info)<br>
{<br>
// Allocate RegisterInfo only once<br>
- if (GetRegisterContext().empty())<br>
+ if (m_register_infos.empty())<br>
{<br>
// Copy the register information from base class<br>
- const RegisterInfo *base_info = RegisterContext_x86_64::GetRegisterInfo();<br>
- if (base_info)<br>
- {<br>
- GetRegisterContext().insert(GetRegisterContext().end(), &base_info[0], &base_info[k_num_registers]);<br>
- // Update the FreeBSD specific register information (offset and size).<br>
- UpdateRegisterInfo();<br>
- }<br>
+ m_register_infos.insert(m_register_infos.end(), &base_info[0], &base_info[k_num_registers]);<br>
+ // Update the FreeBSD specific register information (offset and size).<br>
+ UpdateRegisterInfo();<br>
}<br>
- return &GetRegisterContext()[0];<br>
+ return &m_register_infos[0];<br>
}<br>
<br>
void<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h?rev=190647&r1=190646&r2=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h?rev=190647&r1=190646&r2=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextFreeBSD_x86_64.h Thu Sep 12 19:18:17 2013<br>
@@ -10,23 +10,27 @@<br>
#ifndef liblldb_RegisterContextFreeBSD_x86_64_H_<br>
#define liblldb_RegisterContextFreeBSD_x86_64_H_<br>
<br>
-#include "Plugins/Process/POSIX/RegisterContext_x86_64.h"<br>
+#include <vector><br>
+#include "RegisterContextPOSIX.h"<br>
<br>
class RegisterContextFreeBSD_x86_64:<br>
- public RegisterContext_x86_64<br>
+ public RegisterInfoInterface<br>
{<br>
public:<br>
- RegisterContextFreeBSD_x86_64(lldb_private::Thread &thread, uint32_t concrete_frame_idx);<br>
+ RegisterContextFreeBSD_x86_64();<br>
+ virtual ~RegisterContextFreeBSD_x86_64();<br>
<br>
size_t<br>
GetGPRSize();<br>
<br>
-protected:<br>
- virtual const lldb_private::RegisterInfo *<br>
- GetRegisterInfo();<br>
+ const lldb_private::RegisterInfo *<br>
+ GetRegisterInfo(const lldb_private::RegisterInfo *base_info);<br>
<br>
- virtual void<br>
+protected:<br>
+ void<br>
UpdateRegisterInfo();<br>
+<br>
+ std::vector<lldb_private::RegisterInfo> m_register_infos;<br>
};<br>
<br>
#endif<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp?rev=190647&r1=190646&r2=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp?rev=190647&r1=190646&r2=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.cpp Thu Sep 12 19:18:17 2013<br>
@@ -8,8 +8,8 @@<br>
//===---------------------------------------------------------------------===//<br>
<br>
#include "llvm/Support/Compiler.h"<br>
+#include "RegisterContextPOSIX_x86_64.h"<br>
#include "RegisterContextLinux_x86_64.h"<br>
-#include <vector><br>
<br>
using namespace lldb_private;<br>
<br>
@@ -20,13 +20,13 @@ using namespace lldb_private;<br>
// Update the Linux specific information (offset and size).<br>
#define UPDATE_GPR_INFO(reg) \<br>
do { \<br>
- GetRegisterContext()[gpr_##reg].byte_size = sizeof(GPR::reg); \<br>
- GetRegisterContext()[gpr_##reg].byte_offset = GPR_OFFSET(reg); \<br>
+ m_register_infos[gpr_##reg].byte_size = sizeof(GPR::reg); \<br>
+ m_register_infos[gpr_##reg].byte_offset = GPR_OFFSET(reg); \<br>
} while(false);<br>
<br>
#define UPDATE_I386_GPR_INFO(i386_reg, reg) \<br>
do { \<br>
- GetRegisterContext()[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg); \<br>
+ m_register_infos[gpr_##i386_reg].byte_offset = GPR_OFFSET(reg); \<br>
} while(false);<br>
<br>
#define DR_OFFSET(reg_index) \<br>
@@ -34,8 +34,8 @@ do {<br>
<br>
#define UPDATE_DR_INFO(reg_index) \<br>
do { \<br>
- GetRegisterContext()[dr##reg_index].byte_size = sizeof(UserArea::u_debugreg[0]); \<br>
- GetRegisterContext()[dr##reg_index].byte_offset = DR_OFFSET(reg_index); \<br>
+ m_register_infos[dr##reg_index].byte_size = sizeof(UserArea::u_debugreg[0]); \<br>
+ m_register_infos[dr##reg_index].byte_offset = DR_OFFSET(reg_index); \<br>
} while(false);<br>
<br>
typedef struct _GPR<br>
@@ -69,7 +69,7 @@ typedef struct _GPR<br>
uint64_t gs;<br>
} GPR;<br>
<br>
-typedef RegisterContext_x86_64::FXSAVE FXSAVE;<br>
+typedef RegisterContextPOSIX_x86_64::FXSAVE FXSAVE;<br>
<br>
struct UserArea<br>
{<br>
@@ -94,14 +94,11 @@ struct UserArea<br>
uint64_t fault_address; // Control register CR3.<br>
};<br>
<br>
-// Use a singleton function to avoid global constructors in shared libraries.<br>
-static std::vector<RegisterInfo> & GetRegisterContext () {<br>
- static std::vector<RegisterInfo> g_register_infos;<br>
- return g_register_infos;<br>
+RegisterContextLinux_x86_64::RegisterContextLinux_x86_64()<br>
+{<br>
}<br>
<br>
-RegisterContextLinux_x86_64::RegisterContextLinux_x86_64(Thread &thread, uint32_t concrete_frame_idx):<br>
- RegisterContext_x86_64(thread, concrete_frame_idx)<br>
+RegisterContextLinux_x86_64::~RegisterContextLinux_x86_64()<br>
{<br>
}<br>
<br>
@@ -112,21 +109,17 @@ RegisterContextLinux_x86_64::GetGPRSize(<br>
}<br>
<br>
const RegisterInfo *<br>
-RegisterContextLinux_x86_64::GetRegisterInfo()<br>
+RegisterContextLinux_x86_64::GetRegisterInfo(const RegisterInfo *base_info)<br>
{<br>
// Allocate RegisterInfo only once<br>
- if (GetRegisterContext().empty())<br>
+ if (m_register_infos.empty())<br>
{<br>
// Copy the register information from base class<br>
- const RegisterInfo *base_info = RegisterContext_x86_64::GetRegisterInfo();<br>
- if (base_info)<br>
- {<br>
- GetRegisterContext().insert(GetRegisterContext().end(), &base_info[0], &base_info[k_num_registers]);<br>
- // Update the Linux specific register information (offset and size).<br>
- UpdateRegisterInfo();<br>
- }<br>
+ m_register_infos.insert(m_register_infos.end(), &base_info[0], &base_info[k_num_registers]);<br>
+ // Update the Linux specific register information (offset and size).<br>
+ UpdateRegisterInfo();<br>
}<br>
- return &GetRegisterContext()[0];<br>
+ return &m_register_infos[0];<br>
}<br>
<br>
void<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h?rev=190647&r1=190646&r2=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h?rev=190647&r1=190646&r2=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextLinux_x86_64.h Thu Sep 12 19:18:17 2013<br>
@@ -10,23 +10,27 @@<br>
#ifndef liblldb_RegisterContextLinux_x86_64_H_<br>
#define liblldb_RegisterContextLinux_x86_64_H_<br>
<br>
-#include "Plugins/Process/POSIX/RegisterContext_x86_64.h"<br>
+#include <vector><br>
+#include "RegisterContextPOSIX.h"<br>
<br>
-class RegisterContextLinux_x86_64:<br>
- public RegisterContext_x86_64<br>
+class RegisterContextLinux_x86_64<br>
+ : public RegisterInfoInterface<br>
{<br>
public:<br>
- RegisterContextLinux_x86_64(lldb_private::Thread &thread, uint32_t concrete_frame_idx);<br>
+ RegisterContextLinux_x86_64();<br>
+ virtual ~RegisterContextLinux_x86_64();<br>
<br>
size_t<br>
GetGPRSize();<br>
<br>
-protected:<br>
- virtual const lldb_private::RegisterInfo *<br>
- GetRegisterInfo();<br>
+ const lldb_private::RegisterInfo *<br>
+ GetRegisterInfo(const lldb_private::RegisterInfo *base_info);<br>
<br>
- virtual void<br>
+protected:<br>
+ void<br>
UpdateRegisterInfo();<br>
+<br>
+ std::vector<lldb_private::RegisterInfo> m_register_infos;<br>
};<br>
<br>
#endif<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h?rev=190647&r1=190646&r2=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h?rev=190647&r1=190646&r2=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX.h Thu Sep 12 19:18:17 2013<br>
@@ -67,4 +67,21 @@ protected:<br>
bool m_watchpoints_initialized;<br>
};<br>
<br>
+//------------------------------------------------------------------------------<br>
+/// @class RegisterInfoInterface<br>
+///<br>
+/// @brief RegisterInfo interface to patch RegisterInfo structure for archs.<br>
+class RegisterInfoInterface<br>
+{<br>
+public:<br>
+ virtual ~RegisterInfoInterface() {}<br>
+<br>
+ virtual size_t<br>
+ GetGPRSize() = 0;<br>
+<br>
+ virtual const lldb_private::RegisterInfo *<br>
+ GetRegisterInfo(const lldb_private::RegisterInfo *base_info) = 0;<br>
+};<br>
+<br>
#endif // #ifndef liblldb_RegisterContextPOSIX_H_<br>
+<br>
<br>
Added: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp?rev=190647&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp?rev=190647&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp (added)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.cpp Thu Sep 12 19:18:17 2013<br>
@@ -0,0 +1,80 @@<br>
+//===-- RegisterContextPOSIXProcessMonitor_i386.h --------------*- C++ -*-===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===---------------------------------------------------------------------===//<br>
+<br>
+#include "lldb/Target/Thread.h"<br>
+<br>
+#include "ProcessPOSIX.h"<br>
+#include "RegisterContextPOSIXProcessMonitor_i386.h"<br>
+#include "ProcessMonitor.h"<br>
+<br>
+using namespace lldb_private;<br>
+using namespace lldb;<br>
+<br>
+RegisterContextPOSIXProcessMonitor_i386::RegisterContextPOSIXProcessMonitor_i386(Thread &thread,<br>
+ uint32_t concrete_frame_idx)<br>
+ : RegisterContextPOSIX_i386(thread, concrete_frame_idx)<br>
+{<br>
+}<br>
+<br>
+ProcessMonitor &<br>
+RegisterContextPOSIXProcessMonitor_i386::GetMonitor()<br>
+{<br>
+ ProcessSP base = CalculateProcess();<br>
+ ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());<br>
+ return process->GetMonitor();<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_i386::ReadGPR()<br>
+{<br>
+ bool result;<br>
+<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ result = monitor.ReadGPR(m_thread.GetID(), &m_user.regs, sizeof(m_user.regs));<br>
+ LogGPR("RegisterContextPOSIXProcessMonitor_i386::ReadGPR()");<br>
+ return result;<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_i386::ReadFPR()<br>
+{<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ return monitor.ReadFPR(m_thread.GetID(), &m_user.i387, sizeof(m_user.i387));<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_i386::WriteGPR()<br>
+{<br>
+ return false;<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_i386::WriteFPR()<br>
+{<br>
+ return false;<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_i386::ReadRegister(const RegisterInfo *reg_info,<br>
+ RegisterValue &value)<br>
+{<br>
+ const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ return monitor.ReadRegisterValue(m_thread.GetID(), GetRegOffset(reg),<br>
+ GetRegisterName(reg), GetRegSize(reg), value);<br>
+}<br>
+<br>
+bool RegisterContextPOSIXProcessMonitor_i386::WriteRegister(const RegisterInfo *reg_info,<br>
+ const RegisterValue &value)<br>
+{<br>
+ const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg),<br>
+ GetRegisterName(reg), value);<br>
+}<br>
<br>
Added: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h?rev=190647&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h?rev=190647&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h (added)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_i386.h Thu Sep 12 19:18:17 2013<br>
@@ -0,0 +1,46 @@<br>
+//===-- RegisterContextPOSIXProcessMonitor_i386.h ---------------*- C++ -*-===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef liblldb_RegisterContextPOSIXProcessMonitor_i386_H_<br>
+#define liblldb_RegisterContextPOSIXProcessMonitor_i386_H_<br>
+<br>
+#include "Plugins/Process/POSIX/RegisterContextPOSIX_i386.h"<br>
+<br>
+class RegisterContextPOSIXProcessMonitor_i386:<br>
+ public RegisterContextPOSIX_i386<br>
+{<br>
+public:<br>
+ RegisterContextPOSIXProcessMonitor_i386(lldb_private::Thread &thread,<br>
+ uint32_t concrete_frame_idx);<br>
+<br>
+protected:<br>
+ bool<br>
+ ReadGPR();<br>
+<br>
+ bool<br>
+ ReadFPR();<br>
+<br>
+ bool<br>
+ WriteGPR();<br>
+<br>
+ bool<br>
+ WriteFPR();<br>
+<br>
+ bool<br>
+ ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value);<br>
+<br>
+ bool<br>
+ WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value);<br>
+<br>
+private:<br>
+ ProcessMonitor &<br>
+ GetMonitor();<br>
+};<br>
+<br>
+#endif<br>
<br>
Added: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp?rev=190647&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp?rev=190647&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp (added)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.cpp Thu Sep 12 19:18:17 2013<br>
@@ -0,0 +1,98 @@<br>
+//===-- RegisterContextPOSIXProcessMonitor_x86_64.h ------------*- C++ -*-===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===---------------------------------------------------------------------===//<br>
+<br>
+#include "lldb/Target/Thread.h"<br>
+<br>
+#include "ProcessPOSIX.h"<br>
+#include "RegisterContextPOSIXProcessMonitor_x86_64.h"<br>
+#include "ProcessMonitor.h"<br>
+<br>
+using namespace lldb_private;<br>
+using namespace lldb;<br>
+<br>
+// Support ptrace extensions even when compiled without required kernel support<br>
+#ifndef NT_X86_XSTATE<br>
+ #define NT_X86_XSTATE 0x202<br>
+#endif<br>
+<br>
+RegisterContextPOSIXProcessMonitor_x86_64::RegisterContextPOSIXProcessMonitor_x86_64(Thread &thread,<br>
+ uint32_t concrete_frame_idx,<br>
+ RegisterInfoInterface *register_info)<br>
+ : RegisterContextPOSIX_x86_64(thread, concrete_frame_idx, register_info)<br>
+{<br>
+}<br>
+<br>
+ProcessMonitor &<br>
+RegisterContextPOSIXProcessMonitor_x86_64::GetMonitor()<br>
+{<br>
+ ProcessSP base = CalculateProcess();<br>
+ ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());<br>
+ return process->GetMonitor();<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_x86_64::ReadGPR()<br>
+{<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ return monitor.ReadGPR(m_thread.GetID(), &m_gpr, GetGPRSize());<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_x86_64::ReadFPR()<br>
+{<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ if (m_fpr_type == eFXSAVE)<br>
+ return monitor.ReadFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));<br>
+<br>
+ if (m_fpr_type == eXSAVE)<br>
+ return monitor.ReadRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);<br>
+ return false;<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_x86_64::WriteGPR()<br>
+{<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ return monitor.WriteGPR(m_thread.GetID(), &m_gpr, GetGPRSize());<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_x86_64::WriteFPR()<br>
+{<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ if (m_fpr_type == eFXSAVE)<br>
+ return monitor.WriteFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));<br>
+<br>
+ if (m_fpr_type == eXSAVE)<br>
+ return monitor.WriteRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);<br>
+ return false;<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_x86_64::ReadRegister(const unsigned reg,<br>
+ RegisterValue &value)<br>
+{<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ return monitor.ReadRegisterValue(m_thread.GetID(),<br>
+ GetRegisterOffset(reg),<br>
+ GetRegisterName(reg),<br>
+ GetRegisterSize(reg),<br>
+ value);<br>
+}<br>
+<br>
+bool<br>
+RegisterContextPOSIXProcessMonitor_x86_64::WriteRegister(const unsigned reg,<br>
+ const RegisterValue &value)<br>
+{<br>
+ ProcessMonitor &monitor = GetMonitor();<br>
+ return monitor.WriteRegisterValue(m_thread.GetID(),<br>
+ GetRegisterOffset(reg),<br>
+ GetRegisterName(reg),<br>
+ value);<br>
+}<br>
<br>
Added: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h?rev=190647&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h?rev=190647&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h (added)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86_64.h Thu Sep 12 19:18:17 2013<br>
@@ -0,0 +1,47 @@<br>
+//===-- RegisterContextPOSIXProcessMonitor_x86_64.h -------------*- C++ -*-===//<br>
+//<br>
+// The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef liblldb_RegisterContextPOSIXProcessMonitor_x86_64_H_<br>
+#define liblldb_RegisterContextPOSIXProcessMonitor_x86_64_H_<br>
+<br>
+#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h"<br>
+<br>
+class RegisterContextPOSIXProcessMonitor_x86_64:<br>
+ public RegisterContextPOSIX_x86_64<br>
+{<br>
+public:<br>
+ RegisterContextPOSIXProcessMonitor_x86_64(lldb_private::Thread &thread,<br>
+ uint32_t concrete_frame_idx,<br>
+ RegisterInfoInterface *register_info);<br>
+<br>
+protected:<br>
+ bool<br>
+ ReadGPR();<br>
+<br>
+ bool<br>
+ ReadFPR();<br>
+<br>
+ bool<br>
+ WriteGPR();<br>
+<br>
+ bool<br>
+ WriteFPR();<br>
+<br>
+ bool<br>
+ ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);<br>
+<br>
+ bool<br>
+ WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value);<br>
+<br>
+private:<br>
+ ProcessMonitor &<br>
+ GetMonitor();<br>
+};<br>
+<br>
+#endif<br>
<br>
Copied: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp (from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp&r1=190549&r2=190647&rev=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp&r1=190549&r2=190647&rev=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.cpp Thu Sep 12 19:18:17 2013<br>
@@ -15,7 +15,7 @@<br>
#include "ProcessPOSIX.h"<br>
#include "ProcessPOSIXLog.h"<br>
#include "ProcessMonitor.h"<br>
-#include "RegisterContext_i386.h"<br>
+#include "RegisterContextPOSIX_i386.h"<br>
#include "RegisterContext_x86.h"<br>
<br>
using namespace lldb_private;<br>
@@ -147,25 +147,25 @@ g_reg_sets[k_num_register_sets] =<br>
<br>
// Computes the offset of the given GPR in the user data area.<br>
#define GPR_OFFSET(regname) \<br>
- (offsetof(RegisterContext_i386::UserArea, regs) + \<br>
- offsetof(RegisterContext_i386::GPR, regname))<br>
+ (offsetof(RegisterContextPOSIX_i386::UserArea, regs) + \<br>
+ offsetof(RegisterContextPOSIX_i386::GPR, regname))<br>
<br>
// Computes the offset of the given FPR in the user data area.<br>
#define FPR_OFFSET(regname) \<br>
- (offsetof(RegisterContext_i386::UserArea, i387) + \<br>
- offsetof(RegisterContext_i386::FPU, regname))<br>
+ (offsetof(RegisterContextPOSIX_i386::UserArea, i387) + \<br>
+ offsetof(RegisterContextPOSIX_i386::FPU, regname))<br>
<br>
// Number of bytes needed to represent a GPR.<br>
-#define GPR_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)<br>
+#define GPR_SIZE(reg) sizeof(((RegisterContextPOSIX_i386::GPR*)NULL)->reg)<br>
<br>
// Number of bytes needed to represent a FPR.<br>
-#define FPR_SIZE(reg) sizeof(((RegisterContext_i386::FPU*)NULL)->reg)<br>
+#define FPR_SIZE(reg) sizeof(((RegisterContextPOSIX_i386::FPU*)NULL)->reg)<br>
<br>
// Number of bytes needed to represent the i'th FP register.<br>
-#define FP_SIZE sizeof(((RegisterContext_i386::MMSReg*)NULL)->bytes)<br>
+#define FP_SIZE sizeof(((RegisterContextPOSIX_i386::MMSReg*)NULL)->bytes)<br>
<br>
// Number of bytes needed to represent an XMM register.<br>
-#define XMM_SIZE sizeof(RegisterContext_i386::XMMReg)<br>
+#define XMM_SIZE sizeof(RegisterContextPOSIX_i386::XMMReg)<br>
<br>
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \<br>
{ #reg, alt, GPR_SIZE(reg), GPR_OFFSET(reg), eEncodingUint, \<br>
@@ -244,55 +244,47 @@ g_register_infos[k_num_registers] =<br>
static size_t k_num_register_infos = (sizeof(g_register_infos)/sizeof(RegisterInfo));<br>
#endif<br>
<br>
-static unsigned GetRegOffset(unsigned reg)<br>
+unsigned RegisterContextPOSIX_i386::GetRegOffset(unsigned reg)<br>
{<br>
assert(reg < k_num_registers && "Invalid register number.");<br>
return g_register_infos[reg].byte_offset;<br>
}<br>
<br>
-static unsigned GetRegSize(unsigned reg)<br>
+unsigned RegisterContextPOSIX_i386::GetRegSize(unsigned reg)<br>
{<br>
assert(reg < k_num_registers && "Invalid register number.");<br>
return g_register_infos[reg].byte_size;<br>
}<br>
<br>
-RegisterContext_i386::RegisterContext_i386(Thread &thread,<br>
+RegisterContextPOSIX_i386::RegisterContextPOSIX_i386(Thread &thread,<br>
uint32_t concrete_frame_idx)<br>
: RegisterContextPOSIX(thread, concrete_frame_idx)<br>
{<br>
}<br>
<br>
-RegisterContext_i386::~RegisterContext_i386()<br>
+RegisterContextPOSIX_i386::~RegisterContextPOSIX_i386()<br>
{<br>
}<br>
<br>
-ProcessMonitor &<br>
-RegisterContext_i386::GetMonitor()<br>
-{<br>
- ProcessSP base = CalculateProcess();<br>
- ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());<br>
- return process->GetMonitor();<br>
-}<br>
-<br>
void<br>
-RegisterContext_i386::Invalidate()<br>
+RegisterContextPOSIX_i386::Invalidate()<br>
{<br>
}<br>
<br>
void<br>
-RegisterContext_i386::InvalidateAllRegisters()<br>
+RegisterContextPOSIX_i386::InvalidateAllRegisters()<br>
{<br>
}<br>
<br>
size_t<br>
-RegisterContext_i386::GetRegisterCount()<br>
+RegisterContextPOSIX_i386::GetRegisterCount()<br>
{<br>
assert(k_num_register_infos == k_num_registers);<br>
return k_num_registers;<br>
}<br>
<br>
const RegisterInfo *<br>
-RegisterContext_i386::GetRegisterInfoAtIndex(size_t reg)<br>
+RegisterContextPOSIX_i386::GetRegisterInfoAtIndex(size_t reg)<br>
{<br>
assert(k_num_register_infos == k_num_registers);<br>
if (reg < k_num_registers)<br>
@@ -302,13 +294,13 @@ RegisterContext_i386::GetRegisterInfoAtI<br>
}<br>
<br>
size_t<br>
-RegisterContext_i386::GetRegisterSetCount()<br>
+RegisterContextPOSIX_i386::GetRegisterSetCount()<br>
{<br>
return k_num_register_sets;<br>
}<br>
<br>
const RegisterSet *<br>
-RegisterContext_i386::GetRegisterSet(size_t set)<br>
+RegisterContextPOSIX_i386::GetRegisterSet(size_t set)<br>
{<br>
if (set < k_num_register_sets)<br>
return &g_reg_sets[set];<br>
@@ -317,7 +309,7 @@ RegisterContext_i386::GetRegisterSet(siz<br>
}<br>
<br>
unsigned<br>
-RegisterContext_i386::GetRegisterIndexFromOffset(unsigned offset)<br>
+RegisterContextPOSIX_i386::GetRegisterIndexFromOffset(unsigned offset)<br>
{<br>
unsigned reg;<br>
for (reg = 0; reg < k_num_registers; reg++)<br>
@@ -330,45 +322,26 @@ RegisterContext_i386::GetRegisterIndexFr<br>
}<br>
<br>
const char *<br>
-RegisterContext_i386::GetRegisterName(unsigned reg)<br>
+RegisterContextPOSIX_i386::GetRegisterName(unsigned reg)<br>
{<br>
assert(reg < k_num_registers && "Invalid register offset.");<br>
return g_register_infos[reg].name;<br>
}<br>
<br>
bool<br>
-RegisterContext_i386::ReadRegister(const RegisterInfo *reg_info,<br>
- RegisterValue &value)<br>
-{<br>
- const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.ReadRegisterValue(m_thread.GetID(), GetRegOffset(reg),<br>
- GetRegisterName(reg), GetRegSize(reg), value);<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::ReadAllRegisterValues(DataBufferSP &data_sp)<br>
+RegisterContextPOSIX_i386::ReadAllRegisterValues(DataBufferSP &data_sp)<br>
{<br>
return false;<br>
}<br>
<br>
-bool RegisterContext_i386::WriteRegister(const RegisterInfo *reg_info,<br>
- const RegisterValue &value)<br>
-{<br>
- const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg),<br>
- GetRegisterName(reg), value);<br>
-}<br>
-<br>
bool<br>
-RegisterContext_i386::WriteAllRegisterValues(const DataBufferSP &data)<br>
+RegisterContextPOSIX_i386::WriteAllRegisterValues(const DataBufferSP &data)<br>
{<br>
return false;<br>
}<br>
<br>
bool<br>
-RegisterContext_i386::UpdateAfterBreakpoint()<br>
+RegisterContextPOSIX_i386::UpdateAfterBreakpoint()<br>
{<br>
// PC points one byte past the int3 responsible for the breakpoint.<br>
lldb::addr_t pc;<br>
@@ -381,7 +354,7 @@ RegisterContext_i386::UpdateAfterBreakpo<br>
}<br>
<br>
uint32_t<br>
-RegisterContext_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,<br>
+RegisterContextPOSIX_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,<br>
uint32_t num)<br>
{<br>
if (kind == eRegisterKindGeneric)<br>
@@ -490,7 +463,7 @@ RegisterContext_i386::ConvertRegisterKin<br>
}<br>
<br>
bool<br>
-RegisterContext_i386::HardwareSingleStep(bool enable)<br>
+RegisterContextPOSIX_i386::HardwareSingleStep(bool enable)<br>
{<br>
enum { TRACE_BIT = 0x100 };<br>
uint64_t eflags;<br>
@@ -517,7 +490,7 @@ RegisterContext_i386::HardwareSingleStep<br>
}<br>
<br>
void<br>
-RegisterContext_i386::LogGPR(const char *title)<br>
+RegisterContextPOSIX_i386::LogGPR(const char *title)<br>
{<br>
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));<br>
if (log)<br>
@@ -527,25 +500,7 @@ RegisterContext_i386::LogGPR(const char<br>
for (uint32_t i=0; i<k_num_gpr_registers; i++)<br>
{<br>
uint32_t reg = gpr_eax + i;<br>
- log->Printf("%12s = 0x%8.8" PRIx64, g_register_infos[reg].name, ((uint64_t*)&user.regs)[reg]);<br>
+ log->Printf("%12s = 0x%8.8" PRIx64, g_register_infos[reg].name, ((uint64_t*)&m_user.regs)[reg]);<br>
}<br>
}<br>
}<br>
-<br>
-bool<br>
-RegisterContext_i386::ReadGPR()<br>
-{<br>
- bool result;<br>
-<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- result = monitor.ReadGPR(m_thread.GetID(), &user.regs, sizeof(user.regs));<br>
- LogGPR("RegisterContext_i386::ReadGPR()");<br>
- return result;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::ReadFPR()<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.ReadFPR(m_thread.GetID(), &user.i387, sizeof(user.i387));<br>
-}<br>
<br>
Copied: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h (from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h&r1=190549&r2=190647&rev=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h&r1=190549&r2=190647&rev=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_i386.h Thu Sep 12 19:18:17 2013<br>
@@ -1,4 +1,4 @@<br>
-//===-- RegisterContext_i386.h ------------------------------*- C++ -*-===//<br>
+//===-- RegisterContextPOSIX_i386.h -----------------------------*- C++ -*-===//<br>
//<br>
// The LLVM Compiler Infrastructure<br>
//<br>
@@ -17,13 +17,14 @@<br>
#include "lldb/Core/Log.h"<br>
#include "RegisterContextPOSIX.h"<br>
<br>
-class RegisterContext_i386 : public RegisterContextPOSIX<br>
+class RegisterContextPOSIX_i386 :<br>
+ public RegisterContextPOSIX<br>
{<br>
public:<br>
- RegisterContext_i386(lldb_private::Thread &thread,<br>
+ RegisterContextPOSIX_i386(lldb_private::Thread &thread,<br>
uint32_t concreate_frame_idx);<br>
<br>
- ~RegisterContext_i386();<br>
+ ~RegisterContextPOSIX_i386();<br>
<br>
void<br>
Invalidate();<br>
@@ -57,7 +58,7 @@ public:<br>
<br>
virtual bool<br>
ReadRegister(const lldb_private::RegisterInfo *reg_info,<br>
- lldb_private::RegisterValue &value);<br>
+ lldb_private::RegisterValue &value) = 0;<br>
<br>
bool<br>
ReadAllRegisterValues(lldb::DataBufferSP &data_sp);<br>
@@ -71,7 +72,7 @@ public:<br>
<br>
virtual bool<br>
WriteRegister(const lldb_private::RegisterInfo *reg_info,<br>
- const lldb_private::RegisterValue &value);<br>
+ const lldb_private::RegisterValue &value) = 0;<br>
<br>
bool<br>
WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);<br>
@@ -155,15 +156,19 @@ public:<br>
char u_comm[32]; // Command causing core dump.<br>
uint32_t u_debugreg[8]; // Debug registers (DR0 - DR7).<br>
};<br>
-private:<br>
- UserArea user;<br>
<br>
- ProcessMonitor &GetMonitor();<br>
+protected:<br>
+ UserArea m_user;<br>
+<br>
+ static unsigned GetRegOffset(unsigned reg);<br>
+ static unsigned GetRegSize(unsigned reg);<br>
<br>
void LogGPR(const char *title);<br>
<br>
- bool ReadGPR();<br>
- bool ReadFPR();<br>
+ virtual bool ReadGPR() = 0;<br>
+ virtual bool ReadFPR() = 0;<br>
+ virtual bool WriteGPR() = 0;<br>
+ virtual bool WriteFPR() = 0;<br>
};<br>
<br>
#endif // #ifndef liblldb_RegisterContext_i386_h_<br>
<br>
Copied: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp (from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp&r1=190549&r2=190647&rev=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp&r1=190549&r2=190647&rev=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.cpp Thu Sep 12 19:18:17 2013<br>
@@ -1,4 +1,4 @@<br>
-//===-- RegisterContext_x86_64.cpp -------------------------*- C++ -*-===//<br>
+//===-- RegisterContextPOSIX_x86_64.cpp -------------------------*- C++ -*-===//<br>
//<br>
// The LLVM Compiler Infrastructure<br>
//<br>
@@ -21,22 +21,14 @@<br>
#include "llvm/Support/Compiler.h"<br>
<br>
#include "ProcessPOSIX.h"<br>
-#if defined(__linux__) or defined(__FreeBSD__)<br>
-#include "ProcessMonitor.h"<br>
-#endif<br>
-#include "RegisterContext_i386.h"<br>
+#include "RegisterContextPOSIX_i386.h"<br>
#include "RegisterContext_x86.h"<br>
-#include "RegisterContext_x86_64.h"<br>
+#include "RegisterContextPOSIX_x86_64.h"<br>
#include "Plugins/Process/elf-core/ProcessElfCore.h"<br>
<br>
using namespace lldb_private;<br>
using namespace lldb;<br>
<br>
-// Support ptrace extensions even when compiled without required kernel support<br>
-#ifndef NT_X86_XSTATE<br>
- #define NT_X86_XSTATE 0x202<br>
-#endif<br>
-<br>
enum<br>
{<br>
gcc_dwarf_gpr_rax = 0,<br>
@@ -291,27 +283,27 @@ g_reg_sets[k_num_register_sets] =<br>
<br>
// Computes the offset of the given FPR in the extended data area.<br>
#define FPR_OFFSET(regname) \<br>
- (offsetof(RegisterContext_x86_64::FPR, xstate) + \<br>
- offsetof(RegisterContext_x86_64::FXSAVE, regname))<br>
+ (offsetof(RegisterContextPOSIX_x86_64::FPR, xstate) + \<br>
+ offsetof(RegisterContextPOSIX_x86_64::FXSAVE, regname))<br>
<br>
// Computes the offset of the YMM register assembled from register halves.<br>
#define YMM_OFFSET(regname) \<br>
- (offsetof(RegisterContext_x86_64::YMM, regname))<br>
+ (offsetof(RegisterContextPOSIX_x86_64::YMM, regname))<br>
<br>
// Number of bytes needed to represent a i386 GPR<br>
-#define GPR_i386_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)<br>
+#define GPR_i386_SIZE(reg) sizeof(((RegisterContextPOSIX_i386::GPR*)NULL)->reg)<br>
<br>
// Number of bytes needed to represent a FPR.<br>
-#define FPR_SIZE(reg) sizeof(((RegisterContext_x86_64::FXSAVE*)NULL)->reg)<br>
+#define FPR_SIZE(reg) sizeof(((RegisterContextPOSIX_x86_64::FXSAVE*)NULL)->reg)<br>
<br>
// Number of bytes needed to represent the i'th FP register.<br>
-#define FP_SIZE sizeof(((RegisterContext_x86_64::MMSReg*)NULL)->bytes)<br>
+#define FP_SIZE sizeof(((RegisterContextPOSIX_x86_64::MMSReg*)NULL)->bytes)<br>
<br>
// Number of bytes needed to represent an XMM register.<br>
-#define XMM_SIZE sizeof(RegisterContext_x86_64::XMMReg)<br>
+#define XMM_SIZE sizeof(RegisterContextPOSIX_x86_64::XMMReg)<br>
<br>
// Number of bytes needed to represent a YMM register.<br>
-#define YMM_SIZE sizeof(RegisterContext_x86_64::YMMReg)<br>
+#define YMM_SIZE sizeof(RegisterContextPOSIX_x86_64::YMMReg)<br>
<br>
// Note that the size and offset will be updated by platform-specific classes.<br>
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \<br>
@@ -352,7 +344,7 @@ static uint32_t value_regs = LLDB_INVALI<br>
{ LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \<br>
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM }, NULL, NULL }<br>
<br>
-#define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(RegisterContext_x86_64::FPR))<br>
+#define REG_CONTEXT_SIZE (GetGPRSize() + sizeof(RegisterContextPOSIX_x86_64::FPR))<br>
<br>
static RegisterInfo<br>
g_register_infos[k_num_registers] =<br>
@@ -464,100 +456,118 @@ g_register_infos[k_num_registers] =<br>
DEFINE_DR(dr, 7)<br>
};<br>
<br>
-static bool IsGPR(unsigned reg)<br>
+bool RegisterContextPOSIX_x86_64::IsGPR(unsigned reg)<br>
{<br>
return reg <= k_last_gpr; // GPR's come first.<br>
}<br>
<br>
-static bool IsAVX(unsigned reg)<br>
+bool RegisterContextPOSIX_x86_64::IsAVX(unsigned reg)<br>
{<br>
return (k_first_avx <= reg && reg <= k_last_avx);<br>
}<br>
-static bool IsFPR(unsigned reg)<br>
+<br>
+bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg)<br>
{<br>
return (k_first_fpr <= reg && reg <= k_last_fpr);<br>
}<br>
<br>
-<br>
-bool RegisterContext_x86_64::IsFPR(unsigned reg, FPRType fpr_type)<br>
+bool RegisterContextPOSIX_x86_64::IsFPR(unsigned reg, FPRType fpr_type)<br>
{<br>
- bool generic_fpr = ::IsFPR(reg);<br>
+ bool generic_fpr = IsFPR(reg);<br>
if (fpr_type == eXSAVE)<br>
return generic_fpr || IsAVX(reg);<br>
<br>
return generic_fpr;<br>
}<br>
<br>
-RegisterContext_x86_64::RegisterContext_x86_64(Thread &thread,<br>
- uint32_t concrete_frame_idx)<br>
+RegisterContextPOSIX_x86_64::RegisterContextPOSIX_x86_64(Thread &thread,<br>
+ uint32_t concrete_frame_idx,<br>
+ RegisterInfoInterface *register_info)<br>
: RegisterContextPOSIX(thread, concrete_frame_idx)<br>
{<br>
+ m_register_info_ap.reset(register_info);<br>
+<br>
// Initialize m_iovec to point to the buffer and buffer size<br>
// using the conventions of Berkeley style UIO structures, as required<br>
// by PTRACE extensions.<br>
m_iovec.iov_base = &m_fpr.xstate.xsave;<br>
m_iovec.iov_len = sizeof(m_fpr.xstate.xsave);<br>
<br>
- ::memset(&m_fpr, 0, sizeof(RegisterContext_x86_64::FPR));<br>
+ ::memset(&m_fpr, 0, sizeof(RegisterContextPOSIX_x86_64::FPR));<br>
<br>
// elf-core yet to support ReadFPR()<br>
ProcessSP base = CalculateProcess();<br>
if (base.get()->GetPluginName() == ProcessElfCore::GetPluginNameStatic())<br>
return;<br>
<br>
- // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx<br>
- m_fpr_type = eXSAVE; // extended floating-point registers, if available<br>
- if (false == ReadFPR())<br>
- m_fpr_type = eFXSAVE; // assume generic floating-point registers<br>
+ m_fpr_type = eNotValid;<br>
+}<br>
+<br>
+RegisterContextPOSIX_x86_64::~RegisterContextPOSIX_x86_64()<br>
+{<br>
}<br>
<br>
-RegisterContext_x86_64::~RegisterContext_x86_64()<br>
+RegisterContextPOSIX_x86_64::FPRType RegisterContextPOSIX_x86_64::GetFPRType()<br>
{<br>
+ if (m_fpr_type == eNotValid)<br>
+ {<br>
+ // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx<br>
+ m_fpr_type = eXSAVE; // extended floating-point registers, if available<br>
+ if (false == ReadFPR())<br>
+ m_fpr_type = eFXSAVE; // assume generic floating-point registers<br>
+ }<br>
+ return m_fpr_type;<br>
}<br>
<br>
void<br>
-RegisterContext_x86_64::Invalidate()<br>
+RegisterContextPOSIX_x86_64::Invalidate()<br>
{<br>
}<br>
<br>
void<br>
-RegisterContext_x86_64::InvalidateAllRegisters()<br>
+RegisterContextPOSIX_x86_64::InvalidateAllRegisters()<br>
{<br>
}<br>
<br>
unsigned<br>
-RegisterContext_x86_64::GetRegisterOffset(unsigned reg)<br>
+RegisterContextPOSIX_x86_64::GetRegisterOffset(unsigned reg)<br>
{<br>
assert(reg < k_num_registers && "Invalid register number.");<br>
return GetRegisterInfo()[reg].byte_offset;<br>
}<br>
<br>
unsigned<br>
-RegisterContext_x86_64::GetRegisterSize(unsigned reg)<br>
+RegisterContextPOSIX_x86_64::GetRegisterSize(unsigned reg)<br>
{<br>
assert(reg < k_num_registers && "Invalid register number.");<br>
return GetRegisterInfo()[reg].byte_size;<br>
}<br>
<br>
size_t<br>
-RegisterContext_x86_64::GetRegisterCount()<br>
+RegisterContextPOSIX_x86_64::GetRegisterCount()<br>
{<br>
size_t num_registers = k_num_gpr_registers + k_num_fpr_registers;<br>
- if (m_fpr_type == eXSAVE)<br>
+ if (GetFPRType() == eXSAVE)<br>
return num_registers + k_num_avx_registers;<br>
return num_registers;<br>
}<br>
<br>
+size_t<br>
+RegisterContextPOSIX_x86_64::GetGPRSize()<br>
+{<br>
+ return m_register_info_ap->GetGPRSize();<br>
+}<br>
+<br>
const RegisterInfo *<br>
-RegisterContext_x86_64::GetRegisterInfo()<br>
+RegisterContextPOSIX_x86_64::GetRegisterInfo()<br>
{<br>
// Commonly, this method is overridden and g_register_infos is copied and specialized.<br>
// So, use GetRegisterInfo() rather than g_register_infos in this scope.<br>
- return g_register_infos;<br>
+ return m_register_info_ap->GetRegisterInfo(g_register_infos);<br>
}<br>
<br>
const RegisterInfo *<br>
-RegisterContext_x86_64::GetRegisterInfoAtIndex(size_t reg)<br>
+RegisterContextPOSIX_x86_64::GetRegisterInfoAtIndex(size_t reg)<br>
{<br>
if (reg < k_num_registers)<br>
return &GetRegisterInfo()[reg];<br>
@@ -566,7 +576,7 @@ RegisterContext_x86_64::GetRegisterInfoA<br>
}<br>
<br>
size_t<br>
-RegisterContext_x86_64::GetRegisterSetCount()<br>
+RegisterContextPOSIX_x86_64::GetRegisterSetCount()<br>
{<br>
size_t sets = 0;<br>
for (size_t set = 0; set < k_num_register_sets; ++set)<br>
@@ -577,7 +587,7 @@ RegisterContext_x86_64::GetRegisterSetCo<br>
}<br>
<br>
const RegisterSet *<br>
-RegisterContext_x86_64::GetRegisterSet(size_t set)<br>
+RegisterContextPOSIX_x86_64::GetRegisterSet(size_t set)<br>
{<br>
if (IsRegisterSetAvailable(set))<br>
return &g_reg_sets[set];<br>
@@ -586,7 +596,7 @@ RegisterContext_x86_64::GetRegisterSet(s<br>
}<br>
<br>
unsigned<br>
-RegisterContext_x86_64::GetRegisterIndexFromOffset(unsigned offset)<br>
+RegisterContextPOSIX_x86_64::GetRegisterIndexFromOffset(unsigned offset)<br>
{<br>
unsigned reg;<br>
for (reg = 0; reg < k_num_registers; reg++)<br>
@@ -599,14 +609,14 @@ RegisterContext_x86_64::GetRegisterIndex<br>
}<br>
<br>
const char *<br>
-RegisterContext_x86_64::GetRegisterName(unsigned reg)<br>
+RegisterContextPOSIX_x86_64::GetRegisterName(unsigned reg)<br>
{<br>
assert(reg < k_num_registers && "Invalid register offset.");<br>
return GetRegisterInfo()[reg].name;<br>
}<br>
<br>
lldb::ByteOrder<br>
-RegisterContext_x86_64::GetByteOrder()<br>
+RegisterContextPOSIX_x86_64::GetByteOrder()<br>
{<br>
// Get the target process whose privileged thread was used for the register read.<br>
lldb::ByteOrder byte_order = eByteOrderInvalid;<br>
@@ -618,7 +628,7 @@ RegisterContext_x86_64::GetByteOrder()<br>
}<br>
<br>
// Parse ymm registers and into xmm.bytes and ymmh.bytes.<br>
-bool RegisterContext_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)<br>
+bool RegisterContextPOSIX_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)<br>
{<br>
if (!IsAVX(reg))<br>
return false;<br>
@@ -626,27 +636,27 @@ bool RegisterContext_x86_64::CopyYMMtoXS<br>
if (byte_order == eByteOrderLittle) {<br>
::memcpy(m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,<br>
m_ymm_set.ymm[reg - fpu_ymm0].bytes,<br>
- sizeof(RegisterContext_x86_64::XMMReg));<br>
+ sizeof(RegisterContextPOSIX_x86_64::XMMReg));<br>
::memcpy(m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,<br>
- m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),<br>
- sizeof(RegisterContext_x86_64::YMMHReg));<br>
+ m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),<br>
+ sizeof(RegisterContextPOSIX_x86_64::YMMHReg));<br>
return true;<br>
}<br>
<br>
if (byte_order == eByteOrderBig) {<br>
::memcpy(m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,<br>
- m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),<br>
- sizeof(RegisterContext_x86_64::XMMReg));<br>
+ m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),<br>
+ sizeof(RegisterContextPOSIX_x86_64::XMMReg));<br>
::memcpy(m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,<br>
m_ymm_set.ymm[reg - fpu_ymm0].bytes,<br>
- sizeof(RegisterContext_x86_64::YMMHReg));<br>
+ sizeof(RegisterContextPOSIX_x86_64::YMMHReg));<br>
return true;<br>
}<br>
return false; // unsupported or invalid byte order<br>
}<br>
<br>
// Concatenate xmm.bytes with ymmh.bytes<br>
-bool RegisterContext_x86_64::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)<br>
+bool RegisterContextPOSIX_x86_64::CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order)<br>
{<br>
if (!IsAVX(reg))<br>
return false;<br>
@@ -654,44 +664,44 @@ bool RegisterContext_x86_64::CopyXSTATEt<br>
if (byte_order == eByteOrderLittle) {<br>
::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes,<br>
m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,<br>
- sizeof(RegisterContext_x86_64::XMMReg));<br>
- ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),<br>
+ sizeof(RegisterContextPOSIX_x86_64::XMMReg));<br>
+ ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),<br>
m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,<br>
- sizeof(RegisterContext_x86_64::YMMHReg));<br>
+ sizeof(RegisterContextPOSIX_x86_64::YMMHReg));<br>
return true;<br>
}<br>
if (byte_order == eByteOrderBig) {<br>
- ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContext_x86_64::XMMReg),<br>
+ ::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes + sizeof(RegisterContextPOSIX_x86_64::XMMReg),<br>
m_fpr.xstate.fxsave.xmm[reg - fpu_ymm0].bytes,<br>
- sizeof(RegisterContext_x86_64::XMMReg));<br>
+ sizeof(RegisterContextPOSIX_x86_64::XMMReg));<br>
::memcpy(m_ymm_set.ymm[reg - fpu_ymm0].bytes,<br>
m_fpr.xstate.xsave.ymmh[reg - fpu_ymm0].bytes,<br>
- sizeof(RegisterContext_x86_64::YMMHReg));<br>
+ sizeof(RegisterContextPOSIX_x86_64::YMMHReg));<br>
return true;<br>
}<br>
return false; // unsupported or invalid byte order<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::IsRegisterSetAvailable(size_t set_index)<br>
+RegisterContextPOSIX_x86_64::IsRegisterSetAvailable(size_t set_index)<br>
{<br>
// Note: Extended register sets are assumed to be at the end of g_reg_sets...<br>
size_t num_sets = k_num_register_sets - k_num_extended_register_sets;<br>
- if (m_fpr_type == eXSAVE) // ...and to start with AVX registers.<br>
+ if (GetFPRType() == eXSAVE) // ...and to start with AVX registers.<br>
++num_sets;<br>
<br>
return (set_index < num_sets);<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)<br>
+RegisterContextPOSIX_x86_64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)<br>
{<br>
if (!reg_info)<br>
return false;<br>
<br>
const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
<br>
- if (IsFPR(reg, m_fpr_type)) {<br>
+ if (IsFPR(reg, GetFPRType())) {<br>
if (!ReadFPR())<br>
return false;<br>
}<br>
@@ -717,7 +727,7 @@ RegisterContext_x86_64::ReadRegister(con<br>
}<br>
if (reg >= fpu_ymm0 && reg <= fpu_ymm15) {<br>
// Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes<br>
- if (m_fpr_type == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))<br>
+ if (GetFPRType() == eXSAVE && CopyXSTATEtoYMM(reg, byte_order))<br>
value.SetBytes(m_ymm_set.ymm[reg - fpu_ymm0].bytes, reg_info->byte_size, byte_order);<br>
else<br>
return false;<br>
@@ -761,7 +771,7 @@ RegisterContext_x86_64::ReadRegister(con<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp)<br>
+RegisterContextPOSIX_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp)<br>
{<br>
bool success = false;<br>
data_sp.reset (new DataBufferHeap (REG_CONTEXT_SIZE, 0));<br>
@@ -774,10 +784,10 @@ RegisterContext_x86_64::ReadAllRegisterV<br>
::memcpy (dst, &m_gpr, GetGPRSize());<br>
dst += GetGPRSize();<br>
}<br>
- if (m_fpr_type == eFXSAVE)<br>
+ if (GetFPRType() == eFXSAVE)<br>
::memcpy (dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));<br>
<br>
- if (m_fpr_type == eXSAVE) {<br>
+ if (GetFPRType() == eXSAVE) {<br>
ByteOrder byte_order = GetByteOrder();<br>
<br>
// Assemble the YMM register content from the register halves.<br>
@@ -794,7 +804,7 @@ RegisterContext_x86_64::ReadAllRegisterV<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::WriteRegister(const lldb_private::RegisterInfo *reg_info,<br>
+RegisterContextPOSIX_x86_64::WriteRegister(const lldb_private::RegisterInfo *reg_info,<br>
const lldb_private::RegisterValue &value)<br>
{<br>
const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
@@ -802,7 +812,7 @@ RegisterContext_x86_64::WriteRegister(co<br>
return WriteRegister(reg, value);<br>
}<br>
<br>
- if (IsFPR(reg, m_fpr_type)) {<br>
+ if (IsFPR(reg, GetFPRType())) {<br>
switch (reg)<br>
{<br>
default:<br>
@@ -816,7 +826,7 @@ RegisterContext_x86_64::WriteRegister(co<br>
::memcpy (m_fpr.xstate.fxsave.xmm[reg - fpu_xmm0].bytes, value.GetBytes(), value.GetByteSize());<br>
<br>
if (reg >= fpu_ymm0 && reg <= fpu_ymm15) {<br>
- if (m_fpr_type != eXSAVE)<br>
+ if (GetFPRType() != eXSAVE)<br>
return false; // the target processor does not support AVX<br>
<br>
// Store ymm register content, and split into the register halves in xmm.bytes and ymmh.bytes<br>
@@ -860,7 +870,7 @@ RegisterContext_x86_64::WriteRegister(co<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::WriteAllRegisterValues(const DataBufferSP &data_sp)<br>
+RegisterContextPOSIX_x86_64::WriteAllRegisterValues(const DataBufferSP &data_sp)<br>
{<br>
bool success = false;<br>
if (data_sp && data_sp->GetByteSize() == REG_CONTEXT_SIZE)<br>
@@ -871,16 +881,16 @@ RegisterContext_x86_64::WriteAllRegister<br>
<br>
if (WriteGPR()) {<br>
src += GetGPRSize();<br>
- if (m_fpr_type == eFXSAVE)<br>
+ if (GetFPRType() == eFXSAVE)<br>
::memcpy (&m_fpr.xstate.fxsave, src, sizeof(m_fpr.xstate.fxsave));<br>
- if (m_fpr_type == eXSAVE)<br>
+ if (GetFPRType() == eXSAVE)<br>
::memcpy (&m_fpr.xstate.xsave, src, sizeof(m_fpr.xstate.xsave));<br>
<br>
success = WriteFPR();<br>
if (success) {<br>
success = true;<br>
<br>
- if (m_fpr_type == eXSAVE) {<br>
+ if (GetFPRType() == eXSAVE) {<br>
ByteOrder byte_order = GetByteOrder();<br>
<br>
// Parse the YMM register content from the register halves.<br>
@@ -895,7 +905,7 @@ RegisterContext_x86_64::WriteAllRegister<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::UpdateAfterBreakpoint()<br>
+RegisterContextPOSIX_x86_64::UpdateAfterBreakpoint()<br>
{<br>
// PC points one byte past the int3 responsible for the breakpoint.<br>
lldb::addr_t pc;<br>
@@ -908,7 +918,7 @@ RegisterContext_x86_64::UpdateAfterBreak<br>
}<br>
<br>
uint32_t<br>
-RegisterContext_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind,<br>
+RegisterContextPOSIX_x86_64::ConvertRegisterKindToRegisterNumber(uint32_t kind,<br>
uint32_t num)<br>
{<br>
const Process *process = CalculateProcess().get();<br>
@@ -1205,14 +1215,14 @@ RegisterContext_x86_64::ConvertRegisterK<br>
}<br>
<br>
uint32_t<br>
-RegisterContext_x86_64::NumSupportedHardwareWatchpoints()<br>
+RegisterContextPOSIX_x86_64::NumSupportedHardwareWatchpoints()<br>
{<br>
// Available debug address registers: dr0, dr1, dr2, dr3<br>
return 4;<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::IsWatchpointVacant(uint32_t hw_index)<br>
+RegisterContextPOSIX_x86_64::IsWatchpointVacant(uint32_t hw_index)<br>
{<br>
bool is_vacant = false;<br>
RegisterValue value;<br>
@@ -1264,7 +1274,7 @@ size_and_rw_bits(size_t size, bool read,<br>
}<br>
<br>
uint32_t<br>
-RegisterContext_x86_64::SetHardwareWatchpoint(addr_t addr, size_t size,<br>
+RegisterContextPOSIX_x86_64::SetHardwareWatchpoint(addr_t addr, size_t size,<br>
bool read, bool write)<br>
{<br>
const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();<br>
@@ -1282,7 +1292,7 @@ RegisterContext_x86_64::SetHardwareWatch<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,<br>
+RegisterContextPOSIX_x86_64::SetHardwareWatchpointWithIndex(addr_t addr, size_t size,<br>
bool read, bool write,<br>
uint32_t hw_index)<br>
{<br>
@@ -1344,7 +1354,7 @@ RegisterContext_x86_64::SetHardwareWatch<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::ClearHardwareWatchpoint(uint32_t hw_index)<br>
+RegisterContextPOSIX_x86_64::ClearHardwareWatchpoint(uint32_t hw_index)<br>
{<br>
if (hw_index < NumSupportedHardwareWatchpoints())<br>
{<br>
@@ -1363,7 +1373,7 @@ RegisterContext_x86_64::ClearHardwareWat<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::IsWatchpointHit(uint32_t hw_index)<br>
+RegisterContextPOSIX_x86_64::IsWatchpointHit(uint32_t hw_index)<br>
{<br>
bool is_hit = false;<br>
<br>
@@ -1391,7 +1401,7 @@ RegisterContext_x86_64::IsWatchpointHit(<br>
}<br>
<br>
addr_t<br>
-RegisterContext_x86_64::GetWatchpointAddress(uint32_t hw_index)<br>
+RegisterContextPOSIX_x86_64::GetWatchpointAddress(uint32_t hw_index)<br>
{<br>
addr_t wp_monitor_addr = LLDB_INVALID_ADDRESS;<br>
<br>
@@ -1411,13 +1421,13 @@ RegisterContext_x86_64::GetWatchpointAdd<br>
<br>
<br>
bool<br>
-RegisterContext_x86_64::ClearWatchpointHits()<br>
+RegisterContextPOSIX_x86_64::ClearWatchpointHits()<br>
{<br>
return WriteRegister(dr6, RegisterValue((uint64_t)0));<br>
}<br>
<br>
bool<br>
-RegisterContext_x86_64::HardwareSingleStep(bool enable)<br>
+RegisterContextPOSIX_x86_64::HardwareSingleStep(bool enable)<br>
{<br>
enum { TRACE_BIT = 0x100 };<br>
uint64_t rflags;<br>
@@ -1442,122 +1452,3 @@ RegisterContext_x86_64::HardwareSingleSt<br>
<br>
return WriteRegisterFromUnsigned(gpr_rflags, rflags);<br>
}<br>
-<br>
-#if defined(__linux__) or defined(__FreeBSD__)<br>
-<br>
-ProcessMonitor &<br>
-RegisterContext_x86_64::GetMonitor()<br>
-{<br>
- ProcessSP base = CalculateProcess();<br>
- ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());<br>
- return process->GetMonitor();<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::ReadGPR()<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.ReadGPR(m_thread.GetID(), &m_gpr, GetGPRSize());<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::ReadFPR()<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- if (m_fpr_type == eFXSAVE)<br>
- return monitor.ReadFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));<br>
-<br>
- if (m_fpr_type == eXSAVE)<br>
- return monitor.ReadRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::WriteGPR()<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.WriteGPR(m_thread.GetID(), &m_gpr, GetGPRSize());<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::WriteFPR()<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- if (m_fpr_type == eFXSAVE)<br>
- return monitor.WriteFPR(m_thread.GetID(), &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));<br>
-<br>
- if (m_fpr_type == eXSAVE)<br>
- return monitor.WriteRegisterSet(m_thread.GetID(), &m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::ReadRegister(const unsigned reg,<br>
- RegisterValue &value)<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.ReadRegisterValue(m_thread.GetID(),<br>
- GetRegisterOffset(reg),<br>
- GetRegisterName(reg),<br>
- GetRegisterSize(reg),<br>
- value);<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::WriteRegister(const unsigned reg,<br>
- const RegisterValue &value)<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.WriteRegisterValue(m_thread.GetID(),<br>
- GetRegisterOffset(reg),<br>
- GetRegisterName(reg),<br>
- value);<br>
-}<br>
-<br>
-#else<br>
-<br>
-bool<br>
-RegisterContext_x86_64::ReadGPR()<br>
-{<br>
- llvm_unreachable("not implemented");<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::ReadFPR()<br>
-{<br>
- llvm_unreachable("not implemented");<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::WriteGPR()<br>
-{<br>
- llvm_unreachable("not implemented");<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::WriteFPR()<br>
-{<br>
- llvm_unreachable("not implemented");<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::ReadRegister(const unsigned reg,<br>
- RegisterValue &value)<br>
-{<br>
- llvm_unreachable("not implemented");<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_x86_64::WriteRegister(const unsigned reg,<br>
- const RegisterValue &value)<br>
-{<br>
- llvm_unreachable("not implemented");<br>
- return false;<br>
-}<br>
-<br>
-#endif<br>
<br>
Copied: lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h (from r190549, lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h&r1=190549&r2=190647&rev=190647&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h?p2=lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h&p1=lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h&r1=190549&r2=190647&rev=190647&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContextPOSIX_x86_64.h Thu Sep 12 19:18:17 2013<br>
@@ -1,4 +1,4 @@<br>
-//===-- RegisterContext_x86_64.h ---------------------------*- C++ -*-===//<br>
+//===-- RegisterContextPOSIX_x86_64.h ---------------------------*- C++ -*-===//<br>
//<br>
// The LLVM Compiler Infrastructure<br>
//<br>
@@ -7,8 +7,8 @@<br>
//<br>
//===----------------------------------------------------------------------===//<br>
<br>
-#ifndef liblldb_RegisterContext_x86_64_H_<br>
-#define liblldb_RegisterContext_x86_64_H_<br>
+#ifndef liblldb_RegisterContextPOSIX_x86_64_H_<br>
+#define liblldb_RegisterContextPOSIX_x86_64_H_<br>
<br>
#include "lldb/Core/Log.h"<br>
#include "RegisterContextPOSIX.h"<br>
@@ -127,14 +127,15 @@ enum<br>
k_num_avx_registers = k_last_avx - k_first_avx + 1<br>
};<br>
<br>
-class RegisterContext_x86_64<br>
+class RegisterContextPOSIX_x86_64<br>
: public RegisterContextPOSIX<br>
{<br>
public:<br>
- RegisterContext_x86_64 (lldb_private::Thread &thread,<br>
- uint32_t concrete_frame_idx);<br>
+ RegisterContextPOSIX_x86_64 (lldb_private::Thread &thread,<br>
+ uint32_t concrete_frame_idx,<br>
+ RegisterInfoInterface *register_info);<br>
<br>
- ~RegisterContext_x86_64();<br>
+ ~RegisterContextPOSIX_x86_64();<br>
<br>
void<br>
Invalidate();<br>
@@ -146,7 +147,7 @@ public:<br>
GetRegisterCount();<br>
<br>
virtual size_t<br>
- GetGPRSize() = 0;<br>
+ GetGPRSize();<br>
<br>
virtual unsigned<br>
GetRegisterSize(unsigned reg);<br>
@@ -318,30 +319,38 @@ protected:<br>
GetRegisterInfo();<br>
<br>
virtual bool<br>
- ReadRegister(const unsigned reg, lldb_private::RegisterValue &value);<br>
+ ReadRegister(const unsigned reg, lldb_private::RegisterValue &value) = 0;<br>
<br>
virtual bool<br>
- WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value);<br>
+ WriteRegister(const unsigned reg, const lldb_private::RegisterValue &value) = 0;<br>
<br>
-private:<br>
- uint64_t m_gpr[k_num_gpr_registers]; // general purpose registers.<br>
- FPRType m_fpr_type; // determines the type of data stored by union FPR, if any.<br>
- FPR m_fpr; // floating-point registers including extended register sets.<br>
- IOVEC m_iovec; // wrapper for xsave.<br>
- YMM m_ymm_set; // copy of ymmh and xmm register halves.<br>
+ static bool<br>
+ IsGPR(unsigned reg);<br>
+<br>
+ static bool<br>
+ IsFPR(unsigned reg);<br>
+<br>
+ static bool<br>
+ IsAVX(unsigned reg);<br>
+<br>
+ uint64_t m_gpr[k_num_gpr_registers]; // general purpose registers.<br>
+ FPRType m_fpr_type; // determines the type of data stored by union FPR, if any.<br>
+ FPR m_fpr; // floating-point registers including extended register sets.<br>
+ IOVEC m_iovec; // wrapper for xsave.<br>
+ YMM m_ymm_set; // copy of ymmh and xmm register halves.<br>
+ std::unique_ptr<RegisterInfoInterface> m_register_info_ap; // Register Info Interface (FreeBSD or Linux)<br>
<br>
- ProcessMonitor &GetMonitor();<br>
lldb::ByteOrder GetByteOrder();<br>
<br>
bool CopyXSTATEtoYMM(uint32_t reg, lldb::ByteOrder byte_order);<br>
bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);<br>
bool IsFPR(unsigned reg, FPRType fpr_type);<br>
+ FPRType GetFPRType();<br>
<br>
- bool ReadGPR();<br>
- bool ReadFPR();<br>
-<br>
- bool WriteGPR();<br>
- bool WriteFPR();<br>
+ virtual bool ReadGPR() = 0;<br>
+ virtual bool ReadFPR() = 0;<br>
+ virtual bool WriteGPR() = 0;<br>
+ virtual bool WriteFPR() = 0;<br>
};<br>
<br>
-#endif // #ifndef liblldb_RegisterContext_x86_64_H_<br>
+#endif // #ifndef liblldb_RegisterContextPOSIX_x86_64_H_<br>
<br>
Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp?rev=190646&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp?rev=190646&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.cpp (removed)<br>
@@ -1,551 +0,0 @@<br>
-//===-- RegisterContextPOSIX_i386.cpp ---------------------------*- C++ -*-===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include "lldb/Core/DataExtractor.h"<br>
-#include "lldb/Target/Thread.h"<br>
-#include "lldb/Host/Endian.h"<br>
-#include "llvm/Support/Compiler.h"<br>
-<br>
-#include "ProcessPOSIX.h"<br>
-#include "ProcessPOSIXLog.h"<br>
-#include "ProcessMonitor.h"<br>
-#include "RegisterContext_i386.h"<br>
-#include "RegisterContext_x86.h"<br>
-<br>
-using namespace lldb_private;<br>
-using namespace lldb;<br>
-<br>
-enum<br>
-{<br>
- k_first_gpr,<br>
- gpr_eax = k_first_gpr,<br>
- gpr_ebx,<br>
- gpr_ecx,<br>
- gpr_edx,<br>
- gpr_edi,<br>
- gpr_esi,<br>
- gpr_ebp,<br>
- gpr_esp,<br>
- gpr_ss,<br>
- gpr_eflags,<br>
-#ifdef __FreeBSD__<br>
- gpr_orig_ax,<br>
-#endif<br>
- gpr_eip,<br>
- gpr_cs,<br>
- gpr_ds,<br>
- gpr_es,<br>
- gpr_fs,<br>
- gpr_gs,<br>
- k_last_gpr = gpr_gs,<br>
-<br>
- k_first_fpr,<br>
- fpu_fcw = k_first_fpr,<br>
- fpu_fsw,<br>
- fpu_ftw,<br>
- fpu_fop,<br>
- fpu_ip,<br>
- fpu_cs,<br>
- fpu_foo,<br>
- fpu_fos,<br>
- fpu_mxcsr,<br>
- fpu_stmm0,<br>
- fpu_stmm1,<br>
- fpu_stmm2,<br>
- fpu_stmm3,<br>
- fpu_stmm4,<br>
- fpu_stmm5,<br>
- fpu_stmm6,<br>
- fpu_stmm7,<br>
- fpu_xmm0,<br>
- fpu_xmm1,<br>
- fpu_xmm2,<br>
- fpu_xmm3,<br>
- fpu_xmm4,<br>
- fpu_xmm5,<br>
- fpu_xmm6,<br>
- fpu_xmm7,<br>
- k_last_fpr = fpu_xmm7,<br>
-<br>
- k_num_registers,<br>
- k_num_gpr_registers = k_last_gpr - k_first_gpr + 1,<br>
- k_num_fpu_registers = k_last_fpr - k_first_fpr + 1<br>
-};<br>
-<br>
-// Number of register sets provided by this context.<br>
-enum<br>
-{<br>
- k_num_register_sets = 2<br>
-};<br>
-<br>
-static const<br>
-uint32_t g_gpr_regnums[k_num_gpr_registers] =<br>
-{<br>
- gpr_eax,<br>
- gpr_ebx,<br>
- gpr_ecx,<br>
- gpr_edx,<br>
- gpr_edi,<br>
- gpr_esi,<br>
- gpr_ebp,<br>
- gpr_esp,<br>
- gpr_ss,<br>
- gpr_eflags,<br>
-#ifdef __FreeBSD__<br>
- gpr_orig_ax,<br>
-#endif<br>
- gpr_eip,<br>
- gpr_cs,<br>
- gpr_ds,<br>
- gpr_es,<br>
- gpr_fs,<br>
- gpr_gs,<br>
-};<br>
-<br>
-static const uint32_t<br>
-g_fpu_regnums[k_num_fpu_registers] =<br>
-{<br>
- fpu_fcw,<br>
- fpu_fsw,<br>
- fpu_ftw,<br>
- fpu_fop,<br>
- fpu_ip,<br>
- fpu_cs,<br>
- fpu_foo,<br>
- fpu_fos,<br>
- fpu_mxcsr,<br>
- fpu_stmm0,<br>
- fpu_stmm1,<br>
- fpu_stmm2,<br>
- fpu_stmm3,<br>
- fpu_stmm4,<br>
- fpu_stmm5,<br>
- fpu_stmm6,<br>
- fpu_stmm7,<br>
- fpu_xmm0,<br>
- fpu_xmm1,<br>
- fpu_xmm2,<br>
- fpu_xmm3,<br>
- fpu_xmm4,<br>
- fpu_xmm5,<br>
- fpu_xmm6,<br>
- fpu_xmm7,<br>
-};<br>
-<br>
-static const RegisterSet<br>
-g_reg_sets[k_num_register_sets] =<br>
-{<br>
- { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums },<br>
- { "Floating Point Registers", "fpu", k_num_fpu_registers, g_fpu_regnums }<br>
-};<br>
-<br>
-// Computes the offset of the given GPR in the user data area.<br>
-#define GPR_OFFSET(regname) \<br>
- (offsetof(RegisterContext_i386::UserArea, regs) + \<br>
- offsetof(RegisterContext_i386::GPR, regname))<br>
-<br>
-// Computes the offset of the given FPR in the user data area.<br>
-#define FPR_OFFSET(regname) \<br>
- (offsetof(RegisterContext_i386::UserArea, i387) + \<br>
- offsetof(RegisterContext_i386::FPU, regname))<br>
-<br>
-// Number of bytes needed to represent a GPR.<br>
-#define GPR_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)<br>
-<br>
-// Number of bytes needed to represent a FPR.<br>
-#define FPR_SIZE(reg) sizeof(((RegisterContext_i386::FPU*)NULL)->reg)<br>
-<br>
-// Number of bytes needed to represent the i'th FP register.<br>
-#define FP_SIZE sizeof(((RegisterContext_i386::MMSReg*)NULL)->bytes)<br>
-<br>
-// Number of bytes needed to represent an XMM register.<br>
-#define XMM_SIZE sizeof(RegisterContext_i386::XMMReg)<br>
-<br>
-#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \<br>
- { #reg, alt, GPR_SIZE(reg), GPR_OFFSET(reg), eEncodingUint, \<br>
- eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg }, NULL, NULL }<br>
-<br>
-#define DEFINE_FPR(reg, kind1, kind2, kind3, kind4) \<br>
- { #reg, NULL, FPR_SIZE(reg), FPR_OFFSET(reg), eEncodingUint, \<br>
- eFormatHex, { kind1, kind2, kind3, kind4, fpu_##reg }, NULL, NULL }<br>
-<br>
-#define DEFINE_FP(reg, i) \<br>
- { #reg#i, NULL, FP_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]), \<br>
- eEncodingVector, eFormatVectorOfUInt8, \<br>
- { dwarf_##reg##i, dwarf_##reg##i, \<br>
- LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i }, NULL, NULL }<br>
-<br>
-#define DEFINE_XMM(reg, i) \<br>
- { #reg#i, NULL, XMM_SIZE, LLVM_EXTENSION FPR_OFFSET(reg[i]), \<br>
- eEncodingVector, eFormatVectorOfUInt8, \<br>
- { dwarf_##reg##i, dwarf_##reg##i, \<br>
- LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i }, NULL, NULL }<br>
-<br>
-static RegisterInfo<br>
-g_register_infos[k_num_registers] =<br>
-{<br>
- // General purpose registers.<br>
- DEFINE_GPR(eax, NULL, gcc_eax, dwarf_eax, LLDB_INVALID_REGNUM, gdb_eax),<br>
- DEFINE_GPR(ebx, NULL, gcc_ebx, dwarf_ebx, LLDB_INVALID_REGNUM, gdb_ebx),<br>
- DEFINE_GPR(ecx, NULL, gcc_ecx, dwarf_ecx, LLDB_INVALID_REGNUM, gdb_ecx),<br>
- DEFINE_GPR(edx, NULL, gcc_edx, dwarf_edx, LLDB_INVALID_REGNUM, gdb_edx),<br>
- DEFINE_GPR(edi, NULL, gcc_edi, dwarf_edi, LLDB_INVALID_REGNUM, gdb_edi),<br>
- DEFINE_GPR(esi, NULL, gcc_esi, dwarf_esi, LLDB_INVALID_REGNUM, gdb_esi),<br>
- DEFINE_GPR(ebp, "fp", gcc_ebp, dwarf_ebp, LLDB_INVALID_REGNUM, gdb_ebp),<br>
- DEFINE_GPR(esp, "sp", gcc_esp, dwarf_esp, LLDB_INVALID_REGNUM, gdb_esp),<br>
- DEFINE_GPR(ss, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ss),<br>
- DEFINE_GPR(eflags, "flags", gcc_eflags, dwarf_eflags, LLDB_INVALID_REGNUM, gdb_eflags),<br>
- DEFINE_GPR(eip, "pc", gcc_eip, dwarf_eip, LLDB_INVALID_REGNUM, gdb_eip),<br>
- DEFINE_GPR(cs, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_cs),<br>
- DEFINE_GPR(ds, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ds),<br>
- DEFINE_GPR(es, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_es),<br>
- DEFINE_GPR(fs, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fs),<br>
- DEFINE_GPR(gs, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_gs),<br>
-<br>
- // Floating point registers.<br>
- DEFINE_FPR(fcw, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fcw),<br>
- DEFINE_FPR(fsw, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fsw),<br>
- DEFINE_FPR(ftw, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ftw),<br>
- DEFINE_FPR(fop, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fop),<br>
- DEFINE_FPR(ip, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ip),<br>
- DEFINE_FPR(cs, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_cs),<br>
- DEFINE_FPR(foo, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_dp),<br>
- DEFINE_FPR(fos, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_ds),<br>
- DEFINE_FPR(mxcsr, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_mxcsr),<br>
-<br>
- DEFINE_FP(stmm, 0),<br>
- DEFINE_FP(stmm, 1),<br>
- DEFINE_FP(stmm, 2),<br>
- DEFINE_FP(stmm, 3),<br>
- DEFINE_FP(stmm, 4),<br>
- DEFINE_FP(stmm, 5),<br>
- DEFINE_FP(stmm, 6),<br>
- DEFINE_FP(stmm, 7),<br>
-<br>
- // XMM registers<br>
- DEFINE_XMM(xmm, 0),<br>
- DEFINE_XMM(xmm, 1),<br>
- DEFINE_XMM(xmm, 2),<br>
- DEFINE_XMM(xmm, 3),<br>
- DEFINE_XMM(xmm, 4),<br>
- DEFINE_XMM(xmm, 5),<br>
- DEFINE_XMM(xmm, 6),<br>
- DEFINE_XMM(xmm, 7),<br>
-<br>
-};<br>
-<br>
-#ifndef NDEBUG<br>
-static size_t k_num_register_infos = (sizeof(g_register_infos)/sizeof(RegisterInfo));<br>
-#endif<br>
-<br>
-static unsigned GetRegOffset(unsigned reg)<br>
-{<br>
- assert(reg < k_num_registers && "Invalid register number.");<br>
- return g_register_infos[reg].byte_offset;<br>
-}<br>
-<br>
-static unsigned GetRegSize(unsigned reg)<br>
-{<br>
- assert(reg < k_num_registers && "Invalid register number.");<br>
- return g_register_infos[reg].byte_size;<br>
-}<br>
-<br>
-RegisterContext_i386::RegisterContext_i386(Thread &thread,<br>
- uint32_t concrete_frame_idx)<br>
- : RegisterContextPOSIX(thread, concrete_frame_idx)<br>
-{<br>
-}<br>
-<br>
-RegisterContext_i386::~RegisterContext_i386()<br>
-{<br>
-}<br>
-<br>
-ProcessMonitor &<br>
-RegisterContext_i386::GetMonitor()<br>
-{<br>
- ProcessSP base = CalculateProcess();<br>
- ProcessPOSIX *process = static_cast<ProcessPOSIX*>(base.get());<br>
- return process->GetMonitor();<br>
-}<br>
-<br>
-void<br>
-RegisterContext_i386::Invalidate()<br>
-{<br>
-}<br>
-<br>
-void<br>
-RegisterContext_i386::InvalidateAllRegisters()<br>
-{<br>
-}<br>
-<br>
-size_t<br>
-RegisterContext_i386::GetRegisterCount()<br>
-{<br>
- assert(k_num_register_infos == k_num_registers);<br>
- return k_num_registers;<br>
-}<br>
-<br>
-const RegisterInfo *<br>
-RegisterContext_i386::GetRegisterInfoAtIndex(size_t reg)<br>
-{<br>
- assert(k_num_register_infos == k_num_registers);<br>
- if (reg < k_num_registers)<br>
- return &g_register_infos[reg];<br>
- else<br>
- return NULL;<br>
-}<br>
-<br>
-size_t<br>
-RegisterContext_i386::GetRegisterSetCount()<br>
-{<br>
- return k_num_register_sets;<br>
-}<br>
-<br>
-const RegisterSet *<br>
-RegisterContext_i386::GetRegisterSet(size_t set)<br>
-{<br>
- if (set < k_num_register_sets)<br>
- return &g_reg_sets[set];<br>
- else<br>
- return NULL;<br>
-}<br>
-<br>
-unsigned<br>
-RegisterContext_i386::GetRegisterIndexFromOffset(unsigned offset)<br>
-{<br>
- unsigned reg;<br>
- for (reg = 0; reg < k_num_registers; reg++)<br>
- {<br>
- if (g_register_infos[reg].byte_offset == offset)<br>
- break;<br>
- }<br>
- assert(reg < k_num_registers && "Invalid register offset.");<br>
- return reg;<br>
-}<br>
-<br>
-const char *<br>
-RegisterContext_i386::GetRegisterName(unsigned reg)<br>
-{<br>
- assert(reg < k_num_registers && "Invalid register offset.");<br>
- return g_register_infos[reg].name;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::ReadRegister(const RegisterInfo *reg_info,<br>
- RegisterValue &value)<br>
-{<br>
- const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.ReadRegisterValue(m_thread.GetID(), GetRegOffset(reg),<br>
- GetRegisterName(reg), GetRegSize(reg), value);<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::ReadAllRegisterValues(DataBufferSP &data_sp)<br>
-{<br>
- return false;<br>
-}<br>
-<br>
-bool RegisterContext_i386::WriteRegister(const RegisterInfo *reg_info,<br>
- const RegisterValue &value)<br>
-{<br>
- const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.WriteRegisterValue(m_thread.GetID(), GetRegOffset(reg),<br>
- GetRegisterName(reg), value);<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::WriteAllRegisterValues(const DataBufferSP &data)<br>
-{<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::UpdateAfterBreakpoint()<br>
-{<br>
- // PC points one byte past the int3 responsible for the breakpoint.<br>
- lldb::addr_t pc;<br>
-<br>
- if ((pc = GetPC()) == LLDB_INVALID_ADDRESS)<br>
- return false;<br>
-<br>
- SetPC(pc - 1);<br>
- return true;<br>
-}<br>
-<br>
-uint32_t<br>
-RegisterContext_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,<br>
- uint32_t num)<br>
-{<br>
- if (kind == eRegisterKindGeneric)<br>
- {<br>
- switch (num)<br>
- {<br>
- case LLDB_REGNUM_GENERIC_PC: return gpr_eip;<br>
- case LLDB_REGNUM_GENERIC_SP: return gpr_esp;<br>
- case LLDB_REGNUM_GENERIC_FP: return gpr_ebp;<br>
- case LLDB_REGNUM_GENERIC_FLAGS: return gpr_eflags;<br>
- case LLDB_REGNUM_GENERIC_RA:<br>
- default:<br>
- return LLDB_INVALID_REGNUM;<br>
- }<br>
- }<br>
-<br>
- if (kind == eRegisterKindGCC || kind == eRegisterKindDWARF)<br>
- {<br>
- switch (num)<br>
- {<br>
- case dwarf_eax: return gpr_eax;<br>
- case dwarf_edx: return gpr_edx;<br>
- case dwarf_ecx: return gpr_ecx;<br>
- case dwarf_ebx: return gpr_ebx;<br>
- case dwarf_esi: return gpr_esi;<br>
- case dwarf_edi: return gpr_edi;<br>
- case dwarf_ebp: return gpr_ebp;<br>
- case dwarf_esp: return gpr_esp;<br>
- case dwarf_eip: return gpr_eip;<br>
- case dwarf_xmm0: return fpu_xmm0;<br>
- case dwarf_xmm1: return fpu_xmm1;<br>
- case dwarf_xmm2: return fpu_xmm2;<br>
- case dwarf_xmm3: return fpu_xmm3;<br>
- case dwarf_xmm4: return fpu_xmm4;<br>
- case dwarf_xmm5: return fpu_xmm5;<br>
- case dwarf_xmm6: return fpu_xmm6;<br>
- case dwarf_xmm7: return fpu_xmm7;<br>
- case dwarf_stmm0: return fpu_stmm0;<br>
- case dwarf_stmm1: return fpu_stmm1;<br>
- case dwarf_stmm2: return fpu_stmm2;<br>
- case dwarf_stmm3: return fpu_stmm3;<br>
- case dwarf_stmm4: return fpu_stmm4;<br>
- case dwarf_stmm5: return fpu_stmm5;<br>
- case dwarf_stmm6: return fpu_stmm6;<br>
- case dwarf_stmm7: return fpu_stmm7;<br>
- default:<br>
- return LLDB_INVALID_REGNUM;<br>
- }<br>
- }<br>
-<br>
- if (kind == eRegisterKindGDB)<br>
- {<br>
- switch (num)<br>
- {<br>
- case gdb_eax : return gpr_eax;<br>
- case gdb_ebx : return gpr_ebx;<br>
- case gdb_ecx : return gpr_ecx;<br>
- case gdb_edx : return gpr_edx;<br>
- case gdb_esi : return gpr_esi;<br>
- case gdb_edi : return gpr_edi;<br>
- case gdb_ebp : return gpr_ebp;<br>
- case gdb_esp : return gpr_esp;<br>
- case gdb_eip : return gpr_eip;<br>
- case gdb_eflags : return gpr_eflags;<br>
- case gdb_cs : return gpr_cs;<br>
- case gdb_ss : return gpr_ss;<br>
- case gdb_ds : return gpr_ds;<br>
- case gdb_es : return gpr_es;<br>
- case gdb_fs : return gpr_fs;<br>
- case gdb_gs : return gpr_gs;<br>
- case gdb_stmm0 : return fpu_stmm0;<br>
- case gdb_stmm1 : return fpu_stmm1;<br>
- case gdb_stmm2 : return fpu_stmm2;<br>
- case gdb_stmm3 : return fpu_stmm3;<br>
- case gdb_stmm4 : return fpu_stmm4;<br>
- case gdb_stmm5 : return fpu_stmm5;<br>
- case gdb_stmm6 : return fpu_stmm6;<br>
- case gdb_stmm7 : return fpu_stmm7;<br>
- case gdb_fcw : return fpu_fcw;<br>
- case gdb_fsw : return fpu_fsw;<br>
- case gdb_ftw : return fpu_ftw;<br>
- case gdb_fpu_cs : return fpu_cs;<br>
- case gdb_ip : return fpu_ip;<br>
- case gdb_fpu_ds : return fpu_fos;<br>
- case gdb_dp : return fpu_foo;<br>
- case gdb_fop : return fpu_fop;<br>
- case gdb_xmm0 : return fpu_xmm0;<br>
- case gdb_xmm1 : return fpu_xmm1;<br>
- case gdb_xmm2 : return fpu_xmm2;<br>
- case gdb_xmm3 : return fpu_xmm3;<br>
- case gdb_xmm4 : return fpu_xmm4;<br>
- case gdb_xmm5 : return fpu_xmm5;<br>
- case gdb_xmm6 : return fpu_xmm6;<br>
- case gdb_xmm7 : return fpu_xmm7;<br>
- case gdb_mxcsr : return fpu_mxcsr;<br>
- default:<br>
- return LLDB_INVALID_REGNUM;<br>
- }<br>
- }<br>
- else if (kind == eRegisterKindLLDB)<br>
- {<br>
- return num;<br>
- }<br>
-<br>
- return LLDB_INVALID_REGNUM;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::HardwareSingleStep(bool enable)<br>
-{<br>
- enum { TRACE_BIT = 0x100 };<br>
- uint64_t eflags;<br>
-<br>
- if ((eflags = ReadRegisterAsUnsigned(gpr_eflags, -1UL)) == -1UL)<br>
- return false;<br>
-<br>
- if (enable)<br>
- {<br>
- if (eflags & TRACE_BIT)<br>
- return true;<br>
-<br>
- eflags |= TRACE_BIT;<br>
- }<br>
- else<br>
- {<br>
- if (!(eflags & TRACE_BIT))<br>
- return false;<br>
-<br>
- eflags &= ~TRACE_BIT;<br>
- }<br>
-<br>
- return WriteRegisterFromUnsigned(gpr_eflags, eflags);<br>
-}<br>
-<br>
-void<br>
-RegisterContext_i386::LogGPR(const char *title)<br>
-{<br>
- Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_REGISTERS));<br>
- if (log)<br>
- {<br>
- if (title)<br>
- log->Printf ("%s", title);<br>
- for (uint32_t i=0; i<k_num_gpr_registers; i++)<br>
- {<br>
- uint32_t reg = gpr_eax + i;<br>
- log->Printf("%12s = 0x%8.8" PRIx64, g_register_infos[reg].name, ((uint64_t*)&user.regs)[reg]);<br>
- }<br>
- }<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::ReadGPR()<br>
-{<br>
- bool result;<br>
-<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- result = monitor.ReadGPR(m_thread.GetID(), &user.regs, sizeof(user.regs));<br>
- LogGPR("RegisterContext_i386::ReadGPR()");<br>
- return result;<br>
-}<br>
-<br>
-bool<br>
-RegisterContext_i386::ReadFPR()<br>
-{<br>
- ProcessMonitor &monitor = GetMonitor();<br>
- return monitor.ReadFPR(m_thread.GetID(), &user.i387, sizeof(user.i387));<br>
-}<br>
<br>
Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h?rev=190646&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h?rev=190646&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_i386.h (removed)<br>
@@ -1,169 +0,0 @@<br>
-//===-- RegisterContext_i386.h ------------------------------*- C++ -*-===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#ifndef liblldb_RegisterContext_i386_h_<br>
-#define liblldb_RegisterContext_i386_h_<br>
-<br>
-// C Includes<br>
-// C++ Includes<br>
-// Other libraries and framework includes<br>
-// Project includes<br>
-#include "lldb/Core/Log.h"<br>
-#include "RegisterContextPOSIX.h"<br>
-<br>
-class RegisterContext_i386 : public RegisterContextPOSIX<br>
-{<br>
-public:<br>
- RegisterContext_i386(lldb_private::Thread &thread,<br>
- uint32_t concreate_frame_idx);<br>
-<br>
- ~RegisterContext_i386();<br>
-<br>
- void<br>
- Invalidate();<br>
-<br>
- void<br>
- InvalidateAllRegisters();<br>
-<br>
- size_t<br>
- GetRegisterCount();<br>
-<br>
- const lldb_private::RegisterInfo *<br>
- GetRegisterInfoAtIndex(size_t reg);<br>
-<br>
- size_t<br>
- GetRegisterSetCount();<br>
-<br>
- const lldb_private::RegisterSet *<br>
- GetRegisterSet(size_t set);<br>
-<br>
- unsigned<br>
- GetRegisterIndexFromOffset(unsigned offset);<br>
-<br>
- const char *<br>
- GetRegisterName(unsigned reg);<br>
-<br>
- bool<br>
- ReadRegisterValue(uint32_t reg, lldb_private::Scalar &value);<br>
-<br>
- bool<br>
- ReadRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data);<br>
-<br>
- virtual bool<br>
- ReadRegister(const lldb_private::RegisterInfo *reg_info,<br>
- lldb_private::RegisterValue &value);<br>
-<br>
- bool<br>
- ReadAllRegisterValues(lldb::DataBufferSP &data_sp);<br>
-<br>
- bool<br>
- WriteRegisterValue(uint32_t reg, const lldb_private::Scalar &value);<br>
-<br>
- bool<br>
- WriteRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data,<br>
- uint32_t data_offset = 0);<br>
-<br>
- virtual bool<br>
- WriteRegister(const lldb_private::RegisterInfo *reg_info,<br>
- const lldb_private::RegisterValue &value);<br>
-<br>
- bool<br>
- WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);<br>
-<br>
- uint32_t<br>
- ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num);<br>
-<br>
- bool<br>
- HardwareSingleStep(bool enable);<br>
-<br>
- bool<br>
- UpdateAfterBreakpoint();<br>
-<br>
- struct GPR<br>
- {<br>
- uint32_t ebx;<br>
- uint32_t ecx;<br>
- uint32_t edx;<br>
- uint32_t esi;<br>
- uint32_t edi;<br>
- uint32_t ebp;<br>
- uint32_t eax;<br>
- uint32_t ds;<br>
- uint32_t es;<br>
- uint32_t fs;<br>
- uint32_t gs;<br>
- uint32_t orig_ax;<br>
- uint32_t eip;<br>
- uint32_t cs;<br>
- uint32_t eflags;<br>
- uint32_t esp;<br>
- uint32_t ss;<br>
- };<br>
-<br>
- struct MMSReg<br>
- {<br>
- uint8_t bytes[8];<br>
- };<br>
-<br>
- struct XMMReg<br>
- {<br>
- uint8_t bytes[16];<br>
- };<br>
-<br>
- struct FPU<br>
- {<br>
- uint16_t fcw;<br>
- uint16_t fsw;<br>
- uint16_t ftw;<br>
- uint16_t fop;<br>
- uint32_t ip;<br>
- uint32_t cs;<br>
- uint32_t foo;<br>
- uint32_t fos;<br>
- uint32_t mxcsr;<br>
- uint32_t reserved;<br>
- MMSReg stmm[8];<br>
- XMMReg xmm[8];<br>
- uint32_t pad[56];<br>
- };<br>
-<br>
- // A user area like this no longer exists on FreeBSD<br>
- // making this a Linux artifact. Nonetheless, it is safe<br>
- // leaving it here while the code is being cleaned up and generalized.<br>
-<br>
- struct UserArea<br>
- {<br>
- GPR regs; // General purpose registers.<br>
- int32_t fpvalid; // True if FPU is being used.<br>
- FPU i387; // FPU registers.<br>
- uint32_t tsize; // Text segment size.<br>
- uint32_t dsize; // Data segment size.<br>
- uint32_t ssize; // Stack segment size.<br>
- uint32_t start_code; // VM address of text.<br>
- uint32_t start_stack; // VM address of stack bottom (top in rsp).<br>
- int32_t signal; // Signal causing core dump.<br>
- int32_t reserved; // Unused.<br>
- uint32_t ar0; // Location of GPR's.<br>
- FPU* fpstate; // Location of FPR's.<br>
- uint32_t magic; // Identifier for core dumps.<br>
- char u_comm[32]; // Command causing core dump.<br>
- uint32_t u_debugreg[8]; // Debug registers (DR0 - DR7).<br>
- };<br>
-private:<br>
- UserArea user;<br>
-<br>
- ProcessMonitor &GetMonitor();<br>
-<br>
- void LogGPR(const char *title);<br>
-<br>
- bool ReadGPR();<br>
- bool ReadFPR();<br>
-};<br>
-<br>
-#endif // #ifndef liblldb_RegisterContext_i386_h_<br>
<br>
Removed: lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp?rev=190646&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp?rev=190646&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/POSIX/RegisterContext_x86_64.cpp (removed)<br>
@@ -1,1563 +0,0 @@<br>
-//===-- RegisterContext_x86_64.cpp -------------------------*- C++ -*-===//<br>
-//<br>
-// The LLVM Compiler Infrastructure<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===----------------------------------------------------------------------===//<br>
-<br>
-#include <cstring><br>
-#include <errno.h><br>
-#include <stdint.h><br>
-<br>
-#include "lldb/Core/DataBufferHeap.h"<br>
-#include "lldb/Core/DataExtractor.h"<br>
-#include "lldb/Core/RegisterValue.h"<br>
-#include "lldb/Core/Scalar.h"<br>
-#include "lldb/Target/Target.h"<br>
-#include "lldb/Target/Thread.h"<br>
-#include "lldb/Host/Endian.h"<br>
-#include "llvm/Support/Compiler.h"<br>
-<br>
-#include "ProcessPOSIX.h"<br>
-#if defined(__linux__) or defined(__FreeBSD__)<br>
-#include "ProcessMonitor.h"<br>
-#endif<br>
-#include "RegisterContext_i386.h"<br>
-#include "RegisterContext_x86.h"<br>
-#include "RegisterContext_x86_64.h"<br>
-#include "Plugins/Process/elf-core/ProcessElfCore.h"<br>
-<br>
-using namespace lldb_private;<br>
-using namespace lldb;<br>
-<br>
-// Support ptrace extensions even when compiled without required kernel support<br>
-#ifndef NT_X86_XSTATE<br>
- #define NT_X86_XSTATE 0x202<br>
-#endif<br>
-<br>
-enum<br>
-{<br>
- gcc_dwarf_gpr_rax = 0,<br>
- gcc_dwarf_gpr_rdx,<br>
- gcc_dwarf_gpr_rcx,<br>
- gcc_dwarf_gpr_rbx,<br>
- gcc_dwarf_gpr_rsi,<br>
- gcc_dwarf_gpr_rdi,<br>
- gcc_dwarf_gpr_rbp,<br>
- gcc_dwarf_gpr_rsp,<br>
- gcc_dwarf_gpr_r8,<br>
- gcc_dwarf_gpr_r9,<br>
- gcc_dwarf_gpr_r10,<br>
- gcc_dwarf_gpr_r11,<br>
- gcc_dwarf_gpr_r12,<br>
- gcc_dwarf_gpr_r13,<br>
- gcc_dwarf_gpr_r14,<br>
- gcc_dwarf_gpr_r15,<br>
- gcc_dwarf_gpr_rip,<br>
- gcc_dwarf_fpu_xmm0,<br>
- gcc_dwarf_fpu_xmm1,<br>
- gcc_dwarf_fpu_xmm2,<br>
- gcc_dwarf_fpu_xmm3,<br>
- gcc_dwarf_fpu_xmm4,<br>
- gcc_dwarf_fpu_xmm5,<br>
- gcc_dwarf_fpu_xmm6,<br>
- gcc_dwarf_fpu_xmm7,<br>
- gcc_dwarf_fpu_xmm8,<br>
- gcc_dwarf_fpu_xmm9,<br>
- gcc_dwarf_fpu_xmm10,<br>
- gcc_dwarf_fpu_xmm11,<br>
- gcc_dwarf_fpu_xmm12,<br>
- gcc_dwarf_fpu_xmm13,<br>
- gcc_dwarf_fpu_xmm14,<br>
- gcc_dwarf_fpu_xmm15,<br>
- gcc_dwarf_fpu_stmm0,<br>
- gcc_dwarf_fpu_stmm1,<br>
- gcc_dwarf_fpu_stmm2,<br>
- gcc_dwarf_fpu_stmm3,<br>
- gcc_dwarf_fpu_stmm4,<br>
- gcc_dwarf_fpu_stmm5,<br>
- gcc_dwarf_fpu_stmm6,<br>
- gcc_dwarf_fpu_stmm7,<br>
- gcc_dwarf_fpu_ymm0,<br>
- gcc_dwarf_fpu_ymm1,<br>
- gcc_dwarf_fpu_ymm2,<br>
- gcc_dwarf_fpu_ymm3,<br>
- gcc_dwarf_fpu_ymm4,<br>
- gcc_dwarf_fpu_ymm5,<br>
- gcc_dwarf_fpu_ymm6,<br>
- gcc_dwarf_fpu_ymm7,<br>
- gcc_dwarf_fpu_ymm8,<br>
- gcc_dwarf_fpu_ymm9,<br>
- gcc_dwarf_fpu_ymm10,<br>
- gcc_dwarf_fpu_ymm11,<br>
- gcc_dwarf_fpu_ymm12,<br>
- gcc_dwarf_fpu_ymm13,<br>
- gcc_dwarf_fpu_ymm14,<br>
- gcc_dwarf_fpu_ymm15<br>
-};<br>
-<br>
-enum<br>
-{<br>
- gdb_gpr_rax = 0,<br>
- gdb_gpr_rbx = 1,<br>
- gdb_gpr_rcx = 2,<br>
- gdb_gpr_rdx = 3,<br>
- gdb_gpr_rsi = 4,<br>
- gdb_gpr_rdi = 5,<br>
- gdb_gpr_rbp = 6,<br>
- gdb_gpr_rsp = 7,<br>
- gdb_gpr_r8 = 8,<br>
- gdb_gpr_r9 = 9,<br>
- gdb_gpr_r10 = 10,<br>
- gdb_gpr_r11 = 11,<br>
- gdb_gpr_r12 = 12,<br>
- gdb_gpr_r13 = 13,<br>
- gdb_gpr_r14 = 14,<br>
- gdb_gpr_r15 = 15,<br>
- gdb_gpr_rip = 16,<br>
- gdb_gpr_rflags = 17,<br>
- gdb_gpr_cs = 18,<br>
- gdb_gpr_ss = 19,<br>
- gdb_gpr_ds = 20,<br>
- gdb_gpr_es = 21,<br>
- gdb_gpr_fs = 22,<br>
- gdb_gpr_gs = 23,<br>
- gdb_fpu_stmm0 = 24,<br>
- gdb_fpu_stmm1 = 25,<br>
- gdb_fpu_stmm2 = 26,<br>
- gdb_fpu_stmm3 = 27,<br>
- gdb_fpu_stmm4 = 28,<br>
- gdb_fpu_stmm5 = 29,<br>
- gdb_fpu_stmm6 = 30,<br>
- gdb_fpu_stmm7 = 31,<br>
- gdb_fpu_fcw = 32,<br>
- gdb_fpu_fsw = 33,<br>
- gdb_fpu_ftw = 34,<br>
- gdb_fpu_cs_64 = 35,<br>
- gdb_fpu_ip = 36,<br>
- gdb_fpu_ds_64 = 37,<br>
- gdb_fpu_dp = 38,<br>
- gdb_fpu_fop = 39,<br>
- gdb_fpu_xmm0 = 40,<br>
- gdb_fpu_xmm1 = 41,<br>
- gdb_fpu_xmm2 = 42,<br>
- gdb_fpu_xmm3 = 43,<br>
- gdb_fpu_xmm4 = 44,<br>
- gdb_fpu_xmm5 = 45,<br>
- gdb_fpu_xmm6 = 46,<br>
- gdb_fpu_xmm7 = 47,<br>
- gdb_fpu_xmm8 = 48,<br>
- gdb_fpu_xmm9 = 49,<br>
- gdb_fpu_xmm10 = 50,<br>
- gdb_fpu_xmm11 = 51,<br>
- gdb_fpu_xmm12 = 52,<br>
- gdb_fpu_xmm13 = 53,<br>
- gdb_fpu_xmm14 = 54,<br>
- gdb_fpu_xmm15 = 55,<br>
- gdb_fpu_mxcsr = 56,<br>
- gdb_fpu_ymm0 = 57,<br>
- gdb_fpu_ymm1 = 58,<br>
- gdb_fpu_ymm2 = 59,<br>
- gdb_fpu_ymm3 = 60,<br>
- gdb_fpu_ymm4 = 61,<br>
- gdb_fpu_ymm5 = 62,<br>
- gdb_fpu_ymm6 = 63,<br>
- gdb_fpu_ymm7 = 64,<br>
- gdb_fpu_ymm8 = 65,<br>
- gdb_fpu_ymm9 = 66,<br>
- gdb_fpu_ymm10 = 67,<br>
- gdb_fpu_ymm11 = 68,<br>
- gdb_fpu_ymm12 = 69,<br>
- gdb_fpu_ymm13 = 70,<br>
- gdb_fpu_ymm14 = 71,<br>
- gdb_fpu_ymm15 = 72<br>
-};<br>
-<br>
-static const<br>
-uint32_t g_gpr_regnums[k_num_gpr_registers] =<br>
-{<br>
- gpr_rax,<br>
- gpr_rbx,<br>
- gpr_rcx,<br>
- gpr_rdx,<br>
- gpr_rdi,<br>
- gpr_rsi,<br>
- gpr_rbp,<br>
- gpr_rsp,<br>
- gpr_r8,<br>
- gpr_r9,<br>
- gpr_r10,<br>
- gpr_r11,<br>
- gpr_r12,<br>
- gpr_r13,<br>
- gpr_r14,<br>
- gpr_r15,<br>
- gpr_rip,<br>
- gpr_rflags,<br>
- gpr_cs,<br>
- gpr_fs,<br>
- gpr_gs,<br>
- gpr_ss,<br>
- gpr_ds,<br>
- gpr_es,<br>
- gpr_eax,<br>
- gpr_ebx,<br>
- gpr_ecx,<br>
- gpr_edx,<br>
- gpr_edi,<br>
- gpr_esi,<br>
- gpr_ebp,<br>
- gpr_esp,<br>
- gpr_eip,<br>
- gpr_eflags<br>
-};<br>
-<br>
-static const uint32_t<br>
-g_fpu_regnums[k_num_fpr_registers] =<br>
-{<br>
- fpu_fcw,<br>
- fpu_fsw,<br>
- fpu_ftw,<br>
- fpu_fop,<br>
- fpu_ip,<br>
- fpu_cs,<br>
- fpu_dp,<br>
- fpu_ds,<br>
- fpu_mxcsr,<br>
- fpu_mxcsrmask,<br>
- fpu_stmm0,<br>
- fpu_stmm1,<br>
- fpu_stmm2,<br>
- fpu_stmm3,<br>
- fpu_stmm4,<br>
- fpu_stmm5,<br>
- fpu_stmm6,<br>
- fpu_stmm7,<br>
- fpu_xmm0,<br>
- fpu_xmm1,<br>
- fpu_xmm2,<br>
- fpu_xmm3,<br>
- fpu_xmm4,<br>
- fpu_xmm5,<br>
- fpu_xmm6,<br>
- fpu_xmm7,<br>
- fpu_xmm8,<br>
- fpu_xmm9,<br>
- fpu_xmm10,<br>
- fpu_xmm11,<br>
- fpu_xmm12,<br>
- fpu_xmm13,<br>
- fpu_xmm14,<br>
- fpu_xmm15<br>
-};<br>
-<br>
-static const uint32_t<br>
-g_avx_regnums[k_num_avx_registers] =<br>
-{<br>
- fpu_ymm0,<br>
- fpu_ymm1,<br>
- fpu_ymm2,<br>
- fpu_ymm3,<br>
- fpu_ymm4,<br>
- fpu_ymm5,<br>
- fpu_ymm6,<br>
- fpu_ymm7,<br>
- fpu_ymm8,<br>
- fpu_ymm9,<br>
- fpu_ymm10,<br>
- fpu_ymm11,<br>
- fpu_ymm12,<br>
- fpu_ymm13,<br>
- fpu_ymm14,<br>
- fpu_ymm15<br>
-};<br>
-<br>
-// Number of register sets provided by this context.<br>
-enum<br>
-{<br>
- k_num_extended_register_sets = 1,<br>
- k_num_register_sets = 3<br>
-};<br>
-<br>
-static const RegisterSet<br>
-g_reg_sets[k_num_register_sets] =<br>
-{<br>
- { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums },<br>
- { "Floating Point Registers", "fpu", k_num_fpr_registers, g_fpu_regnums },<br>
- { "Advanced Vector Extensions", "avx", k_num_avx_registers, g_avx_regnums }<br>
-};<br>
-<br>
-// Computes the offset of the given FPR in the extended data area.<br>
-#define FPR_OFFSET(regname) \<br>
- (offsetof(RegisterContext_x86_64::FPR, xstate) + \<br>
- offsetof(RegisterContext_x86_64::FXSAVE, regname))<br>
-<br>
-// Computes the offset of the YMM register assembled from register halves.<br>
-#define YMM_OFFSET(regname) \<br>
- (offsetof(RegisterContext_x86_64::YMM, regname))<br>
-<br>
-// Number of bytes needed to represent a i386 GPR<br>
-#define GPR_i386_SIZE(reg) sizeof(((RegisterContext_i386::GPR*)NULL)->reg)<br>
-<br>
-// Number of bytes needed to represent a FPR.<br>
-#define FPR_SIZE(reg) sizeof(((RegisterContext_x86_64::FXSAVE*)NULL)->reg)<br>
-<br>
-// Number of bytes needed to represent the i'th FP register.<br>
-#define FP_SIZE sizeof(((RegisterContext_x86_64::MMSReg*)NULL)->bytes)<br>
-<br>
-// Number of bytes needed to represent an XMM register.<br>
-#define XMM_SIZE sizeof(RegisterContext_x86_64::XMMReg)<br>
-<br>
-// Number of bytes needed to represent a YMM register.<br>
-#define YMM_SIZE sizeof(RegisterContext_x86_64::YMMReg)<br>
-<br>
-// Note that the size and offset will be updated by platform-specific classes.<br>
-#define DEFINE_GPR(reg, alt, kind1, kind</div></div>...<br><br>[Message clipped] </blockquote></div><br></div></div>