<div dir="ltr">Kudos to Zachary Turner, who provided most of this patch.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 30, 2014 at 4:51 PM, Todd Fiala <span dir="ltr"><<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: tfiala<br>
Date: Mon Jun 30 18:51:35 2014<br>
New Revision: 212074<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=212074&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=212074&view=rev</a><br>
Log:<br>
Fixup Windows build breaks for the llgs upstream.<br>
<br>
Also moves NativeRegisterContextLinux* files into the Linux directory.<br>
These, like NativeProcessLinux, should only be built on Linux or a cross<br>
compiler with proper headers.<br>
<br>
Added:<br>
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp<br>
- copied unchanged from r212072, lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h<br>
- copied unchanged from r212072, lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h<br>
Removed:<br>
lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.cpp<br>
lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h<br>
Modified:<br>
lldb/trunk/lldb.xcodeproj/project.pbxproj<br>
lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt<br>
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp<br>
lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt<br>
lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp<br>
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp<br>
lldb/trunk/source/Target/ProcessLaunchInfo.cpp<br>
<br>
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=212074&r1=212073&r2=212074&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=212074&r1=212073&r2=212074&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)<br>
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jun 30 18:51:35 2014<br>
@@ -72,7 +72,6 @@<br>
233B009919610B1F0090E598 /* ProcessLinux.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 233B009119610B1F0090E598 /* ProcessLinux.h */; };<br>
233B009A19610B1F0090E598 /* ProcessMonitor.cpp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 233B009219610B1F0090E598 /* ProcessMonitor.cpp */; };<br>
233B009B19610B1F0090E598 /* ProcessMonitor.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 233B009319610B1F0090E598 /* ProcessMonitor.h */; };<br>
- 239F5B2F19296DC500083917 /* NativeRegisterContextLinux_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 239F5B2E19296DC500083917 /* NativeRegisterContextLinux_x86_64.h */; };<br>
23EDE3321926843600F6A132 /* NativeRegisterContext.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 23EDE3311926843600F6A132 /* NativeRegisterContext.h */; };<br>
23EDE33319269E7C00F6A132 /* NativeRegisterContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 23EDE3301926839700F6A132 /* NativeRegisterContext.cpp */; };<br>
23EFE389193D1ABC00E54E54 /* SBTypeEnumMember.h in Headers */ = {isa = PBXBuildFile; fileRef = 23EFE388193D1ABC00E54E54 /* SBTypeEnumMember.h */; settings = {ATTRIBUTES = (Public, ); }; };<br>
@@ -934,9 +933,9 @@<br>
233B009D19610D6B0090E598 /* Host.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Host.cpp; sourceTree = "<group>"; };<br>
233B00A1196113730090E598 /* ProcFileReader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ProcFileReader.cpp; sourceTree = "<group>"; };<br>
233B00A2196113730090E598 /* ProcFileReader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProcFileReader.h; sourceTree = "<group>"; };<br>
+ 233B00A919622F3F0090E598 /* NativeRegisterContextLinux_x86_64.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NativeRegisterContextLinux_x86_64.cpp; sourceTree = "<group>"; };<br>
+ 233B00AA19622F3F0090E598 /* NativeRegisterContextLinux_x86_64.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NativeRegisterContextLinux_x86_64.h; sourceTree = "<group>"; };<br>
2360092C193FB21500189DB1 /* MemoryRegionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MemoryRegionInfo.h; path = include/lldb/Target/MemoryRegionInfo.h; sourceTree = "<group>"; };<br>
- 239F5B2E19296DC500083917 /* NativeRegisterContextLinux_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NativeRegisterContextLinux_x86_64.h; path = Utility/NativeRegisterContextLinux_x86_64.h; sourceTree = "<group>"; };<br>
- 239F5B3019298D4600083917 /* NativeRegisterContextLinux_x86_64.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = NativeRegisterContextLinux_x86_64.cpp; path = Utility/NativeRegisterContextLinux_x86_64.cpp; sourceTree = "<group>"; };<br>
23EDE3301926839700F6A132 /* NativeRegisterContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = NativeRegisterContext.cpp; path = source/Target/NativeRegisterContext.cpp; sourceTree = "<group>"; };<br>
23EDE3311926843600F6A132 /* NativeRegisterContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NativeRegisterContext.h; path = include/lldb/Target/NativeRegisterContext.h; sourceTree = "<group>"; };<br>
23EDE3371926AAD500F6A132 /* RegisterInfoInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RegisterInfoInterface.h; path = Utility/RegisterInfoInterface.h; sourceTree = "<group>"; };<br>
@@ -2222,6 +2221,8 @@<br>
233B008F19610B1F0090E598 /* LinuxThread.h */,<br>
232CB62B19213AC200EF39FC /* NativeProcessLinux.cpp */,<br>
232CB62C19213AC200EF39FC /* NativeProcessLinux.h */,<br>
+ 233B00AA19622F3F0090E598 /* NativeRegisterContextLinux_x86_64.h */,<br>
+ 233B00A919622F3F0090E598 /* NativeRegisterContextLinux_x86_64.cpp */,<br>
232CB62D19213AC200EF39FC /* NativeThreadLinux.cpp */,<br>
232CB62E19213AC200EF39FC /* NativeThreadLinux.h */,<br>
233B009019610B1F0090E598 /* ProcessLinux.cpp */,<br>
@@ -2918,6 +2919,7 @@<br>
B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */,<br>
23059A0519532B96007B8189 /* LinuxSignals.cpp */,<br>
23059A0619532B96007B8189 /* LinuxSignals.h */,<br>
+ 23173F8B192BA93F005C708F /* lldb-x86-register-enums.h */,<br>
26474C9E18D0CAEC0073DEBA /* RegisterContext_mips64.h */,<br>
26474C9F18D0CAEC0073DEBA /* RegisterContext_x86.h */,<br>
26957D9213D381C900670048 /* RegisterContextDarwin_arm.cpp */,<br>
@@ -2963,6 +2965,7 @@<br>
26474CC818D0CB5B0073DEBA /* RegisterContextPOSIX.h */,<br>
26CA979F172B1FD5005DC71B /* RegisterContextThreadMemory.cpp */,<br>
26CA97A0172B1FD5005DC71B /* RegisterContextThreadMemory.h */,<br>
+ 23EDE3371926AAD500F6A132 /* RegisterInfoInterface.h */,<br>
26474CD018D0CB700073DEBA /* RegisterInfos_i386.h */,<br>
26474CD118D0CB710073DEBA /* RegisterInfos_mips64.h */,<br>
26474CD218D0CB710073DEBA /* RegisterInfos_x86_64.h */,<br>
@@ -2974,10 +2977,6 @@<br>
AF68D3301255A110002FF25B /* UnwindLLDB.h */,<br>
26E3EEE411A9901300FBADB6 /* UnwindMacOSXFrameBackchain.h */,<br>
26E3EEE311A9901300FBADB6 /* UnwindMacOSXFrameBackchain.cpp */,<br>
- 23EDE3371926AAD500F6A132 /* RegisterInfoInterface.h */,<br>
- 239F5B2E19296DC500083917 /* NativeRegisterContextLinux_x86_64.h */,<br>
- 239F5B3019298D4600083917 /* NativeRegisterContextLinux_x86_64.cpp */,<br>
- 23173F8B192BA93F005C708F /* lldb-x86-register-enums.h */,<br>
);<br>
name = Utility;<br>
sourceTree = "<group>";<br>
@@ -4202,7 +4201,6 @@<br>
260CC63A15D04377002BF2E0 /* OptionValueUUID.h in Headers */,<br>
260A248E15D06C50009981B0 /* OptionValues.h in Headers */,<br>
AF061F88182C97ED00B6A19C /* RegisterContextHistory.h in Headers */,<br>
- 239F5B2F19296DC500083917 /* NativeRegisterContextLinux_x86_64.h in Headers */,<br>
26DAED6015D327A200E15819 /* OptionValuePathMappings.h in Headers */,<br>
26ACEC2815E077AE00E94760 /* Property.h in Headers */,<br>
26491E3B15E1DB8600CBFFC2 /* OptionValueRegex.h in Headers */,<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt?rev=212074&r1=212073&r2=212074&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt?rev=212074&r1=212073&r2=212074&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt (original)<br>
+++ lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt Mon Jun 30 18:51:35 2014<br>
@@ -6,6 +6,7 @@ include_directories(../Utility)<br>
<br>
add_lldb_library(lldbPluginProcessLinux<br>
NativeProcessLinux.cpp<br>
+ NativeRegisterContextLinux_x86_64.cpp<br>
NativeThreadLinux.cpp<br>
ProcessLinux.cpp<br>
ProcessMonitor.cpp<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=212074&r1=212073&r2=212074&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=212074&r1=212073&r2=212074&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Mon Jun 30 18:51:35 2014<br>
@@ -12,12 +12,13 @@<br>
#include <signal.h><br>
<br>
#include "NativeProcessLinux.h"<br>
+#include "NativeRegisterContextLinux_x86_64.h"<br>
+<br>
#include "lldb/Core/Log.h"<br>
#include "lldb/Core/State.h"<br>
#include "lldb/Host/Host.h"<br>
#include "lldb/lldb-enumerations.h"<br>
#include "lldb/lldb-private-log.h"<br>
-#include "Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h"<br>
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"<br>
#include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"<br>
#include "Plugins/Process/Utility/RegisterInfoInterface.h"<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt?rev=212074&r1=212073&r2=212074&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt?rev=212074&r1=212073&r2=212074&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt (original)<br>
+++ lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt Mon Jun 30 18:51:35 2014<br>
@@ -9,7 +9,6 @@ add_lldb_library(lldbPluginProcessUtilit<br>
HistoryUnwind.cpp<br>
InferiorCallPOSIX.cpp<br>
LinuxSignals.cpp<br>
- NativeRegisterContextLinux_x86_64.cpp<br>
RegisterContextDarwin_arm.cpp<br>
RegisterContextDarwin_arm64.cpp<br>
RegisterContextDarwin_i386.cpp<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp?rev=212074&r1=212073&r2=212074&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp?rev=212074&r1=212073&r2=212074&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/Utility/LinuxSignals.cpp Mon Jun 30 18:51:35 2014<br>
@@ -7,9 +7,6 @@<br>
//<br>
//===----------------------------------------------------------------------===//<br>
<br>
-// C Includes<br>
-#include <signal.h><br>
-<br>
// C++ Includes<br>
// Other libraries and framework includes<br>
// Project includes<br>
@@ -28,52 +25,38 @@ LinuxSignals::Reset()<br>
{<br>
m_signals.clear();<br>
<br>
- // FIXME we now need *Signals classes on systems that are different OSes (e.g. LinuxSignals<br>
- // needed on MacOSX to debug Linux from MacOSX, and similar scenarios, used by ProcessGDBRemote). These must be defined<br>
- // not based on OS includes and defines.<br>
-<br>
-#define ADDSIGNAL(S, SUPPRESS, STOP, NOTIFY, DESCRIPTION) \<br>
- AddSignal(SIG ## S, "SIG" #S, #S, SUPPRESS, STOP, NOTIFY, DESCRIPTION)<br>
-<br>
- ADDSIGNAL(HUP, false, true, true, "hangup");<br>
- ADDSIGNAL(INT, true, true, true, "interrupt");<br>
- ADDSIGNAL(QUIT, false, true, true, "quit");<br>
- ADDSIGNAL(ILL, false, true, true, "illegal instruction");<br>
- ADDSIGNAL(TRAP, true, true, true, "trace trap (not reset when caught)");<br>
- ADDSIGNAL(ABRT, false, true, true, "abort");<br>
- ADDSIGNAL(IOT, false, true, true, "abort");<br>
- ADDSIGNAL(BUS, false, true, true, "bus error");<br>
- ADDSIGNAL(FPE, false, true, true, "floating point exception");<br>
- ADDSIGNAL(KILL, false, true, true, "kill");<br>
- ADDSIGNAL(USR1, false, true, true, "user defined signal 1");<br>
- ADDSIGNAL(SEGV, false, true, true, "segmentation violation");<br>
- ADDSIGNAL(USR2, false, true, true, "user defined signal 2");<br>
- ADDSIGNAL(PIPE, false, true, true, "write to pipe with reading end closed");<br>
- ADDSIGNAL(ALRM, false, false, true, "alarm");<br>
- ADDSIGNAL(TERM, false, true, true, "termination requested");<br>
-#ifdef SIGSTKFLT<br>
- ADDSIGNAL(STKFLT, false, true, true, "stack fault");<br>
-#endif<br>
- ADDSIGNAL(CHLD, false, false, true, "child process exit");<br>
- ADDSIGNAL(CONT, false, true, true, "process continue");<br>
- ADDSIGNAL(STOP, true, true, true, "process stop");<br>
- ADDSIGNAL(TSTP, false, true, true, "tty stop");<br>
- ADDSIGNAL(TTIN, false, true, true, "background tty read");<br>
- ADDSIGNAL(TTOU, false, true, true, "background tty write");<br>
- ADDSIGNAL(URG, false, true, true, "urgent data on socket");<br>
- ADDSIGNAL(XCPU, false, true, true, "CPU resource exceeded");<br>
- ADDSIGNAL(XFSZ, false, true, true, "file size limit exceeded");<br>
- ADDSIGNAL(VTALRM, false, true, true, "virtual alarm");<br>
- ADDSIGNAL(PROF, false, true, true, "profiling alarm");<br>
- ADDSIGNAL(WINCH, false, true, true, "window size change");<br>
-#ifdef SIGPOLL<br>
- ADDSIGNAL(POLL, false, true, true, "pollable event");<br>
-#endif<br>
- ADDSIGNAL(IO, false, true, true, "input/output ready");<br>
-#ifdef SIGPWR<br>
- ADDSIGNAL(PWR, false, true, true, "power failure");<br>
-#endif<br>
- ADDSIGNAL(SYS, false, true, true, "invalid system call");<br>
-<br>
-#undef ADDSIGNAL<br>
+ AddSignal (1, "SIGHUP", "HUP", false, true , true , "hangup");<br>
+ AddSignal (2, "SIGINT", "INT", true , true , true , "interrupt");<br>
+ AddSignal (3, "SIGQUIT", "QUIT", false, true , true , "quit");<br>
+ AddSignal (4, "SIGILL", "ILL", false, true , true , "illegal instruction");<br>
+ AddSignal (5, "SIGTRAP", "TRAP", true , true , true , "trace trap (not reset when caught)");<br>
+ AddSignal (6, "SIGABRT", "ABRT", false, true , true , "abort()");<br>
+ AddSignal (6, "SIGIOT", "IOT", false, true , true , "IOT trap");<br>
+ AddSignal (7, "SIGBUS", "BUS", false, true , true , "bus error");<br>
+ AddSignal (8, "SIGFPE", "FPE", false, true , true , "floating point exception");<br>
+ AddSignal (9, "SIGKILL", "KILL", false, true , true , "kill");<br>
+ AddSignal (10, "SIGUSR1", "USR1", false, true , true , "user defined signal 1");<br>
+ AddSignal (11, "SIGSEGV", "SEGV", false, true , true , "segmentation violation");<br>
+ AddSignal (12, "SIGUSR2", "USR2", false, true , true , "user defined signal 2");<br>
+ AddSignal (13, "SIGPIPE", "PIPE", false, true , true , "write to pipe with reading end closed");<br>
+ AddSignal (14, "SIGALRM", "ALRM", false, false, false, "alarm");<br>
+ AddSignal (15, "SIGTERM", "TERM", false, true , true , "termination requested");<br>
+ AddSignal (16, "SIGSTKFLT", "STKFLT", false, true , true , "stack fault");<br>
+ AddSignal (16, "SIGCLD", "CLD", false, false, true , "same as SIGCHLD");<br>
+ AddSignal (17, "SIGCHLD", "CHLD", false, false, true , "child status has changed");<br>
+ AddSignal (18, "SIGCONT", "CONT", false, true , true , "process continue");<br>
+ AddSignal (19, "SIGSTOP", "STOP", true , true , true , "process stop");<br>
+ AddSignal (20, "SIGTSTP", "TSTP", false, true , true , "tty stop");<br>
+ AddSignal (21, "SIGTTIN", "TTIN", false, true , true , "background tty read");<br>
+ AddSignal (22, "SIGTTOU", "TTOU", false, true , true , "background tty write");<br>
+ AddSignal (23, "SIGURG", "URG", false, true , true , "urgent data on socket");<br>
+ AddSignal (24, "SIGXCPU", "XCPU", false, true , true , "CPU resource exceeded");<br>
+ AddSignal (25, "SIGXFSZ", "XFSZ", false, true , true , "file size limit exceeded");<br>
+ AddSignal (26, "SIGVTALRM", "VTALRM", false, true , true , "virtual time alarm");<br>
+ AddSignal (27, "SIGPROF", "PROF", false, true , true , "profiling time alarm");<br>
+ AddSignal (28, "SIGWINCH", "WINCH", false, true , true , "window size changes");<br>
+ AddSignal (29, "SIGPOLL", "POLL", false, true , true , "pollable event");<br>
+ AddSignal (29, "SIGIO", "IO", false, true , true , "input/output ready");<br>
+ AddSignal (30, "SIGPWR", "PWR", false, true , true , "power failure");<br>
+ AddSignal (31, "SIGSYS", "SYS", false, true , true , "invalid system call");<br>
}<br>
<br>
Removed: lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.cpp?rev=212073&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.cpp?rev=212073&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.cpp (removed)<br>
@@ -1,1040 +0,0 @@<br>
-//===-- NativeRegisterContextLinux_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 "NativeRegisterContextLinux_x86_64.h"<br>
-<br>
-#include "lldb/lldb-private-forward.h"<br>
-#include "lldb/Core/DataBufferHeap.h"<br>
-#include "lldb/Core/Error.h"<br>
-#include "lldb/Core/RegisterValue.h"<br>
-#include "Host/common/NativeProcessProtocol.h"<br>
-#include "Host/common/NativeThreadProtocol.h"<br>
-#include "Plugins/Process/Linux/NativeProcessLinux.h"<br>
-<br>
-using namespace lldb_private;<br>
-<br>
-// ----------------------------------------------------------------------------<br>
-// Private namespace.<br>
-// ----------------------------------------------------------------------------<br>
-<br>
-namespace<br>
-{<br>
- // x86 32-bit general purpose registers.<br>
- const uint32_t<br>
- g_gpr_regnums_i386[] =<br>
- {<br>
- gpr_eax_i386,<br>
- gpr_ebx_i386,<br>
- gpr_ecx_i386,<br>
- gpr_edx_i386,<br>
- gpr_edi_i386,<br>
- gpr_esi_i386,<br>
- gpr_ebp_i386,<br>
- gpr_esp_i386,<br>
- gpr_eip_i386,<br>
- gpr_eflags_i386,<br>
- gpr_cs_i386,<br>
- gpr_fs_i386,<br>
- gpr_gs_i386,<br>
- gpr_ss_i386,<br>
- gpr_ds_i386,<br>
- gpr_es_i386,<br>
- gpr_ax_i386,<br>
- gpr_bx_i386,<br>
- gpr_cx_i386,<br>
- gpr_dx_i386,<br>
- gpr_di_i386,<br>
- gpr_si_i386,<br>
- gpr_bp_i386,<br>
- gpr_sp_i386,<br>
- gpr_ah_i386,<br>
- gpr_bh_i386,<br>
- gpr_ch_i386,<br>
- gpr_dh_i386,<br>
- gpr_al_i386,<br>
- gpr_bl_i386,<br>
- gpr_cl_i386,<br>
- gpr_dl_i386,<br>
- LLDB_INVALID_REGNUM // register sets need to end with this flag<br>
- };<br>
- static_assert((sizeof(g_gpr_regnums_i386) / sizeof(g_gpr_regnums_i386[0])) - 1 == k_num_gpr_registers_i386,<br>
- "g_gpr_regnums_i386 has wrong number of register infos");<br>
-<br>
- // x86 32-bit floating point registers.<br>
- const uint32_t<br>
- g_fpu_regnums_i386[] =<br>
- {<br>
- fpu_fctrl_i386,<br>
- fpu_fstat_i386,<br>
- fpu_ftag_i386,<br>
- fpu_fop_i386,<br>
- fpu_fiseg_i386,<br>
- fpu_fioff_i386,<br>
- fpu_foseg_i386,<br>
- fpu_fooff_i386,<br>
- fpu_mxcsr_i386,<br>
- fpu_mxcsrmask_i386,<br>
- fpu_st0_i386,<br>
- fpu_st1_i386,<br>
- fpu_st2_i386,<br>
- fpu_st3_i386,<br>
- fpu_st4_i386,<br>
- fpu_st5_i386,<br>
- fpu_st6_i386,<br>
- fpu_st7_i386,<br>
- fpu_mm0_i386,<br>
- fpu_mm1_i386,<br>
- fpu_mm2_i386,<br>
- fpu_mm3_i386,<br>
- fpu_mm4_i386,<br>
- fpu_mm5_i386,<br>
- fpu_mm6_i386,<br>
- fpu_mm7_i386,<br>
- fpu_xmm0_i386,<br>
- fpu_xmm1_i386,<br>
- fpu_xmm2_i386,<br>
- fpu_xmm3_i386,<br>
- fpu_xmm4_i386,<br>
- fpu_xmm5_i386,<br>
- fpu_xmm6_i386,<br>
- fpu_xmm7_i386,<br>
- LLDB_INVALID_REGNUM // register sets need to end with this flag<br>
- };<br>
- static_assert((sizeof(g_fpu_regnums_i386) / sizeof(g_fpu_regnums_i386[0])) - 1 == k_num_fpr_registers_i386,<br>
- "g_fpu_regnums_i386 has wrong number of register infos");<br>
-<br>
- // x86 32-bit AVX registers.<br>
- const uint32_t<br>
- g_avx_regnums_i386[] =<br>
- {<br>
- fpu_ymm0_i386,<br>
- fpu_ymm1_i386,<br>
- fpu_ymm2_i386,<br>
- fpu_ymm3_i386,<br>
- fpu_ymm4_i386,<br>
- fpu_ymm5_i386,<br>
- fpu_ymm6_i386,<br>
- fpu_ymm7_i386,<br>
- LLDB_INVALID_REGNUM // register sets need to end with this flag<br>
- };<br>
- static_assert((sizeof(g_avx_regnums_i386) / sizeof(g_avx_regnums_i386[0])) - 1 == k_num_avx_registers_i386,<br>
- " g_avx_regnums_i386 has wrong number of register infos");<br>
-<br>
- // x86 64-bit general purpose registers.<br>
- static const<br>
- uint32_t g_gpr_regnums_x86_64[] =<br>
- {<br>
- gpr_rax_x86_64,<br>
- gpr_rbx_x86_64,<br>
- gpr_rcx_x86_64,<br>
- gpr_rdx_x86_64,<br>
- gpr_rdi_x86_64,<br>
- gpr_rsi_x86_64,<br>
- gpr_rbp_x86_64,<br>
- gpr_rsp_x86_64,<br>
- gpr_r8_x86_64,<br>
- gpr_r9_x86_64,<br>
- gpr_r10_x86_64,<br>
- gpr_r11_x86_64,<br>
- gpr_r12_x86_64,<br>
- gpr_r13_x86_64,<br>
- gpr_r14_x86_64,<br>
- gpr_r15_x86_64,<br>
- gpr_rip_x86_64,<br>
- gpr_rflags_x86_64,<br>
- gpr_cs_x86_64,<br>
- gpr_fs_x86_64,<br>
- gpr_gs_x86_64,<br>
- gpr_ss_x86_64,<br>
- gpr_ds_x86_64,<br>
- gpr_es_x86_64,<br>
- gpr_eax_x86_64,<br>
- gpr_ebx_x86_64,<br>
- gpr_ecx_x86_64,<br>
- gpr_edx_x86_64,<br>
- gpr_edi_x86_64,<br>
- gpr_esi_x86_64,<br>
- gpr_ebp_x86_64,<br>
- gpr_esp_x86_64,<br>
- gpr_r8d_x86_64, // Low 32 bits or r8<br>
- gpr_r9d_x86_64, // Low 32 bits or r9<br>
- gpr_r10d_x86_64, // Low 32 bits or r10<br>
- gpr_r11d_x86_64, // Low 32 bits or r11<br>
- gpr_r12d_x86_64, // Low 32 bits or r12<br>
- gpr_r13d_x86_64, // Low 32 bits or r13<br>
- gpr_r14d_x86_64, // Low 32 bits or r14<br>
- gpr_r15d_x86_64, // Low 32 bits or r15<br>
- gpr_ax_x86_64,<br>
- gpr_bx_x86_64,<br>
- gpr_cx_x86_64,<br>
- gpr_dx_x86_64,<br>
- gpr_di_x86_64,<br>
- gpr_si_x86_64,<br>
- gpr_bp_x86_64,<br>
- gpr_sp_x86_64,<br>
- gpr_r8w_x86_64, // Low 16 bits or r8<br>
- gpr_r9w_x86_64, // Low 16 bits or r9<br>
- gpr_r10w_x86_64, // Low 16 bits or r10<br>
- gpr_r11w_x86_64, // Low 16 bits or r11<br>
- gpr_r12w_x86_64, // Low 16 bits or r12<br>
- gpr_r13w_x86_64, // Low 16 bits or r13<br>
- gpr_r14w_x86_64, // Low 16 bits or r14<br>
- gpr_r15w_x86_64, // Low 16 bits or r15<br>
- gpr_ah_x86_64,<br>
- gpr_bh_x86_64,<br>
- gpr_ch_x86_64,<br>
- gpr_dh_x86_64,<br>
- gpr_al_x86_64,<br>
- gpr_bl_x86_64,<br>
- gpr_cl_x86_64,<br>
- gpr_dl_x86_64,<br>
- gpr_dil_x86_64,<br>
- gpr_sil_x86_64,<br>
- gpr_bpl_x86_64,<br>
- gpr_spl_x86_64,<br>
- gpr_r8l_x86_64, // Low 8 bits or r8<br>
- gpr_r9l_x86_64, // Low 8 bits or r9<br>
- gpr_r10l_x86_64, // Low 8 bits or r10<br>
- gpr_r11l_x86_64, // Low 8 bits or r11<br>
- gpr_r12l_x86_64, // Low 8 bits or r12<br>
- gpr_r13l_x86_64, // Low 8 bits or r13<br>
- gpr_r14l_x86_64, // Low 8 bits or r14<br>
- gpr_r15l_x86_64, // Low 8 bits or r15<br>
- LLDB_INVALID_REGNUM // register sets need to end with this flag<br>
- };<br>
- static_assert((sizeof(g_gpr_regnums_x86_64) / sizeof(g_gpr_regnums_x86_64[0])) - 1 == k_num_gpr_registers_x86_64,<br>
- "g_gpr_regnums_x86_64 has wrong number of register infos");<br>
-<br>
- // x86 64-bit floating point registers.<br>
- static const uint32_t<br>
- g_fpu_regnums_x86_64[] =<br>
- {<br>
- fpu_fctrl_x86_64,<br>
- fpu_fstat_x86_64,<br>
- fpu_ftag_x86_64,<br>
- fpu_fop_x86_64,<br>
- fpu_fiseg_x86_64,<br>
- fpu_fioff_x86_64,<br>
- fpu_foseg_x86_64,<br>
- fpu_fooff_x86_64,<br>
- fpu_mxcsr_x86_64,<br>
- fpu_mxcsrmask_x86_64,<br>
- fpu_st0_x86_64,<br>
- fpu_st1_x86_64,<br>
- fpu_st2_x86_64,<br>
- fpu_st3_x86_64,<br>
- fpu_st4_x86_64,<br>
- fpu_st5_x86_64,<br>
- fpu_st6_x86_64,<br>
- fpu_st7_x86_64,<br>
- fpu_mm0_x86_64,<br>
- fpu_mm1_x86_64,<br>
- fpu_mm2_x86_64,<br>
- fpu_mm3_x86_64,<br>
- fpu_mm4_x86_64,<br>
- fpu_mm5_x86_64,<br>
- fpu_mm6_x86_64,<br>
- fpu_mm7_x86_64,<br>
- fpu_xmm0_x86_64,<br>
- fpu_xmm1_x86_64,<br>
- fpu_xmm2_x86_64,<br>
- fpu_xmm3_x86_64,<br>
- fpu_xmm4_x86_64,<br>
- fpu_xmm5_x86_64,<br>
- fpu_xmm6_x86_64,<br>
- fpu_xmm7_x86_64,<br>
- fpu_xmm8_x86_64,<br>
- fpu_xmm9_x86_64,<br>
- fpu_xmm10_x86_64,<br>
- fpu_xmm11_x86_64,<br>
- fpu_xmm12_x86_64,<br>
- fpu_xmm13_x86_64,<br>
- fpu_xmm14_x86_64,<br>
- fpu_xmm15_x86_64,<br>
- LLDB_INVALID_REGNUM // register sets need to end with this flag<br>
- };<br>
- static_assert((sizeof(g_fpu_regnums_x86_64) / sizeof(g_fpu_regnums_x86_64[0])) - 1 == k_num_fpr_registers_x86_64,<br>
- "g_fpu_regnums_x86_64 has wrong number of register infos");<br>
-<br>
- // x86 64-bit AVX registers.<br>
- static const uint32_t<br>
- g_avx_regnums_x86_64[] =<br>
- {<br>
- fpu_ymm0_x86_64,<br>
- fpu_ymm1_x86_64,<br>
- fpu_ymm2_x86_64,<br>
- fpu_ymm3_x86_64,<br>
- fpu_ymm4_x86_64,<br>
- fpu_ymm5_x86_64,<br>
- fpu_ymm6_x86_64,<br>
- fpu_ymm7_x86_64,<br>
- fpu_ymm8_x86_64,<br>
- fpu_ymm9_x86_64,<br>
- fpu_ymm10_x86_64,<br>
- fpu_ymm11_x86_64,<br>
- fpu_ymm12_x86_64,<br>
- fpu_ymm13_x86_64,<br>
- fpu_ymm14_x86_64,<br>
- fpu_ymm15_x86_64,<br>
- LLDB_INVALID_REGNUM // register sets need to end with this flag<br>
- };<br>
- static_assert((sizeof(g_avx_regnums_x86_64) / sizeof(g_avx_regnums_x86_64[0])) - 1 == k_num_avx_registers_x86_64,<br>
- "g_avx_regnums_x86_64 has wrong number of register infos");<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>
- // Register sets for x86 32-bit.<br>
- static const RegisterSet<br>
- g_reg_sets_i386[k_num_register_sets] =<br>
- {<br>
- { "General Purpose Registers", "gpr", k_num_gpr_registers_i386, g_gpr_regnums_i386 },<br>
- { "Floating Point Registers", "fpu", k_num_fpr_registers_i386, g_fpu_regnums_i386 },<br>
- { "Advanced Vector Extensions", "avx", k_num_avx_registers_i386, g_avx_regnums_i386 }<br>
- };<br>
-<br>
- // Register sets for x86 64-bit.<br>
- static const RegisterSet<br>
- g_reg_sets_x86_64[k_num_register_sets] =<br>
- {<br>
- { "General Purpose Registers", "gpr", k_num_gpr_registers_x86_64, g_gpr_regnums_x86_64 },<br>
- { "Floating Point Registers", "fpu", k_num_fpr_registers_x86_64, g_fpu_regnums_x86_64 },<br>
- { "Advanced Vector Extensions", "avx", k_num_avx_registers_x86_64, g_avx_regnums_x86_64 }<br>
- };<br>
-}<br>
-<br>
-#define REG_CONTEXT_SIZE (GetRegisterInfoInterface ().GetGPRSize () + sizeof(FPR))<br>
-<br>
-// ----------------------------------------------------------------------------<br>
-// Required ptrace defines.<br>
-// ----------------------------------------------------------------------------<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>
-// ----------------------------------------------------------------------------<br>
-// NativeRegisterContextLinux_x86_64 members.<br>
-// ----------------------------------------------------------------------------<br>
-<br>
-NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64 (NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx, RegisterInfoInterface *reg_info_interface_p) :<br>
- NativeRegisterContextRegisterInfo (native_thread, concrete_frame_idx, reg_info_interface_p),<br>
- m_fpr_type (eFPRTypeNotValid),<br>
- m_fpr (),<br>
- m_iovec (),<br>
- m_ymm_set (),<br>
- m_reg_info (),<br>
- m_gpr_x86_64 ()<br>
-{<br>
- // Set up data about ranges of valid registers.<br>
- switch (reg_info_interface_p->GetTargetArchitecture ().GetMachine ())<br>
- {<br>
- case llvm::Triple::x86:<br>
- m_reg_info.num_registers = k_num_registers_i386;<br>
- m_reg_info.num_gpr_registers = k_num_gpr_registers_i386;<br>
- m_reg_info.num_fpr_registers = k_num_fpr_registers_i386;<br>
- m_reg_info.num_avx_registers = k_num_avx_registers_i386;<br>
- m_reg_info.last_gpr = k_last_gpr_i386;<br>
- m_reg_info.first_fpr = k_first_fpr_i386;<br>
- m_reg_info.last_fpr = k_last_fpr_i386;<br>
- m_reg_info.first_st = fpu_st0_i386;<br>
- m_reg_info.last_st = fpu_st7_i386;<br>
- m_reg_info.first_mm = fpu_mm0_i386;<br>
- m_reg_info.last_mm = fpu_mm7_i386;<br>
- m_reg_info.first_xmm = fpu_xmm0_i386;<br>
- m_reg_info.last_xmm = fpu_xmm7_i386;<br>
- m_reg_info.first_ymm = fpu_ymm0_i386;<br>
- m_reg_info.last_ymm = fpu_ymm7_i386;<br>
- m_reg_info.first_dr = dr0_i386;<br>
- m_reg_info.gpr_flags = gpr_eflags_i386;<br>
- break;<br>
- case llvm::Triple::x86_64:<br>
- m_reg_info.num_registers = k_num_registers_x86_64;<br>
- m_reg_info.num_gpr_registers = k_num_gpr_registers_x86_64;<br>
- m_reg_info.num_fpr_registers = k_num_fpr_registers_x86_64;<br>
- m_reg_info.num_avx_registers = k_num_avx_registers_x86_64;<br>
- m_reg_info.last_gpr = k_last_gpr_x86_64;<br>
- m_reg_info.first_fpr = k_first_fpr_x86_64;<br>
- m_reg_info.last_fpr = k_last_fpr_x86_64;<br>
- m_reg_info.first_st = fpu_st0_x86_64;<br>
- m_reg_info.last_st = fpu_st7_x86_64;<br>
- m_reg_info.first_mm = fpu_mm0_x86_64;<br>
- m_reg_info.last_mm = fpu_mm7_x86_64;<br>
- m_reg_info.first_xmm = fpu_xmm0_x86_64;<br>
- m_reg_info.last_xmm = fpu_xmm15_x86_64;<br>
- m_reg_info.first_ymm = fpu_ymm0_x86_64;<br>
- m_reg_info.last_ymm = fpu_ymm15_x86_64;<br>
- m_reg_info.first_dr = dr0_x86_64;<br>
- m_reg_info.gpr_flags = gpr_rflags_x86_64;<br>
- break;<br>
- default:<br>
- assert(false && "Unhandled target architecture.");<br>
- break;<br>
- }<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>
- // Clear out the FPR state.<br>
- ::memset(&m_fpr, 0, sizeof(FPR));<br>
-}<br>
-<br>
-// CONSIDER after local and llgs debugging are merged, register set support can<br>
-// be moved into a base x86-64 class with IsRegisterSetAvailable made virtual.<br>
-uint32_t<br>
-NativeRegisterContextLinux_x86_64::GetRegisterSetCount () const<br>
-{<br>
- uint32_t sets = 0;<br>
- for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index)<br>
- {<br>
- if (IsRegisterSetAvailable (set_index))<br>
- ++sets;<br>
- }<br>
-<br>
- return sets;<br>
-}<br>
-<br>
-const lldb_private::RegisterSet *<br>
-NativeRegisterContextLinux_x86_64::GetRegisterSet (uint32_t set_index) const<br>
-{<br>
- if (!IsRegisterSetAvailable (set_index))<br>
- return nullptr;<br>
-<br>
- switch (GetRegisterInfoInterface ().GetTargetArchitecture ().GetMachine ())<br>
- {<br>
- case llvm::Triple::x86:<br>
- return &g_reg_sets_i386[set_index];<br>
- case llvm::Triple::x86_64:<br>
- return &g_reg_sets_x86_64[set_index];<br>
- default:<br>
- assert (false && "Unhandled target architecture.");<br>
- return nullptr;<br>
- }<br>
-<br>
- return nullptr;<br>
-}<br>
-<br>
-lldb_private::Error<br>
-NativeRegisterContextLinux_x86_64::ReadRegisterRaw (uint32_t reg_index, RegisterValue ®_value)<br>
-{<br>
- Error error;<br>
- const RegisterInfo *const reg_info = GetRegisterInfoAtIndex (reg_index);<br>
- if (!reg_info)<br>
- {<br>
- error.SetErrorStringWithFormat ("register %" PRIu32 " not found", reg_index);<br>
- return error;<br>
- }<br>
-<br>
- NativeProcessProtocolSP process_sp (m_thread.GetProcess ());<br>
- if (!process_sp)<br>
- {<br>
- error.SetErrorString ("NativeProcessProtocol is NULL");<br>
- return error;<br>
- }<br>
-<br>
- NativeProcessLinux *const process_p = reinterpret_cast<NativeProcessLinux*> (process_sp.get ());<br>
- if (!process_p->ReadRegisterValue(m_thread.GetID(),<br>
- reg_info->byte_offset,<br>
- reg_info->name,<br>
- reg_info->byte_size,<br>
- reg_value))<br>
- error.SetErrorString ("NativeProcessLinux::ReadRegisterValue() failed");<br>
-<br>
- return error;<br>
-}<br>
-<br>
-lldb_private::Error<br>
-NativeRegisterContextLinux_x86_64::ReadRegister (const RegisterInfo *reg_info, RegisterValue ®_value)<br>
-{<br>
- Error error;<br>
-<br>
- if (!reg_info)<br>
- {<br>
- error.SetErrorString ("reg_info NULL");<br>
- return error;<br>
- }<br>
-<br>
- const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];<br>
- if (reg == LLDB_INVALID_REGNUM)<br>
- {<br>
- // This is likely an internal register for lldb use only and should not be directly queried.<br>
- error.SetErrorStringWithFormat ("register \"%s\" is an internal-only lldb register, cannot read directly", reg_info->name);<br>
- return error;<br>
- }<br>
-<br>
- if (IsFPR(reg, GetFPRType()))<br>
- {<br>
- if (!ReadFPR())<br>
- {<br>
- error.SetErrorString ("failed to read floating point register");<br>
- return error;<br>
- }<br>
- }<br>
- else<br>
- {<br>
- uint32_t full_reg = reg;<br>
- bool is_subreg = reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM);<br>
-<br>
- if (is_subreg)<br>
- {<br>
- // Read the full aligned 64-bit register.<br>
- full_reg = reg_info->invalidate_regs[0];<br>
- }<br>
-<br>
- error = ReadRegisterRaw(full_reg, reg_value);<br>
-<br>
- if (error.Success ())<br>
- {<br>
- // If our read was not aligned (for ah,bh,ch,dh), shift our returned value one byte to the right.<br>
- if (is_subreg && (reg_info->byte_offset & 0x1))<br>
- reg_value.SetUInt64(reg_value.GetAsUInt64() >> 8);<br>
-<br>
- // If our return byte size was greater than the return value reg size, then<br>
- // use the type specified by reg_info rather than the uint64_t default<br>
- if (reg_value.GetByteSize() > reg_info->byte_size)<br>
- reg_value.SetType(reg_info);<br>
- }<br>
- return error;<br>
- }<br>
-<br>
- if (reg_info->encoding == lldb::eEncodingVector)<br>
- {<br>
- lldb::ByteOrder byte_order = GetByteOrder();<br>
-<br>
- if (byte_order != lldb::eByteOrderInvalid)<br>
- {<br>
- if (reg >= m_reg_info.first_st && reg <= m_reg_info.last_st)<br>
- reg_value.SetBytes(m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_st].bytes, reg_info->byte_size, byte_order);<br>
- if (reg >= m_reg_info.first_mm && reg <= m_reg_info.last_mm)<br>
- reg_value.SetBytes(m_fpr.xstate.fxsave.stmm[reg - m_reg_info.first_mm].bytes, reg_info->byte_size, byte_order);<br>
- if (reg >= m_reg_info.first_xmm && reg <= m_reg_info.last_xmm)<br>
- reg_value.SetBytes(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_xmm].bytes, reg_info->byte_size, byte_order);<br>
- if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm)<br>
- {<br>
- // Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes<br>
- if (GetFPRType() == eFPRTypeXSAVE && CopyXSTATEtoYMM(reg, byte_order))<br>
- reg_value.SetBytes(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, reg_info->byte_size, byte_order);<br>
- else<br>
- {<br>
- error.SetErrorString ("failed to copy ymm register value");<br>
- return error;<br>
- }<br>
- }<br>
-<br>
- if (reg_value.GetType() != RegisterValue::eTypeBytes)<br>
- error.SetErrorString ("write failed - type was expected to be RegisterValue::eTypeBytes");<br>
-<br>
- return error;<br>
- }<br>
-<br>
- error.SetErrorString ("byte order is invalid");<br>
- return error;<br>
- }<br>
-<br>
- // Get pointer to m_fpr.xstate.fxsave variable and set the data from it.<br>
- assert (reg_info->byte_offset < sizeof(m_fpr));<br>
- uint8_t *src = (uint8_t *)&m_fpr + reg_info->byte_offset;<br>
- switch (reg_info->byte_size)<br>
- {<br>
- case 2:<br>
- reg_value.SetUInt16(*(uint16_t *)src);<br>
- break;<br>
- case 4:<br>
- reg_value.SetUInt32(*(uint32_t *)src);<br>
- break;<br>
- case 8:<br>
- reg_value.SetUInt64(*(uint64_t *)src);<br>
- break;<br>
- default:<br>
- assert(false && "Unhandled data size.");<br>
- error.SetErrorStringWithFormat ("unhandled byte size: %" PRIu32, reg_info->byte_size);<br>
- break;<br>
- }<br>
-<br>
- return error;<br>
-}<br>
-<br>
-lldb_private::Error<br>
-NativeRegisterContextLinux_x86_64::WriteRegister(const uint32_t reg,<br>
- const RegisterValue &value)<br>
-{<br>
- Error error;<br>
-<br>
- uint32_t reg_to_write = reg;<br>
- RegisterValue value_to_write = value;<br>
-<br>
- // Check if this is a subregister of a full register.<br>
- const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg);<br>
- if (reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM))<br>
- {<br>
- RegisterValue full_value;<br>
- uint32_t full_reg = reg_info->invalidate_regs[0];<br>
- const RegisterInfo *full_reg_info = GetRegisterInfoAtIndex(full_reg);<br>
-<br>
- // Read the full register.<br>
- error = ReadRegister(full_reg_info, full_value);<br>
- if (error.Fail ())<br>
- return error;<br>
-<br>
- lldb::ByteOrder byte_order = GetByteOrder();<br>
- uint8_t dst[RegisterValue::kMaxRegisterByteSize];<br>
-<br>
- // Get the bytes for the full register.<br>
- const uint32_t dest_size = full_value.GetAsMemoryData (full_reg_info,<br>
- dst,<br>
- sizeof(dst),<br>
- byte_order,<br>
- error);<br>
- if (error.Success() && dest_size)<br>
- {<br>
- uint8_t src[RegisterValue::kMaxRegisterByteSize];<br>
-<br>
- // Get the bytes for the source data.<br>
- const uint32_t src_size = value.GetAsMemoryData (reg_info, src, sizeof(src), byte_order, error);<br>
- if (error.Success() && src_size && (src_size < dest_size))<br>
- {<br>
- // Copy the src bytes to the destination.<br>
- memcpy (dst + (reg_info->byte_offset & 0x1), src, src_size);<br>
- // Set this full register as the value to write.<br>
- value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order);<br>
- value_to_write.SetType(full_reg_info);<br>
- reg_to_write = full_reg;<br>
- }<br>
- }<br>
- }<br>
-<br>
-<br>
- NativeProcessProtocolSP process_sp (m_thread.GetProcess ());<br>
- if (!process_sp)<br>
- {<br>
- error.SetErrorString ("NativeProcessProtocol is NULL");<br>
- return error;<br>
- }<br>
-<br>
- const RegisterInfo *const register_to_write_info_p = GetRegisterInfoAtIndex (reg_to_write);<br>
- assert (register_to_write_info_p && "register to write does not have valid RegisterInfo");<br>
- if (!register_to_write_info_p)<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s failed to get RegisterInfo for write register index %" PRIu32, __FUNCTION__, reg_to_write);<br>
- return error;<br>
- }<br>
-<br>
- NativeProcessLinux *const process_p = reinterpret_cast<NativeProcessLinux*> (process_sp.get ());<br>
- if (!process_p->WriteRegisterValue(m_thread.GetID(),<br>
- register_to_write_info_p->byte_offset,<br>
- register_to_write_info_p->name,<br>
- value_to_write))<br>
- error.SetErrorString ("NativeProcessLinux::WriteRegisterValue() failed");<br>
-<br>
- return error;<br>
-}<br>
-<br>
-lldb_private::Error<br>
-NativeRegisterContextLinux_x86_64::WriteRegister (const RegisterInfo *reg_info, const RegisterValue ®_value)<br>
-{<br>
- assert (reg_info && "reg_info is null");<br>
-<br>
- const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB];<br>
- if (reg_index == LLDB_INVALID_REGNUM)<br>
- return Error ("no lldb regnum for %s", reg_info && reg_info->name ? reg_info->name : "<unknown register>");<br>
-<br>
- if (IsGPR(reg_index))<br>
- return WriteRegister(reg_index, reg_value);<br>
-<br>
- if (IsFPR(reg_index, GetFPRType()))<br>
- {<br>
- if (reg_info->encoding == lldb::eEncodingVector)<br>
- {<br>
- if (reg_index >= m_reg_info.first_st && reg_index <= m_reg_info.last_st)<br>
- ::memcpy (m_fpr.xstate.fxsave.stmm[reg_index - m_reg_info.first_st].bytes, reg_value.GetBytes(), reg_value.GetByteSize());<br>
-<br>
- if (reg_index >= m_reg_info.first_mm && reg_index <= m_reg_info.last_mm)<br>
- ::memcpy (m_fpr.xstate.fxsave.stmm[reg_index - m_reg_info.first_mm].bytes, reg_value.GetBytes(), reg_value.GetByteSize());<br>
-<br>
- if (reg_index >= m_reg_info.first_xmm && reg_index <= m_reg_info.last_xmm)<br>
- ::memcpy (m_fpr.xstate.fxsave.xmm[reg_index - m_reg_info.first_xmm].bytes, reg_value.GetBytes(), reg_value.GetByteSize());<br>
-<br>
- if (reg_index >= m_reg_info.first_ymm && reg_index <= m_reg_info.last_ymm)<br>
- {<br>
- if (GetFPRType() != eFPRTypeXSAVE)<br>
- return Error ("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>
- ::memcpy (m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes, reg_value.GetBytes(), reg_value.GetByteSize());<br>
- if (!CopyYMMtoXSTATE(reg_index, GetByteOrder()))<br>
- return Error ("CopyYMMtoXSTATE() failed");<br>
- }<br>
- }<br>
- else<br>
- {<br>
- // Get pointer to m_fpr.xstate.fxsave variable and set the data to it.<br>
- assert (reg_info->byte_offset < sizeof(m_fpr));<br>
- uint8_t *dst = (uint8_t *)&m_fpr + reg_info->byte_offset;<br>
- switch (reg_info->byte_size)<br>
- {<br>
- case 2:<br>
- *(uint16_t *)dst = reg_value.GetAsUInt16();<br>
- break;<br>
- case 4:<br>
- *(uint32_t *)dst = reg_value.GetAsUInt32();<br>
- break;<br>
- case 8:<br>
- *(uint64_t *)dst = reg_value.GetAsUInt64();<br>
- break;<br>
- default:<br>
- assert(false && "Unhandled data size.");<br>
- return Error ("unhandled register data size %" PRIu32, reg_info->byte_size);<br>
- }<br>
- }<br>
-<br>
- if (WriteFPR())<br>
- {<br>
- if (IsAVX(reg_index))<br>
- {<br>
- if (!CopyYMMtoXSTATE(reg_index, GetByteOrder()))<br>
- return Error ("CopyYMMtoXSTATE() failed");<br>
- }<br>
- return Error ();<br>
- }<br>
- }<br>
- return Error ("failed - register wasn't recognized to be a GPR or an FPR, write strategy unknown");<br>
-}<br>
-<br>
-lldb_private::Error<br>
-NativeRegisterContextLinux_x86_64::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)<br>
-{<br>
- Error error;<br>
-<br>
- data_sp.reset (new DataBufferHeap (REG_CONTEXT_SIZE, 0));<br>
- if (!data_sp)<br>
- {<br>
- error.SetErrorStringWithFormat ("failed to allocate DataBufferHeap instance of size %" PRIu64, REG_CONTEXT_SIZE);<br>
- return error;<br>
- }<br>
-<br>
- if (!ReadGPR ())<br>
- {<br>
- error.SetErrorString ("ReadGPR() failed");<br>
- return error;<br>
- }<br>
-<br>
- if (!ReadFPR ())<br>
- {<br>
- error.SetErrorString ("ReadFPR() failed");<br>
- return error;<br>
- }<br>
-<br>
- uint8_t *dst = data_sp->GetBytes ();<br>
- if (dst == nullptr)<br>
- {<br>
- error.SetErrorStringWithFormat ("DataBufferHeap instance of size %" PRIu64 " returned a null pointer", REG_CONTEXT_SIZE);<br>
- return error;<br>
- }<br>
-<br>
- ::memcpy (dst, &m_gpr_x86_64, GetRegisterInfoInterface ().GetGPRSize ());<br>
- dst += GetRegisterInfoInterface ().GetGPRSize ();<br>
- if (GetFPRType () == eFPRTypeFXSAVE)<br>
- ::memcpy (dst, &m_fpr.xstate.fxsave, sizeof(m_fpr.xstate.fxsave));<br>
- else if (GetFPRType () == eFPRTypeXSAVE)<br>
- {<br>
- lldb::ByteOrder byte_order = GetByteOrder ();<br>
-<br>
- // Assemble the YMM register content from the register halves.<br>
- for (uint32_t reg = m_reg_info.first_ymm; reg <= m_reg_info.last_ymm; ++reg)<br>
- {<br>
- if (!CopyXSTATEtoYMM (reg, byte_order))<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s CopyXSTATEtoYMM() failed for reg num %" PRIu32, __FUNCTION__, reg);<br>
- return error;<br>
- }<br>
- }<br>
-<br>
- // Copy the extended register state including the assembled ymm registers.<br>
- ::memcpy (dst, &m_fpr, sizeof (m_fpr));<br>
- }<br>
- else<br>
- {<br>
- assert (false && "how do we save the floating point registers?");<br>
- error.SetErrorString ("unsure how to save the floating point registers");<br>
- }<br>
-<br>
- return error;<br>
-}<br>
-<br>
-lldb_private::Error<br>
-NativeRegisterContextLinux_x86_64::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp)<br>
-{<br>
- Error error;<br>
-<br>
- if (!data_sp)<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s invalid data_sp provided", __FUNCTION__);<br>
- return error;<br>
- }<br>
-<br>
- if (data_sp->GetByteSize () != REG_CONTEXT_SIZE)<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s data_sp contained mismatched data size, expected %" PRIu64 ", actual %" PRIu64, __FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize ());<br>
- return error;<br>
- }<br>
-<br>
-<br>
- uint8_t *src = data_sp->GetBytes ();<br>
- if (src == nullptr)<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s DataBuffer::GetBytes() returned a null pointer", __FUNCTION__);<br>
- return error;<br>
- }<br>
- ::memcpy (&m_gpr_x86_64, src, GetRegisterInfoInterface ().GetGPRSize ());<br>
-<br>
- if (!WriteGPR ())<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s WriteGPR() failed", __FUNCTION__);<br>
- return error;<br>
- }<br>
-<br>
- src += GetRegisterInfoInterface ().GetGPRSize ();<br>
- if (GetFPRType () == eFPRTypeFXSAVE)<br>
- ::memcpy (&m_fpr.xstate.fxsave, src, sizeof(m_fpr.xstate.fxsave));<br>
- else if (GetFPRType () == eFPRTypeXSAVE)<br>
- ::memcpy (&m_fpr.xstate.xsave, src, sizeof(m_fpr.xstate.xsave));<br>
-<br>
- if (!WriteFPR ())<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s WriteFPR() failed", __FUNCTION__);<br>
- return error;<br>
- }<br>
-<br>
- if (GetFPRType() == eFPRTypeXSAVE)<br>
- {<br>
- lldb::ByteOrder byte_order = GetByteOrder();<br>
-<br>
- // Parse the YMM register content from the register halves.<br>
- for (uint32_t reg = m_reg_info.first_ymm; reg <= m_reg_info.last_ymm; ++reg)<br>
- {<br>
- if (!CopyYMMtoXSTATE (reg, byte_order))<br>
- {<br>
- error.SetErrorStringWithFormat ("NativeRegisterContextLinux_x86_64::%s CopyYMMtoXSTATE() failed for reg num %" PRIu32, __FUNCTION__, reg);<br>
- return error;<br>
- }<br>
- }<br>
- }<br>
-<br>
- return error;<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::IsRegisterSetAvailable (uint32_t set_index) const<br>
-{<br>
- // Note: Extended register sets are assumed to be at the end of g_reg_sets.<br>
- uint32_t num_sets = k_num_register_sets - k_num_extended_register_sets;<br>
-<br>
- if (GetFPRType () == eFPRTypeXSAVE)<br>
- {<br>
- // AVX is the first extended register set.<br>
- ++num_sets;<br>
- }<br>
- return (set_index < num_sets);<br>
-}<br>
-<br>
-lldb::ByteOrder<br>
-NativeRegisterContextLinux_x86_64::GetByteOrder() const<br>
-{<br>
- // Get the target process whose privileged thread was used for the register read.<br>
- lldb::ByteOrder byte_order = lldb::eByteOrderInvalid;<br>
-<br>
- NativeProcessProtocolSP process_sp (m_thread.GetProcess ());<br>
- if (!process_sp)<br>
- return byte_order;<br>
-<br>
- if (!process_sp->GetByteOrder (byte_order))<br>
- {<br>
- // FIXME log here<br>
- }<br>
-<br>
- return byte_order;<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::IsGPR(uint32_t reg_index) const<br>
-{<br>
- // GPRs come first.<br>
- return reg_index <= m_reg_info.last_gpr;<br>
-}<br>
-<br>
-NativeRegisterContextLinux_x86_64::FPRType<br>
-NativeRegisterContextLinux_x86_64::GetFPRType () const<br>
-{<br>
- if (m_fpr_type == eFPRTypeNotValid)<br>
- {<br>
- // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx.<br>
-<br>
- // Try and see if AVX register retrieval works.<br>
- m_fpr_type = eFPRTypeXSAVE;<br>
- if (!const_cast<NativeRegisterContextLinux_x86_64*> (this)->ReadFPR ())<br>
- {<br>
- // Fall back to general floating point with no AVX support.<br>
- m_fpr_type = eFPRTypeFXSAVE;<br>
- }<br>
- }<br>
-<br>
- return m_fpr_type;<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::IsFPR(uint32_t reg_index) const<br>
-{<br>
- return (m_reg_info.first_fpr <= reg_index && reg_index <= m_reg_info.last_fpr);<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::IsFPR(uint32_t reg_index, FPRType fpr_type) const<br>
-{<br>
- bool generic_fpr = IsFPR(reg_index);<br>
-<br>
- if (fpr_type == eFPRTypeXSAVE)<br>
- return generic_fpr || IsAVX(reg_index);<br>
- return generic_fpr;<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::WriteFPR()<br>
-{<br>
- NativeProcessProtocolSP process_sp (m_thread.GetProcess ());<br>
- if (!process_sp)<br>
- return false;<br>
- NativeProcessLinux *const process_p = reinterpret_cast<NativeProcessLinux*> (process_sp.get ());<br>
-<br>
- if (GetFPRType() == eFPRTypeFXSAVE)<br>
- return process_p->WriteFPR (m_thread.GetID (), &m_fpr.xstate.fxsave, sizeof (m_fpr.xstate.fxsave));<br>
-<br>
- if (GetFPRType() == eFPRTypeXSAVE)<br>
- return process_p->WriteRegisterSet (m_thread.GetID (), &m_iovec, sizeof (m_fpr.xstate.xsave), NT_X86_XSTATE);<br>
- return false;<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::IsAVX(uint32_t reg_index) const<br>
-{<br>
- return (m_reg_info.first_ymm <= reg_index && reg_index <= m_reg_info.last_ymm);<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::CopyXSTATEtoYMM (uint32_t reg_index, lldb::ByteOrder byte_order)<br>
-{<br>
- if (!IsAVX (reg_index))<br>
- return false;<br>
-<br>
- if (byte_order == lldb::eByteOrderLittle)<br>
- {<br>
- ::memcpy (m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes,<br>
- m_fpr.xstate.fxsave.xmm[reg_index - m_reg_info.first_ymm].bytes,<br>
- sizeof (XMMReg));<br>
- ::memcpy (m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes + sizeof (XMMReg),<br>
- m_fpr.xstate.xsave.ymmh[reg_index - m_reg_info.first_ymm].bytes,<br>
- sizeof (YMMHReg));<br>
- return true;<br>
- }<br>
-<br>
- if (byte_order == lldb::eByteOrderBig)<br>
- {<br>
- ::memcpy(m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes + sizeof (XMMReg),<br>
- m_fpr.xstate.fxsave.xmm[reg_index - m_reg_info.first_ymm].bytes,<br>
- sizeof (XMMReg));<br>
- ::memcpy(m_ymm_set.ymm[reg_index - m_reg_info.first_ymm].bytes,<br>
- m_fpr.xstate.xsave.ymmh[reg_index - m_reg_info.first_ymm].bytes,<br>
- sizeof (YMMHReg));<br>
- return true;<br>
- }<br>
- return false; // unsupported or invalid byte order<br>
-<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order)<br>
-{<br>
- if (!IsAVX(reg))<br>
- return false;<br>
-<br>
- if (byte_order == lldb::eByteOrderLittle)<br>
- {<br>
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,<br>
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,<br>
- sizeof(XMMReg));<br>
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,<br>
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),<br>
- sizeof(YMMHReg));<br>
- return true;<br>
- }<br>
-<br>
- if (byte_order == lldb::eByteOrderBig)<br>
- {<br>
- ::memcpy(m_fpr.xstate.fxsave.xmm[reg - m_reg_info.first_ymm].bytes,<br>
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes + sizeof(XMMReg),<br>
- sizeof(XMMReg));<br>
- ::memcpy(m_fpr.xstate.xsave.ymmh[reg - m_reg_info.first_ymm].bytes,<br>
- m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes,<br>
- sizeof(YMMHReg));<br>
- return true;<br>
- }<br>
- return false; // unsupported or invalid byte order<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::ReadFPR ()<br>
-{<br>
- NativeProcessProtocolSP process_sp (m_thread.GetProcess ());<br>
- if (!process_sp)<br>
- return false;<br>
- NativeProcessLinux *const process_p = reinterpret_cast<NativeProcessLinux*> (process_sp.get ());<br>
-<br>
- const FPRType fpr_type = GetFPRType ();<br>
- switch (fpr_type)<br>
- {<br>
- case FPRType::eFPRTypeFXSAVE:<br>
- return process_p->ReadFPR (m_thread.GetID (), &m_fpr.xstate.fxsave, sizeof (m_fpr.xstate.fxsave));<br>
-<br>
- case FPRType::eFPRTypeXSAVE:<br>
- return process_p->ReadRegisterSet (m_thread.GetID (), &m_iovec, sizeof (m_fpr.xstate.xsave), NT_X86_XSTATE);<br>
-<br>
- default:<br>
- return false;<br>
- }<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::ReadGPR()<br>
-{<br>
- NativeProcessProtocolSP process_sp (m_thread.GetProcess ());<br>
- if (!process_sp)<br>
- return false;<br>
- NativeProcessLinux *const process_p = reinterpret_cast<NativeProcessLinux*> (process_sp.get ());<br>
-<br>
- return process_p->ReadGPR (m_thread.GetID (), &m_gpr_x86_64, GetRegisterInfoInterface ().GetGPRSize ());<br>
-}<br>
-<br>
-bool<br>
-NativeRegisterContextLinux_x86_64::WriteGPR()<br>
-{<br>
- NativeProcessProtocolSP process_sp (m_thread.GetProcess ());<br>
- if (!process_sp)<br>
- return false;<br>
- NativeProcessLinux *const process_p = reinterpret_cast<NativeProcessLinux*> (process_sp.get ());<br>
-<br>
- return process_p->WriteGPR (m_thread.GetID (), &m_gpr_x86_64, GetRegisterInfoInterface ().GetGPRSize ());<br>
-}<br>
-<br>
<br>
Removed: lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h?rev=212073&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h?rev=212073&view=auto</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h (original)<br>
+++ lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextLinux_x86_64.h (removed)<br>
@@ -1,135 +0,0 @@<br>
-//===-- NativeRegisterContextLinux_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>
-<br>
-#ifndef lldb_NativeRegisterContextLinux_x86_64_h<br>
-#define lldb_NativeRegisterContextLinux_x86_64_h<br>
-<br>
-#include "lldb/Target/NativeRegisterContextRegisterInfo.h"<br>
-#include "RegisterContext_x86.h"<br>
-#include "lldb-x86-register-enums.h"<br>
-<br>
-namespace lldb_private<br>
-{<br>
- class NativeProcessLinux;<br>
-<br>
- class NativeRegisterContextLinux_x86_64 : public NativeRegisterContextRegisterInfo<br>
- {<br>
- public:<br>
- NativeRegisterContextLinux_x86_64 (NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx, RegisterInfoInterface *reg_info_interface_p);<br>
-<br>
- uint32_t<br>
- GetRegisterSetCount () const override;<br>
-<br>
- const RegisterSet *<br>
- GetRegisterSet (uint32_t set_index) const override;<br>
-<br>
- Error<br>
- ReadRegister (const RegisterInfo *reg_info, RegisterValue ®_value) override;<br>
-<br>
- Error<br>
- WriteRegister (const RegisterInfo *reg_info, const RegisterValue ®_value) override;<br>
-<br>
- Error<br>
- ReadAllRegisterValues (lldb::DataBufferSP &data_sp) override;<br>
-<br>
- Error<br>
- WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override;<br>
-<br>
- private:<br>
-<br>
- // Private member types.<br>
- enum FPRType<br>
- {<br>
- eFPRTypeNotValid = 0,<br>
- eFPRTypeFXSAVE,<br>
- eFPRTypeXSAVE<br>
- };<br>
-<br>
- // Info about register ranges.<br>
- struct RegInfo<br>
- {<br>
- uint32_t num_registers;<br>
- uint32_t num_gpr_registers;<br>
- uint32_t num_fpr_registers;<br>
- uint32_t num_avx_registers;<br>
-<br>
- uint32_t last_gpr;<br>
- uint32_t first_fpr;<br>
- uint32_t last_fpr;<br>
-<br>
- uint32_t first_st;<br>
- uint32_t last_st;<br>
- uint32_t first_mm;<br>
- uint32_t last_mm;<br>
- uint32_t first_xmm;<br>
- uint32_t last_xmm;<br>
- uint32_t first_ymm;<br>
- uint32_t last_ymm;<br>
-<br>
- uint32_t first_dr;<br>
- uint32_t gpr_flags;<br>
- };<br>
-<br>
- // Private member variables.<br>
- mutable FPRType m_fpr_type;<br>
- FPR m_fpr;<br>
- IOVEC m_iovec;<br>
- YMM m_ymm_set;<br>
- RegInfo m_reg_info;<br>
- uint64_t m_gpr_x86_64[k_num_gpr_registers_x86_64];<br>
-<br>
- // Private member methods.<br>
- lldb_private::Error<br>
- WriteRegister(const uint32_t reg, const RegisterValue &value);<br>
-<br>
- bool IsRegisterSetAvailable (uint32_t set_index) const;<br>
-<br>
- lldb::ByteOrder<br>
- GetByteOrder() const;<br>
-<br>
- bool<br>
- IsGPR(uint32_t reg_index) const;<br>
-<br>
- FPRType<br>
- GetFPRType () const;<br>
-<br>
- bool<br>
- IsFPR(uint32_t reg_index) const;<br>
-<br>
- bool<br>
- WriteFPR();<br>
-<br>
- bool IsFPR(uint32_t reg_index, FPRType fpr_type) const;<br>
-<br>
- bool<br>
- CopyXSTATEtoYMM (uint32_t reg_index, lldb::ByteOrder byte_order);<br>
-<br>
- bool<br>
- CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);<br>
-<br>
- bool<br>
- IsAVX (uint32_t reg_index) const;<br>
-<br>
- bool<br>
- ReadFPR ();<br>
-<br>
- lldb_private::Error<br>
- ReadRegisterRaw (uint32_t reg_index, RegisterValue ®_value);<br>
-<br>
- bool<br>
- ReadGPR();<br>
-<br>
- bool<br>
- WriteGPR();<br>
- };<br>
-}<br>
-<br>
-#endif // #ifndef lldb_NativeRegisterContextLinux_x86_64_h<br>
-<br>
<br>
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=212074&r1=212073&r2=212074&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=212074&r1=212073&r2=212074&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)<br>
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Mon Jun 30 18:51:35 2014<br>
@@ -15,6 +15,8 @@<br>
// C Includes<br>
// C++ Includes<br>
#include <cstring><br>
+#include <chrono><br>
+#include <thread><br>
<br>
// Other libraries and framework includes<br>
#include "llvm/ADT/Triple.h"<br>
@@ -535,8 +537,8 @@ GDBRemoteCommunicationServer::LaunchDebu<br>
if (log)<br>
log->Printf ("GDBRemoteCommunicationServer::%s waiting for launched process to hit first stop (%d)...", __FUNCTION__, iteration++);<br>
<br>
- // FIXME use a sleep method with finer granularity.<br>
- sleep (1);<br>
+ // FIXME use a finer granularity.<br>
+ std::this_thread::sleep_for(std::chrono::seconds(1));<br>
}<br>
<br>
if (log)<br>
<br>
Modified: lldb/trunk/source/Target/ProcessLaunchInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessLaunchInfo.cpp?rev=212074&r1=212073&r2=212074&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ProcessLaunchInfo.cpp?rev=212074&r1=212073&r2=212074&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Target/ProcessLaunchInfo.cpp (original)<br>
+++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp Mon Jun 30 18:51:35 2014<br>
@@ -7,6 +7,8 @@<br>
//<br>
//===----------------------------------------------------------------------===//<br>
<br>
+#include "lldb/Host/Config.h"<br>
+<br>
#include "lldb/Target/ProcessLaunchInfo.h"<br>
<br>
#ifndef LLDB_DISABLE_POSIX<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>