<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 26, 2011, at 1:58 PM, Stephen Wilson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Marco, Greg,<br><br>On Sat, Feb 26, 2011 at 03:09:45PM +0100, Marco Minutoli wrote:<br><blockquote type="cite">Here is the patch with the changes you have requested.<br></blockquote><br>Nice. This looks good.<br><br><br>Greg, mind if I commit this one? There is one trivial tweak needed to<br>avoid a compile time warning. <font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>I am happy with letting you OK the any linux specific patches. If it touches anyting in the core that is significant, then let me know, else I will let you OK the linux patches, is that alright?</div><div><br><blockquote type="cite"><div><br><blockquote type="cite">Sorry for the duplicated header here It was late night(or maybe early<br></blockquote><blockquote type="cite">in the morning :D) when I sent the patch to the ML. Next time I'll be<br></blockquote><blockquote type="cite">more careful.<br></blockquote><br>No worries! We still have a bit of work to do to support i386 on linux<br>but this is a significant step forward. Thanks so much!<br><br><br><blockquote type="cite">Best regards,<br></blockquote><blockquote type="cite">Marco<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Sat, Feb 26, 2011 at 1:25 AM, Stephen Wilson <<a href="mailto:wilsons@start.ca">wilsons@start.ca</a>> wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">On Fri, Feb 25, 2011 at 02:52:51AM +0100, Marco Minutoli wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Hi everybody,<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">as suggested by Stephen I had a look at the user_32.h Linux header and<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I fixed the UserArea structure.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">In the attachment the revised patch. As ever comments and suggestions<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">are welcome :).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">This looks good. Only two small issues: the patch for<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">RegisterContextLinux_i386.h contains the old and new versions of your<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">patch (the latter is protected behind an #ifndef). Also, I think we<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">need the following patch for LinuxThread.cpp: Use a register context<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">according to the host instead of the process target so we can debug and<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">test lldb using 32-bit binaries on 64-bit systems.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I have not been able to test your patch much yet -- another issue has<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">crept into the linux builds that I need to track down first... but with<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">those changes I think the patches can go in.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks again!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">index 397d31b..15bc9e3 100644<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">--- a/source/Plugins/Process/Linux/LinuxThread.cpp<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+++ b/source/Plugins/Process/Linux/LinuxThread.cpp<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">@@ -12,6 +12,7 @@<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> // C++ Includes<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> // Other libraries and framework includes<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+#include "lldb/Host/Host.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "lldb/Target/Process.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "lldb/Target/StopInfo.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "lldb/Target/Target.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">@@ -19,6 +20,7 @@<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "LinuxThread.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "ProcessLinux.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "ProcessMonitor.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+#include "RegisterContextLinux_i386.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "RegisterContextLinux_x86_64.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> #include "UnwindLLDB.h"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">@@ -59,11 +61,9 @@ LinuxThread::GetInfo()<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> lldb::RegisterContextSP<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> LinuxThread::GetRegisterContext()<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- ProcessLinux &process = static_cast<ProcessLinux&>(GetProcess());<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> if (!m_reg_context_sp)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- ArchSpec arch = process.GetTarget().GetArchitecture();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ ArchSpec arch = Host::GetArchitecture();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> switch (arch.GetCore())<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">@@ -71,6 +71,12 @@ LinuxThread::GetRegisterContext()<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> assert(false && "CPU type not supported!");<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> break;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ case ArchSpec::eCore_x86_32_i386:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ case ArchSpec::eCore_x86_32_i486:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ case ArchSpec::eCore_x86_32_i486sx:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ m_reg_context_sp.reset(new RegisterContextLinux_i386(*this, 0));<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+ break;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> case ArchSpec::eCore_x86_64_x86_64:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0));<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> break;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-- <br></blockquote><blockquote type="cite">Marco Minutoli<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">"If A is success in life, then A equals x plus y plus z. Work is x;<br></blockquote><blockquote type="cite">y is play; and z is keeping your mouth shut." --A. Einstein<br></blockquote><br><blockquote type="cite">diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp<br></blockquote><blockquote type="cite">index 397d31b..8f3a273 100644<br></blockquote><blockquote type="cite">--- a/source/Plugins/Process/Linux/LinuxThread.cpp<br></blockquote><blockquote type="cite">+++ b/source/Plugins/Process/Linux/LinuxThread.cpp<br></blockquote><blockquote type="cite">@@ -12,6 +12,7 @@<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> // C++ Includes<br></blockquote><blockquote type="cite"> // Other libraries and framework includes<br></blockquote><blockquote type="cite">+#include "lldb/Host/Host.h"<br></blockquote><blockquote type="cite"> #include "lldb/Target/Process.h"<br></blockquote><blockquote type="cite"> #include "lldb/Target/StopInfo.h"<br></blockquote><blockquote type="cite"> #include "lldb/Target/Target.h"<br></blockquote><blockquote type="cite">@@ -19,6 +20,7 @@<br></blockquote><blockquote type="cite"> #include "LinuxThread.h"<br></blockquote><blockquote type="cite"> #include "ProcessLinux.h"<br></blockquote><blockquote type="cite"> #include "ProcessMonitor.h"<br></blockquote><blockquote type="cite">+#include "RegisterContextLinux_i386.h"<br></blockquote><blockquote type="cite"> #include "RegisterContextLinux_x86_64.h"<br></blockquote><blockquote type="cite"> #include "UnwindLLDB.h"<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">@@ -63,7 +65,7 @@ LinuxThread::GetRegisterContext()<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> if (!m_reg_context_sp)<br></blockquote><blockquote type="cite"> {<br></blockquote><blockquote type="cite">- ArchSpec arch = process.GetTarget().GetArchitecture();<br></blockquote><blockquote type="cite">+ ArchSpec arch = Host::GetArchitecture();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> switch (arch.GetCore())<br></blockquote><blockquote type="cite"> {<br></blockquote><blockquote type="cite">@@ -71,6 +73,12 @@ LinuxThread::GetRegisterContext()<br></blockquote><blockquote type="cite"> assert(false && "CPU type not supported!");<br></blockquote><blockquote type="cite"> break;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+ case ArchSpec::eCore_x86_32_i386:<br></blockquote><blockquote type="cite">+ case ArchSpec::eCore_x86_32_i486:<br></blockquote><blockquote type="cite">+ case ArchSpec::eCore_x86_32_i486sx:<br></blockquote><blockquote type="cite">+ m_reg_context_sp.reset(new RegisterContextLinux_i386(*this, 0));<br></blockquote><blockquote type="cite">+ break;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> case ArchSpec::eCore_x86_64_x86_64:<br></blockquote><blockquote type="cite"> m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0));<br></blockquote><blockquote type="cite"> break;<br></blockquote><blockquote type="cite">diff --git a/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp b/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp<br></blockquote><blockquote type="cite">new file mode 100644<br></blockquote><blockquote type="cite">index 0000000..b7451d2<br></blockquote><blockquote type="cite">--- /dev/null<br></blockquote><blockquote type="cite">+++ b/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp<br></blockquote><blockquote type="cite">@@ -0,0 +1,633 @@<br></blockquote><blockquote type="cite">+//===-- RegisterContextLinux_i386.cpp ----------------------------*- C++ -*-===//<br></blockquote><blockquote type="cite">+//<br></blockquote><blockquote type="cite">+// The LLVM Compiler Infrastructure<br></blockquote><blockquote type="cite">+//<br></blockquote><blockquote type="cite">+// This file is distributed under the University of Illinois Open Source<br></blockquote><blockquote type="cite">+// License. See LICENSE.TXT for details.<br></blockquote><blockquote type="cite">+//<br></blockquote><blockquote type="cite">+//===----------------------------------------------------------------------===//<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#include "lldb/Core/DataExtractor.h"<br></blockquote><blockquote type="cite">+#include "lldb/Target/Thread.h"<br></blockquote><blockquote type="cite">+#include "lldb/Host/Endian.h"<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#include "ProcessLinux.h"<br></blockquote><blockquote type="cite">+#include "ProcessMonitor.h"<br></blockquote><blockquote type="cite">+#include "RegisterContextLinux_i386.h"<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+using namespace lldb_private;<br></blockquote><blockquote type="cite">+using namespace lldb;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+enum<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ k_first_gpr,<br></blockquote><blockquote type="cite">+ gpr_eax = k_first_gpr,<br></blockquote><blockquote type="cite">+ gpr_ebx,<br></blockquote><blockquote type="cite">+ gpr_ecx,<br></blockquote><blockquote type="cite">+ gpr_edx,<br></blockquote><blockquote type="cite">+ gpr_edi,<br></blockquote><blockquote type="cite">+ gpr_esi,<br></blockquote><blockquote type="cite">+ gpr_ebp,<br></blockquote><blockquote type="cite">+ gpr_esp,<br></blockquote><blockquote type="cite">+ gpr_ss,<br></blockquote><blockquote type="cite">+ gpr_eflags,<br></blockquote><blockquote type="cite">+ gpr_orig_ax,<br></blockquote><blockquote type="cite">+ gpr_eip,<br></blockquote><blockquote type="cite">+ gpr_cs,<br></blockquote><blockquote type="cite">+ gpr_ds,<br></blockquote><blockquote type="cite">+ gpr_es,<br></blockquote><blockquote type="cite">+ gpr_fs,<br></blockquote><blockquote type="cite">+ gpr_gs,<br></blockquote><blockquote type="cite">+ k_last_gpr = gpr_gs,<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ k_first_fpr,<br></blockquote><blockquote type="cite">+ fpu_fcw = k_first_fpr,<br></blockquote><blockquote type="cite">+ fpu_fsw,<br></blockquote><blockquote type="cite">+ fpu_ftw,<br></blockquote><blockquote type="cite">+ fpu_fop,<br></blockquote><blockquote type="cite">+ fpu_ip,<br></blockquote><blockquote type="cite">+ fpu_cs,<br></blockquote><blockquote type="cite">+ fpu_foo,<br></blockquote><blockquote type="cite">+ fpu_fos,<br></blockquote><blockquote type="cite">+ fpu_mxcsr,<br></blockquote><blockquote type="cite">+ fpu_stmm0,<br></blockquote><blockquote type="cite">+ fpu_stmm1,<br></blockquote><blockquote type="cite">+ fpu_stmm2,<br></blockquote><blockquote type="cite">+ fpu_stmm3,<br></blockquote><blockquote type="cite">+ fpu_stmm4,<br></blockquote><blockquote type="cite">+ fpu_stmm5,<br></blockquote><blockquote type="cite">+ fpu_stmm6,<br></blockquote><blockquote type="cite">+ fpu_stmm7,<br></blockquote><blockquote type="cite">+ fpu_xmm0,<br></blockquote><blockquote type="cite">+ fpu_xmm1,<br></blockquote><blockquote type="cite">+ fpu_xmm2,<br></blockquote><blockquote type="cite">+ fpu_xmm3,<br></blockquote><blockquote type="cite">+ fpu_xmm4,<br></blockquote><blockquote type="cite">+ fpu_xmm5,<br></blockquote><blockquote type="cite">+ fpu_xmm6,<br></blockquote><blockquote type="cite">+ fpu_xmm7,<br></blockquote><blockquote type="cite">+ k_last_fpr = fpu_xmm7,<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ k_num_registers,<br></blockquote><blockquote type="cite">+ k_num_gpr_registers = k_last_gpr - k_first_gpr + 1,<br></blockquote><blockquote type="cite">+ k_num_fpu_registers = k_last_fpr - k_first_fpr + 1<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// Number of register sets provided by this context.<br></blockquote><blockquote type="cite">+enum<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ k_num_register_sets = 2<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+enum<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ gcc_eax = 0,<br></blockquote><blockquote type="cite">+ gcc_ecx,<br></blockquote><blockquote type="cite">+ gcc_edx,<br></blockquote><blockquote type="cite">+ gcc_ebx,<br></blockquote><blockquote type="cite">+ gcc_ebp,<br></blockquote><blockquote type="cite">+ gcc_esp,<br></blockquote><blockquote type="cite">+ gcc_esi,<br></blockquote><blockquote type="cite">+ gcc_edi,<br></blockquote><blockquote type="cite">+ gcc_eip,<br></blockquote><blockquote type="cite">+ gcc_eflags<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+enum<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ dwarf_eax = 0,<br></blockquote><blockquote type="cite">+ dwarf_ecx,<br></blockquote><blockquote type="cite">+ dwarf_edx,<br></blockquote><blockquote type="cite">+ dwarf_ebx,<br></blockquote><blockquote type="cite">+ dwarf_esp,<br></blockquote><blockquote type="cite">+ dwarf_ebp,<br></blockquote><blockquote type="cite">+ dwarf_esi,<br></blockquote><blockquote type="cite">+ dwarf_edi,<br></blockquote><blockquote type="cite">+ dwarf_eip,<br></blockquote><blockquote type="cite">+ dwarf_eflags,<br></blockquote><blockquote type="cite">+ dwarf_stmm0 = 11,<br></blockquote><blockquote type="cite">+ dwarf_stmm1,<br></blockquote><blockquote type="cite">+ dwarf_stmm2,<br></blockquote><blockquote type="cite">+ dwarf_stmm3,<br></blockquote><blockquote type="cite">+ dwarf_stmm4,<br></blockquote><blockquote type="cite">+ dwarf_stmm5,<br></blockquote><blockquote type="cite">+ dwarf_stmm6,<br></blockquote><blockquote type="cite">+ dwarf_stmm7,<br></blockquote><blockquote type="cite">+ dwarf_xmm0 = 21,<br></blockquote><blockquote type="cite">+ dwarf_xmm1,<br></blockquote><blockquote type="cite">+ dwarf_xmm2,<br></blockquote><blockquote type="cite">+ dwarf_xmm3,<br></blockquote><blockquote type="cite">+ dwarf_xmm4,<br></blockquote><blockquote type="cite">+ dwarf_xmm5,<br></blockquote><blockquote type="cite">+ dwarf_xmm6,<br></blockquote><blockquote type="cite">+ dwarf_xmm7<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+enum<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ gdb_eax = 0,<br></blockquote><blockquote type="cite">+ gdb_ecx = 1,<br></blockquote><blockquote type="cite">+ gdb_edx = 2,<br></blockquote><blockquote type="cite">+ gdb_ebx = 3,<br></blockquote><blockquote type="cite">+ gdb_esp = 4,<br></blockquote><blockquote type="cite">+ gdb_ebp = 5,<br></blockquote><blockquote type="cite">+ gdb_esi = 6,<br></blockquote><blockquote type="cite">+ gdb_edi = 7,<br></blockquote><blockquote type="cite">+ gdb_eip = 8,<br></blockquote><blockquote type="cite">+ gdb_eflags = 9,<br></blockquote><blockquote type="cite">+ gdb_cs = 10,<br></blockquote><blockquote type="cite">+ gdb_ss = 11,<br></blockquote><blockquote type="cite">+ gdb_ds = 12,<br></blockquote><blockquote type="cite">+ gdb_es = 13,<br></blockquote><blockquote type="cite">+ gdb_fs = 14,<br></blockquote><blockquote type="cite">+ gdb_gs = 15,<br></blockquote><blockquote type="cite">+ gdb_stmm0 = 16,<br></blockquote><blockquote type="cite">+ gdb_stmm1 = 17,<br></blockquote><blockquote type="cite">+ gdb_stmm2 = 18,<br></blockquote><blockquote type="cite">+ gdb_stmm3 = 19,<br></blockquote><blockquote type="cite">+ gdb_stmm4 = 20,<br></blockquote><blockquote type="cite">+ gdb_stmm5 = 21,<br></blockquote><blockquote type="cite">+ gdb_stmm6 = 22,<br></blockquote><blockquote type="cite">+ gdb_stmm7 = 23,<br></blockquote><blockquote type="cite">+ gdb_fcw = 24,<br></blockquote><blockquote type="cite">+ gdb_fsw = 25,<br></blockquote><blockquote type="cite">+ gdb_ftw = 26,<br></blockquote><blockquote type="cite">+ gdb_fpu_cs = 27,<br></blockquote><blockquote type="cite">+ gdb_ip = 28,<br></blockquote><blockquote type="cite">+ gdb_fpu_ds = 29,<br></blockquote><blockquote type="cite">+ gdb_dp = 30,<br></blockquote><blockquote type="cite">+ gdb_fop = 31,<br></blockquote><blockquote type="cite">+ gdb_xmm0 = 32,<br></blockquote><blockquote type="cite">+ gdb_xmm1 = 33,<br></blockquote><blockquote type="cite">+ gdb_xmm2 = 34,<br></blockquote><blockquote type="cite">+ gdb_xmm3 = 35,<br></blockquote><blockquote type="cite">+ gdb_xmm4 = 36,<br></blockquote><blockquote type="cite">+ gdb_xmm5 = 37,<br></blockquote><blockquote type="cite">+ gdb_xmm6 = 38,<br></blockquote><blockquote type="cite">+ gdb_xmm7 = 39,<br></blockquote><blockquote type="cite">+ gdb_mxcsr = 40,<br></blockquote><blockquote type="cite">+ gdb_mm0 = 41,<br></blockquote><blockquote type="cite">+ gdb_mm1 = 42,<br></blockquote><blockquote type="cite">+ gdb_mm2 = 43,<br></blockquote><blockquote type="cite">+ gdb_mm3 = 44,<br></blockquote><blockquote type="cite">+ gdb_mm4 = 45,<br></blockquote><blockquote type="cite">+ gdb_mm5 = 46,<br></blockquote><blockquote type="cite">+ gdb_mm6 = 47,<br></blockquote><blockquote type="cite">+ gdb_mm7 = 48<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static const<br></blockquote><blockquote type="cite">+uint32_t g_gpr_regnums[k_num_gpr_registers] =<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ gpr_eax,<br></blockquote><blockquote type="cite">+ gpr_ebx,<br></blockquote><blockquote type="cite">+ gpr_ecx,<br></blockquote><blockquote type="cite">+ gpr_edx,<br></blockquote><blockquote type="cite">+ gpr_edi,<br></blockquote><blockquote type="cite">+ gpr_esi,<br></blockquote><blockquote type="cite">+ gpr_ebp,<br></blockquote><blockquote type="cite">+ gpr_esp,<br></blockquote><blockquote type="cite">+ gpr_ss,<br></blockquote><blockquote type="cite">+ gpr_eflags,<br></blockquote><blockquote type="cite">+ gpr_orig_ax,<br></blockquote><blockquote type="cite">+ gpr_eip,<br></blockquote><blockquote type="cite">+ gpr_cs,<br></blockquote><blockquote type="cite">+ gpr_ds,<br></blockquote><blockquote type="cite">+ gpr_es,<br></blockquote><blockquote type="cite">+ gpr_fs,<br></blockquote><blockquote type="cite">+ gpr_gs,<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static const uint32_t<br></blockquote><blockquote type="cite">+g_fpu_regnums[k_num_fpu_registers] =<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ fpu_fcw,<br></blockquote><blockquote type="cite">+ fpu_fsw,<br></blockquote><blockquote type="cite">+ fpu_ftw,<br></blockquote><blockquote type="cite">+ fpu_fop,<br></blockquote><blockquote type="cite">+ fpu_ip,<br></blockquote><blockquote type="cite">+ fpu_cs,<br></blockquote><blockquote type="cite">+ fpu_foo,<br></blockquote><blockquote type="cite">+ fpu_fos,<br></blockquote><blockquote type="cite">+ fpu_mxcsr,<br></blockquote><blockquote type="cite">+ fpu_stmm0,<br></blockquote><blockquote type="cite">+ fpu_stmm1,<br></blockquote><blockquote type="cite">+ fpu_stmm2,<br></blockquote><blockquote type="cite">+ fpu_stmm3,<br></blockquote><blockquote type="cite">+ fpu_stmm4,<br></blockquote><blockquote type="cite">+ fpu_stmm5,<br></blockquote><blockquote type="cite">+ fpu_stmm6,<br></blockquote><blockquote type="cite">+ fpu_stmm7,<br></blockquote><blockquote type="cite">+ fpu_xmm0,<br></blockquote><blockquote type="cite">+ fpu_xmm1,<br></blockquote><blockquote type="cite">+ fpu_xmm2,<br></blockquote><blockquote type="cite">+ fpu_xmm3,<br></blockquote><blockquote type="cite">+ fpu_xmm4,<br></blockquote><blockquote type="cite">+ fpu_xmm5,<br></blockquote><blockquote type="cite">+ fpu_xmm6,<br></blockquote><blockquote type="cite">+ fpu_xmm7,<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static const RegisterSet<br></blockquote><blockquote type="cite">+g_reg_sets[k_num_register_sets] =<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ { "General Purpose Registers", "gpr", k_num_gpr_registers, g_gpr_regnums },<br></blockquote><blockquote type="cite">+ { "Floating Point Registers", "fpu", k_num_fpu_registers, g_fpu_regnums }<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// Computes the offset of the given GPR in the user data area.<br></blockquote><blockquote type="cite">+#define GPR_OFFSET(regname) \<br></blockquote><blockquote type="cite">+ (offsetof(RegisterContextLinux_i386::UserArea, regs) + \<br></blockquote><blockquote type="cite">+ offsetof(RegisterContextLinux_i386::GPR, regname))<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// Computes the offset of the given FPR in the user data area.<br></blockquote><blockquote type="cite">+#define FPR_OFFSET(regname) \<br></blockquote><blockquote type="cite">+ (offsetof(RegisterContextLinux_i386::UserArea, i387) + \<br></blockquote><blockquote type="cite">+ offsetof(RegisterContextLinux_i386::FPU, regname))<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// Number of bytes needed to represent a GPR.<br></blockquote><blockquote type="cite">+#define GPR_SIZE(reg) sizeof(((RegisterContextLinux_i386::GPR*)NULL)->reg)<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// Number of bytes needed to represent a FPR.<br></blockquote><blockquote type="cite">+#define FPR_SIZE(reg) sizeof(((RegisterContextLinux_i386::FPU*)NULL)->reg)<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// Number of bytes needed to represent the i'th FP register.<br></blockquote><blockquote type="cite">+#define FP_SIZE sizeof(((RegisterContextLinux_i386::MMSReg*)NULL)->bytes)<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// Number of bytes needed to represent an XMM register.<br></blockquote><blockquote type="cite">+#define XMM_SIZE sizeof(RegisterContextLinux_i386::XMMReg)<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \<br></blockquote><blockquote type="cite">+ { #reg, alt, GPR_SIZE(reg), GPR_OFFSET(reg), eEncodingUint, \<br></blockquote><blockquote type="cite">+ eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg } }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#define DEFINE_FPR(reg, kind1, kind2, kind3, kind4) \<br></blockquote><blockquote type="cite">+ { #reg, NULL, FPR_SIZE(reg), FPR_OFFSET(reg), eEncodingUint, \<br></blockquote><blockquote type="cite">+ eFormatHex, { kind1, kind2, kind3, kind4, fpu_##reg } }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#define DEFINE_FP(reg, i) \<br></blockquote><blockquote type="cite">+ { #reg#i, NULL, FP_SIZE, FPR_OFFSET(reg[i]), eEncodingVector, \<br></blockquote><blockquote type="cite">+ eFormatVectorOfUInt8, \<br></blockquote><blockquote type="cite">+ { dwarf_##reg##i, dwarf_##reg##i, \<br></blockquote><blockquote type="cite">+ LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i } }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#define DEFINE_XMM(reg, i) \<br></blockquote><blockquote type="cite">+ { #reg#i, NULL, XMM_SIZE, FPR_OFFSET(reg[i]), eEncodingVector, \<br></blockquote><blockquote type="cite">+ eFormatVectorOfUInt8, \<br></blockquote><blockquote type="cite">+ { dwarf_##reg##i, dwarf_##reg##i, \<br></blockquote><blockquote type="cite">+ LLDB_INVALID_REGNUM, gdb_##reg##i, fpu_##reg##i } }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static RegisterInfo<br></blockquote><blockquote type="cite">+g_register_infos[k_num_registers] =<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ // General purpose registers.<br></blockquote><blockquote type="cite">+ DEFINE_GPR(eax, NULL, gcc_eax, dwarf_eax, LLDB_INVALID_REGNUM, gdb_eax),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(ebx, NULL, gcc_ebx, dwarf_ebx, LLDB_INVALID_REGNUM, gdb_ebx),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(ecx, NULL, gcc_ecx, dwarf_ecx, LLDB_INVALID_REGNUM, gdb_ecx),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(edx, NULL, gcc_edx, dwarf_edx, LLDB_INVALID_REGNUM, gdb_edx),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(edi, NULL, gcc_edi, dwarf_edi, LLDB_INVALID_REGNUM, gdb_edi),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(esi, NULL, gcc_esi, dwarf_esi, LLDB_INVALID_REGNUM, gdb_esi),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(ebp, "fp", gcc_ebp, dwarf_ebp, LLDB_INVALID_REGNUM, gdb_ebp),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(esp, "sp", gcc_esp, dwarf_esp, LLDB_INVALID_REGNUM, gdb_esp),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(ss, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ss),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(eflags, "flags", gcc_eflags, dwarf_eflags, LLDB_INVALID_REGNUM, gdb_eflags),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(eip, "pc", gcc_eip, dwarf_eip, LLDB_INVALID_REGNUM, gdb_eip),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(cs, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_cs),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(ds, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ds),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(es, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_es),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(fs, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fs),<br></blockquote><blockquote type="cite">+ DEFINE_GPR(gs, NULL, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_gs),<br></blockquote><blockquote type="cite">+ <br></blockquote><blockquote type="cite">+ // Floating point registers.<br></blockquote><blockquote type="cite">+ DEFINE_FPR(fcw, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fcw),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(fsw, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fsw),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(ftw, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ftw),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(fop, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fop),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(ip, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_ip),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(cs, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_cs),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(foo, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_dp),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(fos, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_fpu_ds),<br></blockquote><blockquote type="cite">+ DEFINE_FPR(mxcsr, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, gdb_mxcsr),<br></blockquote><blockquote type="cite">+ <br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 0),<br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 1),<br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 2),<br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 3),<br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 4),<br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 5),<br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 6),<br></blockquote><blockquote type="cite">+ DEFINE_FP(stmm, 7),<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ // XMM registers<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 0),<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 1),<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 2),<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 3),<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 4),<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 5),<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 6),<br></blockquote><blockquote type="cite">+ DEFINE_XMM(xmm, 7),<br></blockquote><blockquote type="cite">+ <br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static unsigned GetRegOffset(unsigned reg)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ assert(reg < k_num_registers && "Invalid register number.");<br></blockquote><blockquote type="cite">+ return g_register_infos[reg].byte_offset;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static unsigned GetRegSize(unsigned reg)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ assert(reg < k_num_registers && "Invalid register number.");<br></blockquote><blockquote type="cite">+ return g_register_infos[reg].byte_size;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static bool IsGPR(unsigned reg)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ return reg <= k_last_gpr; // GPR's come first.<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+static bool IsFPR(unsigned reg)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ return (k_first_fpr <= reg && reg <= k_last_fpr);<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::RegisterContextLinux_i386(Thread &thread,<br></blockquote><blockquote type="cite">+ uint32_t concrete_frame_idx)<br></blockquote><blockquote type="cite">+ : RegisterContextLinux(thread, concrete_frame_idx)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::~RegisterContextLinux_i386()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ProcessMonitor &<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::GetMonitor()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ ProcessLinux *process = static_cast<ProcessLinux*>(CalculateProcess());<br></blockquote><blockquote type="cite">+ return process->GetMonitor();<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+void<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::Invalidate()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+void<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::InvalidateAllRegisters()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+size_t<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::GetRegisterCount()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ return k_num_registers;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+const RegisterInfo *<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::GetRegisterInfoAtIndex(uint32_t reg)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ if (reg < k_num_registers)<br></blockquote><blockquote type="cite">+ return &g_register_infos[reg];<br></blockquote><blockquote type="cite">+ else<br></blockquote><blockquote type="cite">+ return NULL;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+size_t<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::GetRegisterSetCount()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ return k_num_register_sets;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+const RegisterSet *<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::GetRegisterSet(uint32_t set)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ if (set < k_num_register_sets)<br></blockquote><blockquote type="cite">+ return &g_reg_sets[set];<br></blockquote><blockquote type="cite">+ else<br></blockquote><blockquote type="cite">+ return NULL;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::ReadRegisterValue(uint32_t reg,<br></blockquote><blockquote type="cite">+ Scalar &value)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ ProcessMonitor &monitor = GetMonitor();<br></blockquote><blockquote type="cite">+ return monitor.ReadRegisterValue(GetRegOffset(reg), value);<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::ReadRegisterBytes(uint32_t reg,<br></blockquote><blockquote type="cite">+ DataExtractor &data)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ uint8_t *buf = reinterpret_cast<uint8_t*>(&user);<br></blockquote><blockquote type="cite">+ bool status;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ if (IsGPR(reg))<br></blockquote><blockquote type="cite">+ status = ReadGPR();<br></blockquote><blockquote type="cite">+ else if (IsFPR(reg))<br></blockquote><blockquote type="cite">+ status = ReadFPR();<br></blockquote><blockquote type="cite">+ else <br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ assert(false && "invalid register number");<br></blockquote><blockquote type="cite">+ status = false;<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ if (status)<br></blockquote><blockquote type="cite">+ data.SetData(buf + GetRegOffset(reg), GetRegSize(reg), lldb::endian::InlHostByteOrder());<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ return status;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::ReadAllRegisterValues(DataBufferSP &data_sp)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ return false;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::WriteRegisterValue(uint32_t reg,<br></blockquote><blockquote type="cite">+ const Scalar &value)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ ProcessMonitor &monitor = GetMonitor();<br></blockquote><blockquote type="cite">+ return monitor.WriteRegisterValue(GetRegOffset(reg), value);<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::WriteRegisterBytes(uint32_t reg,<br></blockquote><blockquote type="cite">+ DataExtractor &data,<br></blockquote><blockquote type="cite">+ uint32_t data_offset)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ return false;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::WriteAllRegisterValues(const DataBufferSP &data)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ return false;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::UpdateAfterBreakpoint()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ // PC points one byte past the int3 responsible for the breakpoint.<br></blockquote><blockquote type="cite">+ lldb::addr_t pc;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ if ((pc = GetPC()) == LLDB_INVALID_ADDRESS)<br></blockquote><blockquote type="cite">+ return false;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ SetPC(pc - 1);<br></blockquote><blockquote type="cite">+ return true;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+uint32_t<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::ConvertRegisterKindToRegisterNumber(uint32_t kind,<br></blockquote><blockquote type="cite">+ uint32_t num)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ if (kind == eRegisterKindGeneric)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ switch (num)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ case LLDB_REGNUM_GENERIC_PC: return gpr_eip;<br></blockquote><blockquote type="cite">+ case LLDB_REGNUM_GENERIC_SP: return gpr_esp;<br></blockquote><blockquote type="cite">+ case LLDB_REGNUM_GENERIC_FP: return gpr_ebp;<br></blockquote><blockquote type="cite">+ case LLDB_REGNUM_GENERIC_FLAGS: return gpr_eflags;<br></blockquote><blockquote type="cite">+ case LLDB_REGNUM_GENERIC_RA:<br></blockquote><blockquote type="cite">+ default:<br></blockquote><blockquote type="cite">+ return LLDB_INVALID_REGNUM;<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ if (kind == eRegisterKindGCC || kind == eRegisterKindDWARF)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ switch (num)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ case dwarf_eax: return gpr_eax;<br></blockquote><blockquote type="cite">+ case dwarf_edx: return gpr_edx;<br></blockquote><blockquote type="cite">+ case dwarf_ecx: return gpr_ecx;<br></blockquote><blockquote type="cite">+ case dwarf_ebx: return gpr_ebx;<br></blockquote><blockquote type="cite">+ case dwarf_esi: return gpr_esi;<br></blockquote><blockquote type="cite">+ case dwarf_edi: return gpr_edi;<br></blockquote><blockquote type="cite">+ case dwarf_ebp: return gpr_ebp;<br></blockquote><blockquote type="cite">+ case dwarf_esp: return gpr_esp;<br></blockquote><blockquote type="cite">+ case dwarf_eip: return gpr_eip;<br></blockquote><blockquote type="cite">+ case dwarf_xmm0: return fpu_xmm0;<br></blockquote><blockquote type="cite">+ case dwarf_xmm1: return fpu_xmm1;<br></blockquote><blockquote type="cite">+ case dwarf_xmm2: return fpu_xmm2;<br></blockquote><blockquote type="cite">+ case dwarf_xmm3: return fpu_xmm3;<br></blockquote><blockquote type="cite">+ case dwarf_xmm4: return fpu_xmm4;<br></blockquote><blockquote type="cite">+ case dwarf_xmm5: return fpu_xmm5;<br></blockquote><blockquote type="cite">+ case dwarf_xmm6: return fpu_xmm6;<br></blockquote><blockquote type="cite">+ case dwarf_xmm7: return fpu_xmm7;<br></blockquote><blockquote type="cite">+ case dwarf_stmm0: return fpu_stmm0;<br></blockquote><blockquote type="cite">+ case dwarf_stmm1: return fpu_stmm1;<br></blockquote><blockquote type="cite">+ case dwarf_stmm2: return fpu_stmm2;<br></blockquote><blockquote type="cite">+ case dwarf_stmm3: return fpu_stmm3;<br></blockquote><blockquote type="cite">+ case dwarf_stmm4: return fpu_stmm4;<br></blockquote><blockquote type="cite">+ case dwarf_stmm5: return fpu_stmm5;<br></blockquote><blockquote type="cite">+ case dwarf_stmm6: return fpu_stmm6;<br></blockquote><blockquote type="cite">+ case dwarf_stmm7: return fpu_stmm7;<br></blockquote><blockquote type="cite">+ default:<br></blockquote><blockquote type="cite">+ return LLDB_INVALID_REGNUM;<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ if (kind == eRegisterKindGDB)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ switch (num)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ case gdb_eax : return gpr_eax;<br></blockquote><blockquote type="cite">+ case gdb_ebx : return gpr_ebx;<br></blockquote><blockquote type="cite">+ case gdb_ecx : return gpr_ecx;<br></blockquote><blockquote type="cite">+ case gdb_edx : return gpr_edx;<br></blockquote><blockquote type="cite">+ case gdb_esi : return gpr_esi;<br></blockquote><blockquote type="cite">+ case gdb_edi : return gpr_edi;<br></blockquote><blockquote type="cite">+ case gdb_ebp : return gpr_ebp;<br></blockquote><blockquote type="cite">+ case gdb_esp : return gpr_esp;<br></blockquote><blockquote type="cite">+ case gdb_eip : return gpr_eip;<br></blockquote><blockquote type="cite">+ case gdb_eflags : return gpr_eflags;<br></blockquote><blockquote type="cite">+ case gdb_cs : return gpr_cs;<br></blockquote><blockquote type="cite">+ case gdb_ss : return gpr_ss;<br></blockquote><blockquote type="cite">+ case gdb_ds : return gpr_ds;<br></blockquote><blockquote type="cite">+ case gdb_es : return gpr_es;<br></blockquote><blockquote type="cite">+ case gdb_fs : return gpr_fs;<br></blockquote><blockquote type="cite">+ case gdb_gs : return gpr_gs;<br></blockquote><blockquote type="cite">+ case gdb_stmm0 : return fpu_stmm0;<br></blockquote><blockquote type="cite">+ case gdb_stmm1 : return fpu_stmm1;<br></blockquote><blockquote type="cite">+ case gdb_stmm2 : return fpu_stmm2;<br></blockquote><blockquote type="cite">+ case gdb_stmm3 : return fpu_stmm3;<br></blockquote><blockquote type="cite">+ case gdb_stmm4 : return fpu_stmm4;<br></blockquote><blockquote type="cite">+ case gdb_stmm5 : return fpu_stmm5;<br></blockquote><blockquote type="cite">+ case gdb_stmm6 : return fpu_stmm6;<br></blockquote><blockquote type="cite">+ case gdb_stmm7 : return fpu_stmm7;<br></blockquote><blockquote type="cite">+ case gdb_fcw : return fpu_fcw;<br></blockquote><blockquote type="cite">+ case gdb_fsw : return fpu_fsw;<br></blockquote><blockquote type="cite">+ case gdb_ftw : return fpu_ftw;<br></blockquote><blockquote type="cite">+ case gdb_fpu_cs : return fpu_cs;<br></blockquote><blockquote type="cite">+ case gdb_ip : return fpu_ip;<br></blockquote><blockquote type="cite">+ case gdb_fpu_ds : return fpu_fos;<br></blockquote><blockquote type="cite">+ case gdb_dp : return fpu_foo;<br></blockquote><blockquote type="cite">+ case gdb_fop : return fpu_fop;<br></blockquote><blockquote type="cite">+ case gdb_xmm0 : return fpu_xmm0;<br></blockquote><blockquote type="cite">+ case gdb_xmm1 : return fpu_xmm1;<br></blockquote><blockquote type="cite">+ case gdb_xmm2 : return fpu_xmm2;<br></blockquote><blockquote type="cite">+ case gdb_xmm3 : return fpu_xmm3;<br></blockquote><blockquote type="cite">+ case gdb_xmm4 : return fpu_xmm4;<br></blockquote><blockquote type="cite">+ case gdb_xmm5 : return fpu_xmm5;<br></blockquote><blockquote type="cite">+ case gdb_xmm6 : return fpu_xmm6;<br></blockquote><blockquote type="cite">+ case gdb_xmm7 : return fpu_xmm7;<br></blockquote><blockquote type="cite">+ case gdb_mxcsr : return fpu_mxcsr;<br></blockquote><blockquote type="cite">+ default:<br></blockquote><blockquote type="cite">+ return LLDB_INVALID_REGNUM;<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+ else if (kind == eRegisterKindLLDB)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ return num;<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ return LLDB_INVALID_REGNUM;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::HardwareSingleStep(bool enable)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ enum { TRACE_BIT = 0x100 };<br></blockquote><blockquote type="cite">+ uint64_t eflags;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ if ((eflags = ReadRegisterAsUnsigned(gpr_eflags, -1UL)) == -1UL)<br></blockquote><blockquote type="cite">+ return false;<br></blockquote><blockquote type="cite">+ <br></blockquote><blockquote type="cite">+ if (enable)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ if (eflags & TRACE_BIT)<br></blockquote><blockquote type="cite">+ return true;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ eflags |= TRACE_BIT;<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+ else<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ if (!(eflags & TRACE_BIT))<br></blockquote><blockquote type="cite">+ return false;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ eflags &= ~TRACE_BIT;<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ return WriteRegisterFromUnsigned(gpr_eflags, eflags);<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::ReadGPR()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ ProcessMonitor &monitor = GetMonitor();<br></blockquote><blockquote type="cite">+ return monitor.ReadGPR(&user.regs);<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+bool<br></blockquote><blockquote type="cite">+RegisterContextLinux_i386::ReadFPR()<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+ ProcessMonitor &monitor = GetMonitor();<br></blockquote><blockquote type="cite">+ return monitor.ReadFPR(&user.i387);<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">diff --git a/source/Plugins/Process/Linux/RegisterContextLinux_i386.h b/source/Plugins/Process/Linux/RegisterContextLinux_i386.h<br></blockquote><blockquote type="cite">new file mode 100644<br></blockquote><blockquote type="cite">index 0000000..30b3d70<br></blockquote><blockquote type="cite">--- /dev/null<br></blockquote><blockquote type="cite">+++ b/source/Plugins/Process/Linux/RegisterContextLinux_i386.h<br></blockquote><blockquote type="cite">@@ -0,0 +1,148 @@<br></blockquote><blockquote type="cite">+//===-- RegisterContextLinux_i386.h ------------------------------*- C++ -*-===//<br></blockquote><blockquote type="cite">+//<br></blockquote><blockquote type="cite">+// The LLVM Compiler Infrastructure<br></blockquote><blockquote type="cite">+//<br></blockquote><blockquote type="cite">+// This file is distributed under the University of Illinois Open Source<br></blockquote><blockquote type="cite">+// License. See LICENSE.TXT for details.<br></blockquote><blockquote type="cite">+//<br></blockquote><blockquote type="cite">+//===----------------------------------------------------------------------===//<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#ifndef liblldb_RegisterContextLinux_i386_h_<br></blockquote><blockquote type="cite">+#define liblldb_RegisterContextLinux_i386_h_<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+// C Includes<br></blockquote><blockquote type="cite">+// C++ Includes<br></blockquote><blockquote type="cite">+// Other libraries and framework includes<br></blockquote><blockquote type="cite">+// Project includes<br></blockquote><blockquote type="cite">+#include "RegisterContextLinux.h"<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+class RegisterContextLinux_i386 : public RegisterContextLinux<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+public:<br></blockquote><blockquote type="cite">+ RegisterContextLinux_i386(lldb_private::Thread &thread,<br></blockquote><blockquote type="cite">+ uint32_t concreate_frame_idx);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ ~RegisterContextLinux_i386();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ void<br></blockquote><blockquote type="cite">+ Invalidate();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ void<br></blockquote><blockquote type="cite">+ InvalidateAllRegisters();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ size_t<br></blockquote><blockquote type="cite">+ GetRegisterCount();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ const lldb::RegisterInfo *<br></blockquote><blockquote type="cite">+ GetRegisterInfoAtIndex(uint32_t reg);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ size_t<br></blockquote><blockquote type="cite">+ GetRegisterSetCount();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ const lldb::RegisterSet *<br></blockquote><blockquote type="cite">+ GetRegisterSet(uint32_t set);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ ReadRegisterValue(uint32_t reg, lldb_private::Scalar &value);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ ReadRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ ReadAllRegisterValues(lldb::DataBufferSP &data_sp);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ WriteRegisterValue(uint32_t reg, const lldb_private::Scalar &value);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ WriteRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data,<br></blockquote><blockquote type="cite">+ uint32_t data_offset = 0);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ WriteAllRegisterValues(const lldb::DataBufferSP &data_sp);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ uint32_t<br></blockquote><blockquote type="cite">+ ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ HardwareSingleStep(bool enable);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool<br></blockquote><blockquote type="cite">+ UpdateAfterBreakpoint();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ struct GPR<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ uint32_t ebx;<br></blockquote><blockquote type="cite">+ uint32_t ecx;<br></blockquote><blockquote type="cite">+ uint32_t edx;<br></blockquote><blockquote type="cite">+ uint32_t esi;<br></blockquote><blockquote type="cite">+ uint32_t edi;<br></blockquote><blockquote type="cite">+ uint32_t ebp;<br></blockquote><blockquote type="cite">+ uint32_t eax;<br></blockquote><blockquote type="cite">+ uint32_t ds;<br></blockquote><blockquote type="cite">+ uint32_t es;<br></blockquote><blockquote type="cite">+ uint32_t fs;<br></blockquote><blockquote type="cite">+ uint32_t gs;<br></blockquote><blockquote type="cite">+ uint32_t orig_ax;<br></blockquote><blockquote type="cite">+ uint32_t eip;<br></blockquote><blockquote type="cite">+ uint32_t cs;<br></blockquote><blockquote type="cite">+ uint32_t eflags;<br></blockquote><blockquote type="cite">+ uint32_t esp;<br></blockquote><blockquote type="cite">+ uint32_t ss;<br></blockquote><blockquote type="cite">+ };<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ struct MMSReg<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ uint8_t bytes[8];<br></blockquote><blockquote type="cite">+ };<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ struct XMMReg<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ uint8_t bytes[16];<br></blockquote><blockquote type="cite">+ };<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ struct FPU<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ uint16_t fcw;<br></blockquote><blockquote type="cite">+ uint16_t fsw;<br></blockquote><blockquote type="cite">+ uint16_t ftw;<br></blockquote><blockquote type="cite">+ uint16_t fop;<br></blockquote><blockquote type="cite">+ uint32_t ip;<br></blockquote><blockquote type="cite">+ uint32_t cs;<br></blockquote><blockquote type="cite">+ uint32_t foo;<br></blockquote><blockquote type="cite">+ uint32_t fos;<br></blockquote><blockquote type="cite">+ uint32_t mxcsr;<br></blockquote><blockquote type="cite">+ uint32_t reserved;<br></blockquote><blockquote type="cite">+ MMSReg stmm[8];<br></blockquote><blockquote type="cite">+ XMMReg xmm[8];<br></blockquote><blockquote type="cite">+ uint32_t pad[56];<br></blockquote><blockquote type="cite">+ };<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ struct UserArea<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ GPR regs; // General purpose registers.<br></blockquote><blockquote type="cite">+ int32_t fpvalid; // True if FPU is being used.<br></blockquote><blockquote type="cite">+ FPU i387; // FPU registers.<br></blockquote><blockquote type="cite">+ uint32_t tsize; // Text segment size.<br></blockquote><blockquote type="cite">+ uint32_t dsize; // Data segment size.<br></blockquote><blockquote type="cite">+ uint32_t ssize; // Stack segment size.<br></blockquote><blockquote type="cite">+ uint32_t start_code; // VM address of text.<br></blockquote><blockquote type="cite">+ uint32_t start_stack; // VM address of stack bottom (top in rsp).<br></blockquote><blockquote type="cite">+ int32_t signal; // Signal causing core dump.<br></blockquote><blockquote type="cite">+ int32_t reserved; // Unused.<br></blockquote><blockquote type="cite">+ uint32_t ar0; // Location of GPR's.<br></blockquote><blockquote type="cite">+ FPU* fpstate; // Location of FPR's.<br></blockquote><blockquote type="cite">+ uint32_t magic; // Identifier for core dumps.<br></blockquote><blockquote type="cite">+ char u_comm[32]; // Command causing core dump.<br></blockquote><blockquote type="cite">+ uint32_t u_debugreg[8]; // Debug registers (DR0 - DR7).<br></blockquote><blockquote type="cite">+ };<br></blockquote><blockquote type="cite">+private:<br></blockquote><blockquote type="cite">+ UserArea user;<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ ProcessMonitor &GetMonitor();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ bool ReadGPR();<br></blockquote><blockquote type="cite">+ bool ReadFPR();<br></blockquote><blockquote type="cite">+};<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+#endif // #ifndef liblldb_RegisterContextLinux_i386_h_<br></blockquote><br><br>-- <br>steve<br><br></div></blockquote></div><br></body></html>