summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Windows/Common
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process/Windows/Common')
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h103
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/NtStructures.h23
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp85
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h44
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp260
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h151
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp169
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.h64
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp103
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.h46
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp437
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.h40
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp266
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h42
14 files changed, 881 insertions, 952 deletions
diff --git a/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h b/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h
index 79dae3fca4e..e99a75e023e 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ExceptionRecord.h
@@ -10,15 +10,14 @@
#ifndef liblldb_Plugins_Process_Windows_ExceptionRecord_H_
#define liblldb_Plugins_Process_Windows_ExceptionRecord_H_
-#include "lldb/lldb-forward.h"
#include "lldb/Host/windows/windows.h"
+#include "lldb/lldb-forward.h"
#include <DbgHelp.h>
#include <memory>
#include <vector>
-namespace lldb_private
-{
+namespace lldb_private {
//----------------------------------------------------------------------
// ExceptionRecord
@@ -26,73 +25,55 @@ namespace lldb_private
// ExceptionRecord defines an interface which allows implementors to receive
// notification of events that happen in a debugged process.
//----------------------------------------------------------------------
-class ExceptionRecord
-{
- public:
- ExceptionRecord(const EXCEPTION_RECORD &record, lldb::tid_t thread_id)
- {
- m_code = record.ExceptionCode;
- m_continuable = (record.ExceptionFlags == 0);
- if (record.ExceptionRecord)
- m_next_exception.reset(new ExceptionRecord(*record.ExceptionRecord, thread_id));
- m_exception_addr = reinterpret_cast<lldb::addr_t>(record.ExceptionAddress);
- m_thread_id = thread_id;
- m_arguments.assign(record.ExceptionInformation, record.ExceptionInformation + record.NumberParameters);
- }
+class ExceptionRecord {
+public:
+ ExceptionRecord(const EXCEPTION_RECORD &record, lldb::tid_t thread_id) {
+ m_code = record.ExceptionCode;
+ m_continuable = (record.ExceptionFlags == 0);
+ if (record.ExceptionRecord)
+ m_next_exception.reset(
+ new ExceptionRecord(*record.ExceptionRecord, thread_id));
+ m_exception_addr = reinterpret_cast<lldb::addr_t>(record.ExceptionAddress);
+ m_thread_id = thread_id;
+ m_arguments.assign(record.ExceptionInformation,
+ record.ExceptionInformation + record.NumberParameters);
+ }
- // MINIDUMP_EXCEPTIONs are almost identical to EXCEPTION_RECORDs.
- ExceptionRecord(const MINIDUMP_EXCEPTION &record, lldb::tid_t thread_id) :
- m_code(record.ExceptionCode),
- m_continuable(record.ExceptionFlags == 0),
+ // MINIDUMP_EXCEPTIONs are almost identical to EXCEPTION_RECORDs.
+ ExceptionRecord(const MINIDUMP_EXCEPTION &record, lldb::tid_t thread_id)
+ : m_code(record.ExceptionCode), m_continuable(record.ExceptionFlags == 0),
m_next_exception(nullptr),
m_exception_addr(static_cast<lldb::addr_t>(record.ExceptionAddress)),
m_thread_id(thread_id),
- m_arguments(record.ExceptionInformation, record.ExceptionInformation + record.NumberParameters)
- {
- // Set up link to nested exception.
- if (record.ExceptionRecord)
- {
- m_next_exception.reset(new ExceptionRecord(*reinterpret_cast<const MINIDUMP_EXCEPTION *>(record.ExceptionRecord),
- thread_id));
- }
+ m_arguments(record.ExceptionInformation,
+ record.ExceptionInformation + record.NumberParameters) {
+ // Set up link to nested exception.
+ if (record.ExceptionRecord) {
+ m_next_exception.reset(new ExceptionRecord(
+ *reinterpret_cast<const MINIDUMP_EXCEPTION *>(record.ExceptionRecord),
+ thread_id));
}
+ }
- virtual ~ExceptionRecord() {}
+ virtual ~ExceptionRecord() {}
- DWORD
- GetExceptionCode() const
- {
- return m_code;
- }
- bool
- IsContinuable() const
- {
- return m_continuable;
- }
- const ExceptionRecord *
- GetNextException() const
- {
- return m_next_exception.get();
- }
- lldb::addr_t
- GetExceptionAddress() const
- {
- return m_exception_addr;
- }
+ DWORD
+ GetExceptionCode() const { return m_code; }
+ bool IsContinuable() const { return m_continuable; }
+ const ExceptionRecord *GetNextException() const {
+ return m_next_exception.get();
+ }
+ lldb::addr_t GetExceptionAddress() const { return m_exception_addr; }
- lldb::tid_t
- GetThreadID() const
- {
- return m_thread_id;
- }
+ lldb::tid_t GetThreadID() const { return m_thread_id; }
- private:
- DWORD m_code;
- bool m_continuable;
- std::shared_ptr<ExceptionRecord> m_next_exception;
- lldb::addr_t m_exception_addr;
- lldb::tid_t m_thread_id;
- std::vector<ULONG_PTR> m_arguments;
+private:
+ DWORD m_code;
+ bool m_continuable;
+ std::shared_ptr<ExceptionRecord> m_next_exception;
+ lldb::addr_t m_exception_addr;
+ lldb::tid_t m_thread_id;
+ std::vector<ULONG_PTR> m_arguments;
};
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/NtStructures.h b/lldb/source/Plugins/Process/Windows/Common/NtStructures.h
index 6c688d9068d..6826b98c769 100644
--- a/lldb/source/Plugins/Process/Windows/Common/NtStructures.h
+++ b/lldb/source/Plugins/Process/Windows/Common/NtStructures.h
@@ -15,18 +15,17 @@
// This describes the layout of a TEB (Thread Environment Block) for a 64-bit
// process. It's adapted from the 32-bit TEB in winternl.h. Currently, we care
// only about the position of the TlsSlots.
-struct TEB64
-{
- ULONG64 Reserved1[12];
- ULONG64 ProcessEnvironmentBlock;
- ULONG64 Reserved2[399];
- BYTE Reserved3[1952];
- ULONG64 TlsSlots[64];
- BYTE Reserved4[8];
- ULONG64 Reserved5[26];
- ULONG64 ReservedForOle; // Windows 2000 only
- ULONG64 Reserved6[4];
- ULONG64 TlsExpansionSlots;
+struct TEB64 {
+ ULONG64 Reserved1[12];
+ ULONG64 ProcessEnvironmentBlock;
+ ULONG64 Reserved2[399];
+ BYTE Reserved3[1952];
+ ULONG64 TlsSlots[64];
+ BYTE Reserved4[8];
+ ULONG64 Reserved5[26];
+ ULONG64 ReservedForOle; // Windows 2000 only
+ ULONG64 Reserved6[4];
+ ULONG64 TlsExpansionSlots;
};
#endif
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 2c3f9fbecf9..62533651d83 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -23,78 +23,63 @@
using namespace lldb;
using namespace lldb_private;
-namespace lldb_private
-{
+namespace lldb_private {
//------------------------------------------------------------------------------
// Constructors and destructors.
-ProcessWindows::ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
- : lldb_private::Process(target_sp, listener_sp)
-{
-}
+ProcessWindows::ProcessWindows(lldb::TargetSP target_sp,
+ lldb::ListenerSP listener_sp)
+ : lldb_private::Process(target_sp, listener_sp) {}
-ProcessWindows::~ProcessWindows()
-{
-}
+ProcessWindows::~ProcessWindows() {}
-size_t
-ProcessWindows::GetSTDOUT(char *buf, size_t buf_size, Error &error)
-{
- error.SetErrorString("GetSTDOUT unsupported on Windows");
- return 0;
+size_t ProcessWindows::GetSTDOUT(char *buf, size_t buf_size, Error &error) {
+ error.SetErrorString("GetSTDOUT unsupported on Windows");
+ return 0;
}
-size_t
-ProcessWindows::GetSTDERR(char *buf, size_t buf_size, Error &error)
-{
- error.SetErrorString("GetSTDERR unsupported on Windows");
- return 0;
+size_t ProcessWindows::GetSTDERR(char *buf, size_t buf_size, Error &error) {
+ error.SetErrorString("GetSTDERR unsupported on Windows");
+ return 0;
}
-size_t
-ProcessWindows::PutSTDIN(const char *buf, size_t buf_size, Error &error)
-{
- error.SetErrorString("PutSTDIN unsupported on Windows");
- return 0;
+size_t ProcessWindows::PutSTDIN(const char *buf, size_t buf_size,
+ Error &error) {
+ error.SetErrorString("PutSTDIN unsupported on Windows");
+ return 0;
}
//------------------------------------------------------------------------------
// ProcessInterface protocol.
-
-lldb::addr_t
-ProcessWindows::GetImageInfoAddress()
-{
- Target &target = GetTarget();
- ObjectFile *obj_file = target.GetExecutableModule()->GetObjectFile();
- Address addr = obj_file->GetImageInfoAddress(&target);
- if (addr.IsValid())
- return addr.GetLoadAddress(&target);
- else
- return LLDB_INVALID_ADDRESS;
+lldb::addr_t ProcessWindows::GetImageInfoAddress() {
+ Target &target = GetTarget();
+ ObjectFile *obj_file = target.GetExecutableModule()->GetObjectFile();
+ Address addr = obj_file->GetImageInfoAddress(&target);
+ if (addr.IsValid())
+ return addr.GetLoadAddress(&target);
+ else
+ return LLDB_INVALID_ADDRESS;
}
-// The Windows page protection bits are NOT independent masks that can be bitwise-ORed
+// The Windows page protection bits are NOT independent masks that can be
+// bitwise-ORed
// together. For example, PAGE_EXECUTE_READ is not (PAGE_EXECUTE | PAGE_READ).
-// To test for an access type, it's necessary to test for any of the bits that provide
+// To test for an access type, it's necessary to test for any of the bits that
+// provide
// that access type.
-bool
-ProcessWindows::IsPageReadable(uint32_t protect)
-{
- return (protect & PAGE_NOACCESS) == 0;
+bool ProcessWindows::IsPageReadable(uint32_t protect) {
+ return (protect & PAGE_NOACCESS) == 0;
}
-bool
-ProcessWindows::IsPageWritable(uint32_t protect)
-{
- return (protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | PAGE_READWRITE | PAGE_WRITECOPY)) != 0;
+bool ProcessWindows::IsPageWritable(uint32_t protect) {
+ return (protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY |
+ PAGE_READWRITE | PAGE_WRITECOPY)) != 0;
}
-bool
-ProcessWindows::IsPageExecutable(uint32_t protect)
-{
- return (protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)) != 0;
+bool ProcessWindows::IsPageExecutable(uint32_t protect) {
+ return (protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE |
+ PAGE_EXECUTE_WRITECOPY)) != 0;
}
-
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
index 0ee42e2ae1f..bf96180488c 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h
@@ -11,42 +11,38 @@
#define liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_
// Other libraries and framework includes
-#include "lldb/lldb-forward.h"
#include "lldb/Core/Error.h"
#include "lldb/Target/Process.h"
+#include "lldb/lldb-forward.h"
-namespace lldb_private
-{
+namespace lldb_private {
-class ProcessWindows : public lldb_private::Process
-{
+class ProcessWindows : public lldb_private::Process {
public:
- //------------------------------------------------------------------
- // Constructors and destructors
- //------------------------------------------------------------------
- ProcessWindows(lldb::TargetSP target_sp,
- lldb::ListenerSP listener_sp);
+ //------------------------------------------------------------------
+ // Constructors and destructors
+ //------------------------------------------------------------------
+ ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
- ~ProcessWindows();
+ ~ProcessWindows();
- size_t GetSTDOUT(char *buf, size_t buf_size, lldb_private::Error &error) override;
- size_t GetSTDERR(char *buf, size_t buf_size, lldb_private::Error &error) override;
- size_t PutSTDIN(const char *buf, size_t buf_size, lldb_private::Error &error) override;
+ size_t GetSTDOUT(char *buf, size_t buf_size,
+ lldb_private::Error &error) override;
+ size_t GetSTDERR(char *buf, size_t buf_size,
+ lldb_private::Error &error) override;
+ size_t PutSTDIN(const char *buf, size_t buf_size,
+ lldb_private::Error &error) override;
- lldb::addr_t GetImageInfoAddress() override;
+ lldb::addr_t GetImageInfoAddress() override;
protected:
- // These decode the page protection bits.
- static bool
- IsPageReadable(uint32_t protect);
+ // These decode the page protection bits.
+ static bool IsPageReadable(uint32_t protect);
- static bool
- IsPageWritable(uint32_t protect);
+ static bool IsPageWritable(uint32_t protect);
- static bool
- IsPageExecutable(uint32_t protect);
+ static bool IsPageExecutable(uint32_t protect);
};
-
}
-#endif // liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_
+#endif // liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
index 47722c5146b..242c1996bdd 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
@@ -18,177 +18,151 @@
using namespace lldb;
using namespace lldb_private;
-
// We want to avoid global constructors where code needs to be run so here we
// control access to our static g_log_sp by hiding it in a singleton function
// that will construct the static g_log_sp the first time this function is
// called.
static bool g_log_enabled = false;
-static Log * g_log = nullptr;
+static Log *g_log = nullptr;
static llvm::ManagedStatic<std::once_flag> g_once_flag;
-void
-ProcessWindowsLog::Initialize()
-{
- static ConstString g_name("windows");
-
- std::call_once(*g_once_flag, [](){
- Log::Callbacks log_callbacks = {
- DisableLog,
- EnableLog,
- ListLogCategories
- };
-
- Log::RegisterLogChannel(g_name, log_callbacks);
- RegisterPluginName(g_name);
- });
-}
+void ProcessWindowsLog::Initialize() {
+ static ConstString g_name("windows");
-void
-ProcessWindowsLog::Terminate()
-{
-}
+ std::call_once(*g_once_flag, []() {
+ Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories};
-Log *
-ProcessWindowsLog::GetLog()
-{
- return (g_log_enabled) ? g_log : nullptr;
+ Log::RegisterLogChannel(g_name, log_callbacks);
+ RegisterPluginName(g_name);
+ });
}
-bool
-ProcessWindowsLog::TestLogFlags(uint32_t mask, LogMaskReq req)
-{
- Log *log = GetLog();
- if (!log)
- return false;
+void ProcessWindowsLog::Terminate() {}
- uint32_t log_mask = log->GetMask().Get();
- if (req == LogMaskReq::All)
- return ((log_mask & mask) == mask);
- else
- return (log_mask & mask);
+Log *ProcessWindowsLog::GetLog() { return (g_log_enabled) ? g_log : nullptr; }
+
+bool ProcessWindowsLog::TestLogFlags(uint32_t mask, LogMaskReq req) {
+ Log *log = GetLog();
+ if (!log)
+ return false;
+
+ uint32_t log_mask = log->GetMask().Get();
+ if (req == LogMaskReq::All)
+ return ((log_mask & mask) == mask);
+ else
+ return (log_mask & mask);
}
-static uint32_t
-GetFlagBits(const char *arg)
-{
- if (::strcasecmp(arg, "all") == 0 ) return WINDOWS_LOG_ALL;
- else if (::strcasecmp(arg, "break") == 0 ) return WINDOWS_LOG_BREAKPOINTS;
- else if (::strcasecmp(arg, "event") == 0 ) return WINDOWS_LOG_EVENT;
- else if (::strcasecmp(arg, "exception") == 0 ) return WINDOWS_LOG_EXCEPTION;
- else if (::strcasecmp(arg, "memory") == 0 ) return WINDOWS_LOG_MEMORY;
- else if (::strcasecmp(arg, "process") == 0 ) return WINDOWS_LOG_PROCESS;
- else if (::strcasecmp(arg, "registers") == 0 ) return WINDOWS_LOG_REGISTERS;
- else if (::strcasecmp(arg, "step") == 0 ) return WINDOWS_LOG_STEP;
- else if (::strcasecmp(arg, "thread") == 0 ) return WINDOWS_LOG_THREAD;
- else if (::strcasecmp(arg, "verbose") == 0 ) return WINDOWS_LOG_VERBOSE;
- return 0;
+static uint32_t GetFlagBits(const char *arg) {
+ if (::strcasecmp(arg, "all") == 0)
+ return WINDOWS_LOG_ALL;
+ else if (::strcasecmp(arg, "break") == 0)
+ return WINDOWS_LOG_BREAKPOINTS;
+ else if (::strcasecmp(arg, "event") == 0)
+ return WINDOWS_LOG_EVENT;
+ else if (::strcasecmp(arg, "exception") == 0)
+ return WINDOWS_LOG_EXCEPTION;
+ else if (::strcasecmp(arg, "memory") == 0)
+ return WINDOWS_LOG_MEMORY;
+ else if (::strcasecmp(arg, "process") == 0)
+ return WINDOWS_LOG_PROCESS;
+ else if (::strcasecmp(arg, "registers") == 0)
+ return WINDOWS_LOG_REGISTERS;
+ else if (::strcasecmp(arg, "step") == 0)
+ return WINDOWS_LOG_STEP;
+ else if (::strcasecmp(arg, "thread") == 0)
+ return WINDOWS_LOG_THREAD;
+ else if (::strcasecmp(arg, "verbose") == 0)
+ return WINDOWS_LOG_VERBOSE;
+ return 0;
}
-void
-ProcessWindowsLog::DisableLog(const char **args, Stream *feedback_strm)
-{
- Log *log (GetLog());
- if (log)
- {
- uint32_t flag_bits = 0;
-
- if (args[0] != nullptr)
- {
- flag_bits = log->GetMask().Get();
- for (; args[0]; args++)
- {
- const char *arg = args[0];
- uint32_t bits = GetFlagBits(arg);
-
- if (bits)
- {
- flag_bits &= ~bits;
- }
- else
- {
- feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
- ListLogCategories(feedback_strm);
- }
- }
- }
+void ProcessWindowsLog::DisableLog(const char **args, Stream *feedback_strm) {
+ Log *log(GetLog());
+ if (log) {
+ uint32_t flag_bits = 0;
- log->GetMask().Reset(flag_bits);
- if (flag_bits == 0)
- {
- g_log_enabled = false;
- log->SetStream(lldb::StreamSP());
+ if (args[0] != nullptr) {
+ flag_bits = log->GetMask().Get();
+ for (; args[0]; args++) {
+ const char *arg = args[0];
+ uint32_t bits = GetFlagBits(arg);
+
+ if (bits) {
+ flag_bits &= ~bits;
+ } else {
+ feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
+ ListLogCategories(feedback_strm);
}
+ }
}
- return;
-}
-
-Log *
-ProcessWindowsLog::EnableLog(StreamSP &log_stream_sp, uint32_t log_options, const char **args, Stream *feedback_strm)
-{
- // Try see if there already is a log - that way we can reuse its settings.
- // We could reuse the log in toto, but we don't know that the stream is the same.
- uint32_t flag_bits = 0;
- if (g_log)
- flag_bits = g_log->GetMask().Get();
-
- // Now make a new log with this stream if one was provided
- if (log_stream_sp)
- {
- if (g_log)
- g_log->SetStream(log_stream_sp);
- else
- g_log = new Log(log_stream_sp);
+ log->GetMask().Reset(flag_bits);
+ if (flag_bits == 0) {
+ g_log_enabled = false;
+ log->SetStream(lldb::StreamSP());
}
+ }
+ return;
+}
+
+Log *ProcessWindowsLog::EnableLog(StreamSP &log_stream_sp, uint32_t log_options,
+ const char **args, Stream *feedback_strm) {
+ // Try see if there already is a log - that way we can reuse its settings.
+ // We could reuse the log in toto, but we don't know that the stream is the
+ // same.
+ uint32_t flag_bits = 0;
+ if (g_log)
+ flag_bits = g_log->GetMask().Get();
+
+ // Now make a new log with this stream if one was provided
+ if (log_stream_sp) {
if (g_log)
- {
- bool got_unknown_category = false;
- for (; args[0]; args++)
- {
- const char *arg = args[0];
- uint32_t bits = GetFlagBits(arg);
-
- if (bits)
- {
- flag_bits |= bits;
- }
- else
- {
- feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
- if (got_unknown_category == false)
- {
- got_unknown_category = true;
- ListLogCategories (feedback_strm);
- }
- }
+ g_log->SetStream(log_stream_sp);
+ else
+ g_log = new Log(log_stream_sp);
+ }
+
+ if (g_log) {
+ bool got_unknown_category = false;
+ for (; args[0]; args++) {
+ const char *arg = args[0];
+ uint32_t bits = GetFlagBits(arg);
+
+ if (bits) {
+ flag_bits |= bits;
+ } else {
+ feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
+ if (got_unknown_category == false) {
+ got_unknown_category = true;
+ ListLogCategories(feedback_strm);
}
- if (flag_bits == 0)
- flag_bits = WINDOWS_LOG_ALL;
- g_log->GetMask().Reset(flag_bits);
- g_log->GetOptions().Reset(log_options);
- g_log_enabled = true;
+ }
}
- return g_log;
+ if (flag_bits == 0)
+ flag_bits = WINDOWS_LOG_ALL;
+ g_log->GetMask().Reset(flag_bits);
+ g_log->GetOptions().Reset(log_options);
+ g_log_enabled = true;
+ }
+ return g_log;
}
-void
-ProcessWindowsLog::ListLogCategories(Stream *strm)
-{
- strm->Printf("Logging categories for '%s':\n"
- " all - turn on all available logging categories\n"
- " break - log breakpoints\n"
- " event - log low level debugger events\n"
- " exception - log exception information\n"
- " memory - log memory reads and writes\n"
- " process - log process events and activities\n"
- " registers - log register read/writes\n"
- " thread - log thread events and activities\n"
- " step - log step related activities\n"
- " verbose - enable verbose logging\n",
- ProcessWindowsLog::m_pluginname);
+void ProcessWindowsLog::ListLogCategories(Stream *strm) {
+ strm->Printf("Logging categories for '%s':\n"
+ " all - turn on all available logging categories\n"
+ " break - log breakpoints\n"
+ " event - log low level debugger events\n"
+ " exception - log exception information\n"
+ " memory - log memory reads and writes\n"
+ " process - log process events and activities\n"
+ " registers - log register read/writes\n"
+ " thread - log thread events and activities\n"
+ " step - log step related activities\n"
+ " verbose - enable verbose logging\n",
+ ProcessWindowsLog::m_pluginname);
}
const char *ProcessWindowsLog::m_pluginname = "";
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
index d798d131fae..cbb99e8d907 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
@@ -12,85 +12,80 @@
#include "lldb/Core/Log.h"
-#define WINDOWS_LOG_VERBOSE (1u << 0)
-#define WINDOWS_LOG_PROCESS (1u << 1) // Log process operations
-#define WINDOWS_LOG_EXCEPTION (1u << 1) // Log exceptions
-#define WINDOWS_LOG_THREAD (1u << 2) // Log thread operations
-#define WINDOWS_LOG_MEMORY (1u << 3) // Log memory reads/writes calls
-#define WINDOWS_LOG_BREAKPOINTS (1u << 4) // Log breakpoint operations
-#define WINDOWS_LOG_STEP (1u << 5) // Log step operations
-#define WINDOWS_LOG_REGISTERS (1u << 6) // Log register operations
-#define WINDOWS_LOG_EVENT (1u << 7) // Low level debug events
-#define WINDOWS_LOG_ALL (UINT32_MAX)
-
-enum class LogMaskReq
-{
- All,
- Any
-};
-
-class ProcessWindowsLog
-{
- static const char *m_pluginname;
+#define WINDOWS_LOG_VERBOSE (1u << 0)
+#define WINDOWS_LOG_PROCESS (1u << 1) // Log process operations
+#define WINDOWS_LOG_EXCEPTION (1u << 1) // Log exceptions
+#define WINDOWS_LOG_THREAD (1u << 2) // Log thread operations
+#define WINDOWS_LOG_MEMORY (1u << 3) // Log memory reads/writes calls
+#define WINDOWS_LOG_BREAKPOINTS (1u << 4) // Log breakpoint operations
+#define WINDOWS_LOG_STEP (1u << 5) // Log step operations
+#define WINDOWS_LOG_REGISTERS (1u << 6) // Log register operations
+#define WINDOWS_LOG_EVENT (1u << 7) // Low level debug events
+#define WINDOWS_LOG_ALL (UINT32_MAX)
+
+enum class LogMaskReq { All, Any };
+
+class ProcessWindowsLog {
+ static const char *m_pluginname;
public:
- // ---------------------------------------------------------------------
- // Public Static Methods
- // ---------------------------------------------------------------------
- static void
- Initialize();
-
- static void
- Terminate();
-
- static void
- RegisterPluginName(const char *pluginName)
- {
- m_pluginname = pluginName;
- }
-
- static void
- RegisterPluginName(lldb_private::ConstString pluginName)
- {
- m_pluginname = pluginName.GetCString();
- }
-
- static bool
- TestLogFlags(uint32_t mask, LogMaskReq req);
-
- static lldb_private::Log *
- GetLog();
-
- static void
- DisableLog(const char **args, lldb_private::Stream *feedback_strm);
-
- static lldb_private::Log *
- EnableLog(lldb::StreamSP &log_stream_sp, uint32_t log_options,
- const char **args, lldb_private::Stream *feedback_strm);
-
- static void
- ListLogCategories(lldb_private::Stream *strm);
+ // ---------------------------------------------------------------------
+ // Public Static Methods
+ // ---------------------------------------------------------------------
+ static void Initialize();
+
+ static void Terminate();
+
+ static void RegisterPluginName(const char *pluginName) {
+ m_pluginname = pluginName;
+ }
+
+ static void RegisterPluginName(lldb_private::ConstString pluginName) {
+ m_pluginname = pluginName.GetCString();
+ }
+
+ static bool TestLogFlags(uint32_t mask, LogMaskReq req);
+
+ static lldb_private::Log *GetLog();
+
+ static void DisableLog(const char **args,
+ lldb_private::Stream *feedback_strm);
+
+ static lldb_private::Log *EnableLog(lldb::StreamSP &log_stream_sp,
+ uint32_t log_options, const char **args,
+ lldb_private::Stream *feedback_strm);
+
+ static void ListLogCategories(lldb_private::Stream *strm);
};
-#define WINLOGF_IF(Flags, Req, Method, ...) \
- { \
- if (ProcessWindowsLog::TestLogFlags(Flags, Req)) \
- { \
- Log *log = ProcessWindowsLog::GetLog(); \
- if (log) \
- log->Method(__VA_ARGS__); \
- } \
- }
-
-#define WINLOG_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Printf, __VA_ARGS__)
-#define WINLOG_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Printf, __VA_ARGS__)
-#define WINLOGV_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Verbose, __VA_ARGS__)
-#define WINLOGV_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Verbose, __VA_ARGS__)
-#define WINLOGD_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Debug, __VA_ARGS__)
-#define WINLOGD_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Debug, __VA_ARGS__)
-#define WINERR_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Error, __VA_ARGS__)
-#define WINERR_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Error, __VA_ARGS__)
-#define WINWARN_IFANY(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::Any, Warning, __VA_ARGS__)
-#define WINWARN_IFALL(Flags, ...) WINLOGF_IF(Flags, LogMaskReq::All, Warning, __VA_ARGS__)
-
-#endif // liblldb_ProcessWindowsLog_h_
+#define WINLOGF_IF(Flags, Req, Method, ...) \
+ { \
+ if (ProcessWindowsLog::TestLogFlags(Flags, Req)) { \
+ Log *log = ProcessWindowsLog::GetLog(); \
+ if (log) \
+ log->Method(__VA_ARGS__); \
+ } \
+ }
+
+#define WINLOG_IFANY(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::Any, Printf, __VA_ARGS__)
+#define WINLOG_IFALL(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::All, Printf, __VA_ARGS__)
+#define WINLOGV_IFANY(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::Any, Verbose, __VA_ARGS__)
+#define WINLOGV_IFALL(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::All, Verbose, __VA_ARGS__)
+#define WINLOGD_IFANY(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::Any, Debug, __VA_ARGS__)
+#define WINLOGD_IFALL(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::All, Debug, __VA_ARGS__)
+#define WINERR_IFANY(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::Any, Error, __VA_ARGS__)
+#define WINERR_IFALL(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::All, Error, __VA_ARGS__)
+#define WINWARN_IFANY(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::Any, Warning, __VA_ARGS__)
+#define WINWARN_IFALL(Flags, ...) \
+ WINLOGF_IF(Flags, LogMaskReq::All, Warning, __VA_ARGS__)
+
+#endif // liblldb_ProcessWindowsLog_h_
diff --git a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
index d61675f09b1..73bcd4ac38a 100644
--- a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
@@ -7,11 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-private-types.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Host/windows/HostThreadWindows.h"
#include "lldb/Host/windows/windows.h"
+#include "lldb/lldb-private-types.h"
#include "ProcessWindowsLog.h"
#include "RegisterContextWindows.h"
@@ -27,129 +27,110 @@ const DWORD kWinContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
-RegisterContextWindows::RegisterContextWindows(Thread &thread, uint32_t concrete_frame_idx)
- : RegisterContext(thread, concrete_frame_idx)
- , m_context()
- , m_context_stale(true)
-{
-}
+RegisterContextWindows::RegisterContextWindows(Thread &thread,
+ uint32_t concrete_frame_idx)
+ : RegisterContext(thread, concrete_frame_idx), m_context(),
+ m_context_stale(true) {}
-RegisterContextWindows::~RegisterContextWindows()
-{
-}
+RegisterContextWindows::~RegisterContextWindows() {}
-void
-RegisterContextWindows::InvalidateAllRegisters()
-{
- m_context_stale = true;
+void RegisterContextWindows::InvalidateAllRegisters() {
+ m_context_stale = true;
}
-bool
-RegisterContextWindows::ReadAllRegisterValues(lldb::DataBufferSP &data_sp)
-{
- if (!CacheAllRegisterValues())
- return false;
- if (data_sp->GetByteSize() < sizeof(m_context))
- {
- data_sp.reset(new DataBufferHeap(sizeof(CONTEXT), 0));
- }
- memcpy(data_sp->GetBytes(), &m_context, sizeof(m_context));
- return true;
+bool RegisterContextWindows::ReadAllRegisterValues(
+ lldb::DataBufferSP &data_sp) {
+ if (!CacheAllRegisterValues())
+ return false;
+ if (data_sp->GetByteSize() < sizeof(m_context)) {
+ data_sp.reset(new DataBufferHeap(sizeof(CONTEXT), 0));
+ }
+ memcpy(data_sp->GetBytes(), &m_context, sizeof(m_context));
+ return true;
}
-bool
-RegisterContextWindows::WriteAllRegisterValues(const lldb::DataBufferSP &data_sp)
-{
- assert(data_sp->GetByteSize() >= sizeof(m_context));
- memcpy(&m_context, data_sp->GetBytes(), sizeof(m_context));
+bool RegisterContextWindows::WriteAllRegisterValues(
+ const lldb::DataBufferSP &data_sp) {
+ assert(data_sp->GetByteSize() >= sizeof(m_context));
+ memcpy(&m_context, data_sp->GetBytes(), sizeof(m_context));
- TargetThreadWindows &wthread = static_cast<TargetThreadWindows &>(m_thread);
- if (!::SetThreadContext(wthread.GetHostThread().GetNativeThread().GetSystemHandle(), &m_context))
- return false;
+ TargetThreadWindows &wthread = static_cast<TargetThreadWindows &>(m_thread);
+ if (!::SetThreadContext(
+ wthread.GetHostThread().GetNativeThread().GetSystemHandle(),
+ &m_context))
+ return false;
- return true;
+ return true;
}
-uint32_t
-RegisterContextWindows::ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num)
-{
- const uint32_t num_regs = GetRegisterCount();
+uint32_t RegisterContextWindows::ConvertRegisterKindToRegisterNumber(
+ lldb::RegisterKind kind, uint32_t num) {
+ const uint32_t num_regs = GetRegisterCount();
- assert(kind < kNumRegisterKinds);
- for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx)
- {
- const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_idx);
+ assert(kind < kNumRegisterKinds);
+ for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
+ const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_idx);
- if (reg_info->kinds[kind] == num)
- return reg_idx;
- }
+ if (reg_info->kinds[kind] == num)
+ return reg_idx;
+ }
- return LLDB_INVALID_REGNUM;
+ return LLDB_INVALID_REGNUM;
}
//------------------------------------------------------------------
// Subclasses can these functions if desired
//------------------------------------------------------------------
-uint32_t
-RegisterContextWindows::NumSupportedHardwareBreakpoints()
-{
- // Support for hardware breakpoints not yet implemented.
- return 0;
+uint32_t RegisterContextWindows::NumSupportedHardwareBreakpoints() {
+ // Support for hardware breakpoints not yet implemented.
+ return 0;
}
-uint32_t
-RegisterContextWindows::SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
-{
- return 0;
+uint32_t RegisterContextWindows::SetHardwareBreakpoint(lldb::addr_t addr,
+ size_t size) {
+ return 0;
}
-bool
-RegisterContextWindows::ClearHardwareBreakpoint(uint32_t hw_idx)
-{
- return false;
+bool RegisterContextWindows::ClearHardwareBreakpoint(uint32_t hw_idx) {
+ return false;
}
-uint32_t
-RegisterContextWindows::NumSupportedHardwareWatchpoints()
-{
- // Support for hardware watchpoints not yet implemented.
- return 0;
+uint32_t RegisterContextWindows::NumSupportedHardwareWatchpoints() {
+ // Support for hardware watchpoints not yet implemented.
+ return 0;
}
-uint32_t
-RegisterContextWindows::SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write)
-{
- return 0;
+uint32_t RegisterContextWindows::SetHardwareWatchpoint(lldb::addr_t addr,
+ size_t size, bool read,
+ bool write) {
+ return 0;
}
-bool
-RegisterContextWindows::ClearHardwareWatchpoint(uint32_t hw_index)
-{
- return false;
+bool RegisterContextWindows::ClearHardwareWatchpoint(uint32_t hw_index) {
+ return false;
}
-bool
-RegisterContextWindows::HardwareSingleStep(bool enable)
-{
- return false;
-}
+bool RegisterContextWindows::HardwareSingleStep(bool enable) { return false; }
-bool
-RegisterContextWindows::CacheAllRegisterValues()
-{
- if (!m_context_stale)
- return true;
-
- TargetThreadWindows &wthread = static_cast<TargetThreadWindows &>(m_thread);
- memset(&m_context, 0, sizeof(m_context));
- m_context.ContextFlags = kWinContextFlags;
- if (!::GetThreadContext(wthread.GetHostThread().GetNativeThread().GetSystemHandle(), &m_context))
- {
- WINERR_IFALL(WINDOWS_LOG_REGISTERS, "GetThreadContext failed with error %u while caching register values.",
- ::GetLastError());
- return false;
- }
- WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "GetThreadContext successfully updated the register values.", ::GetLastError());
- m_context_stale = false;
+bool RegisterContextWindows::CacheAllRegisterValues() {
+ if (!m_context_stale)
return true;
+
+ TargetThreadWindows &wthread = static_cast<TargetThreadWindows &>(m_thread);
+ memset(&m_context, 0, sizeof(m_context));
+ m_context.ContextFlags = kWinContextFlags;
+ if (!::GetThreadContext(
+ wthread.GetHostThread().GetNativeThread().GetSystemHandle(),
+ &m_context)) {
+ WINERR_IFALL(
+ WINDOWS_LOG_REGISTERS,
+ "GetThreadContext failed with error %u while caching register values.",
+ ::GetLastError());
+ return false;
+ }
+ WINLOG_IFALL(WINDOWS_LOG_REGISTERS,
+ "GetThreadContext successfully updated the register values.",
+ ::GetLastError());
+ m_context_stale = false;
+ return true;
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.h b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.h
index 66b7a9004ea..bd09295c2f2 100644
--- a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.h
@@ -10,57 +10,57 @@
#ifndef liblldb_RegisterContextWindows_H_
#define liblldb_RegisterContextWindows_H_
-#include "lldb/lldb-forward.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/lldb-forward.h"
-namespace lldb_private
-{
+namespace lldb_private {
class Thread;
-class RegisterContextWindows : public lldb_private::RegisterContext
-{
- public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- RegisterContextWindows(Thread &thread, uint32_t concrete_frame_idx);
+class RegisterContextWindows : public lldb_private::RegisterContext {
+public:
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ RegisterContextWindows(Thread &thread, uint32_t concrete_frame_idx);
- virtual ~RegisterContextWindows();
+ virtual ~RegisterContextWindows();
- //------------------------------------------------------------------
- // Subclasses must override these functions
- //------------------------------------------------------------------
- void InvalidateAllRegisters() override;
+ //------------------------------------------------------------------
+ // Subclasses must override these functions
+ //------------------------------------------------------------------
+ void InvalidateAllRegisters() override;
- bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
+ bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
- bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
+ bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
- uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override;
+ uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
+ uint32_t num) override;
- //------------------------------------------------------------------
- // Subclasses can override these functions if desired
- //------------------------------------------------------------------
- uint32_t NumSupportedHardwareBreakpoints() override;
+ //------------------------------------------------------------------
+ // Subclasses can override these functions if desired
+ //------------------------------------------------------------------
+ uint32_t NumSupportedHardwareBreakpoints() override;
- uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
+ uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
- bool ClearHardwareBreakpoint(uint32_t hw_idx) override;
+ bool ClearHardwareBreakpoint(uint32_t hw_idx) override;
- uint32_t NumSupportedHardwareWatchpoints() override;
+ uint32_t NumSupportedHardwareWatchpoints() override;
- uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write) override;
+ uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read,
+ bool write) override;
- bool ClearHardwareWatchpoint(uint32_t hw_index) override;
+ bool ClearHardwareWatchpoint(uint32_t hw_index) override;
- bool HardwareSingleStep(bool enable) override;
+ bool HardwareSingleStep(bool enable) override;
- protected:
- virtual bool CacheAllRegisterValues();
+protected:
+ virtual bool CacheAllRegisterValues();
- CONTEXT m_context;
- bool m_context_stale;
+ CONTEXT m_context;
+ bool m_context_stale;
};
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
index dcb6f0c7243..fe05f3068bb 100644
--- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
@@ -16,83 +16,66 @@
#include "lldb/Host/windows/windows.h"
#include "lldb/Target/RegisterContext.h"
-#include "TargetThreadWindows.h"
#include "ProcessWindows.h"
#include "ProcessWindowsLog.h"
+#include "TargetThreadWindows.h"
#include "UnwindLLDB.h"
using namespace lldb;
using namespace lldb_private;
-TargetThreadWindows::TargetThreadWindows(ProcessWindows &process, const HostThread &thread)
- : Thread(process, thread.GetNativeThread().GetThreadId())
- , m_host_thread(thread)
-{
-}
+TargetThreadWindows::TargetThreadWindows(ProcessWindows &process,
+ const HostThread &thread)
+ : Thread(process, thread.GetNativeThread().GetThreadId()),
+ m_host_thread(thread) {}
-TargetThreadWindows::~TargetThreadWindows()
-{
- DestroyThread();
-}
+TargetThreadWindows::~TargetThreadWindows() { DestroyThread(); }
-void
-TargetThreadWindows::RefreshStateAfterStop()
-{
- ::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle());
- SetState(eStateStopped);
- GetRegisterContext()->InvalidateIfNeeded(false);
+void TargetThreadWindows::RefreshStateAfterStop() {
+ ::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle());
+ SetState(eStateStopped);
+ GetRegisterContext()->InvalidateIfNeeded(false);
}
-void
-TargetThreadWindows::WillResume(lldb::StateType resume_state)
-{
-}
+void TargetThreadWindows::WillResume(lldb::StateType resume_state) {}
-void
-TargetThreadWindows::DidStop()
-{
-}
+void TargetThreadWindows::DidStop() {}
-bool
-TargetThreadWindows::CalculateStopInfo()
-{
- SetStopInfo(m_stop_info_sp);
- return true;
+bool TargetThreadWindows::CalculateStopInfo() {
+ SetStopInfo(m_stop_info_sp);
+ return true;
}
-Unwind *
-TargetThreadWindows::GetUnwinder()
-{
- // FIXME: Implement an unwinder based on the Windows unwinder exposed through DIA SDK.
- if (m_unwinder_ap.get() == NULL)
- m_unwinder_ap.reset(new UnwindLLDB(*this));
- return m_unwinder_ap.get();
+Unwind *TargetThreadWindows::GetUnwinder() {
+ // FIXME: Implement an unwinder based on the Windows unwinder exposed through
+ // DIA SDK.
+ if (m_unwinder_ap.get() == NULL)
+ m_unwinder_ap.reset(new UnwindLLDB(*this));
+ return m_unwinder_ap.get();
}
-bool
-TargetThreadWindows::DoResume()
-{
- StateType resume_state = GetTemporaryResumeState();
- StateType current_state = GetState();
- if (resume_state == current_state)
- return true;
+bool TargetThreadWindows::DoResume() {
+ StateType resume_state = GetTemporaryResumeState();
+ StateType current_state = GetState();
+ if (resume_state == current_state)
+ return true;
- if (resume_state == eStateStepping)
- {
- uint32_t flags_index = GetRegisterContext()->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS);
- uint64_t flags_value = GetRegisterContext()->ReadRegisterAsUnsigned(flags_index, 0);
- flags_value |= 0x100; // Set the trap flag on the CPU
- GetRegisterContext()->WriteRegisterFromUnsigned(flags_index, flags_value);
- }
+ if (resume_state == eStateStepping) {
+ uint32_t flags_index =
+ GetRegisterContext()->ConvertRegisterKindToRegisterNumber(
+ eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS);
+ uint64_t flags_value =
+ GetRegisterContext()->ReadRegisterAsUnsigned(flags_index, 0);
+ flags_value |= 0x100; // Set the trap flag on the CPU
+ GetRegisterContext()->WriteRegisterFromUnsigned(flags_index, flags_value);
+ }
- if (resume_state == eStateStepping || resume_state == eStateRunning)
- {
- DWORD previous_suspend_count = 0;
- HANDLE thread_handle = m_host_thread.GetNativeThread().GetSystemHandle();
- do
- {
- previous_suspend_count = ::ResumeThread(thread_handle);
- } while (previous_suspend_count > 0);
- }
- return true;
+ if (resume_state == eStateStepping || resume_state == eStateRunning) {
+ DWORD previous_suspend_count = 0;
+ HANDLE thread_handle = m_host_thread.GetNativeThread().GetSystemHandle();
+ do {
+ previous_suspend_count = ::ResumeThread(thread_handle);
+ } while (previous_suspend_count > 0);
+ }
+ return true;
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.h b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.h
index 701b56b6d26..ea6d636dbab 100644
--- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.h
@@ -11,39 +11,33 @@
#define liblldb_Plugins_Process_Windows_TargetThreadWindows_H_
//#include "ForwardDecl.h"
-#include "lldb/lldb-forward.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Target/Thread.h"
+#include "lldb/lldb-forward.h"
-namespace lldb_private
-{
+namespace lldb_private {
class ProcessWindows;
class HostThread;
class StackFrame;
-class TargetThreadWindows : public lldb_private::Thread
-{
- public:
- TargetThreadWindows(ProcessWindows &process, const HostThread &thread);
- virtual ~TargetThreadWindows();
-
- // lldb_private::Thread overrides
- void RefreshStateAfterStop() override;
- void WillResume(lldb::StateType resume_state) override;
- void DidStop() override;
- bool CalculateStopInfo() override;
- Unwind *GetUnwinder() override;
-
- bool DoResume();
-
- HostThread
- GetHostThread() const
- {
- return m_host_thread;
- }
-
- private:
- HostThread m_host_thread;
+class TargetThreadWindows : public lldb_private::Thread {
+public:
+ TargetThreadWindows(ProcessWindows &process, const HostThread &thread);
+ virtual ~TargetThreadWindows();
+
+ // lldb_private::Thread overrides
+ void RefreshStateAfterStop() override;
+ void WillResume(lldb::StateType resume_state) override;
+ void DidStop() override;
+ bool CalculateStopInfo() override;
+ Unwind *GetUnwinder() override;
+
+ bool DoResume();
+
+ HostThread GetHostThread() const { return m_host_thread; }
+
+private:
+ HostThread m_host_thread;
};
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
index 3a9c31a0b77..942b4e97c40 100644
--- a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -7,16 +7,16 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-private-types.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Host/windows/HostThreadWindows.h"
#include "lldb/Host/windows/windows.h"
+#include "lldb/lldb-private-types.h"
-#include "lldb-x86-register-enums.h"
-#include "RegisterContext_x86.h"
#include "RegisterContextWindows_x64.h"
+#include "RegisterContext_x86.h"
#include "TargetThreadWindows.h"
+#include "lldb-x86-register-enums.h"
#include "llvm/ADT/STLExtras.h"
@@ -26,302 +26,317 @@ using namespace lldb_private;
#define DEFINE_GPR(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatHexUppercase
#define DEFINE_GPR_BIN(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatBinary
-namespace
-{
+namespace {
-// This enum defines the layout of the global RegisterInfo array. This is necessary because
-// lldb register sets are defined in terms of indices into the register array. As such, the
-// order of RegisterInfos defined in global registers array must match the order defined here.
-// When defining the register set layouts, these values can appear in an arbitrary order, and that
+// This enum defines the layout of the global RegisterInfo array. This is
+// necessary because
+// lldb register sets are defined in terms of indices into the register array.
+// As such, the
+// order of RegisterInfos defined in global registers array must match the order
+// defined here.
+// When defining the register set layouts, these values can appear in an
+// arbitrary order, and that
// determines the order that register values are displayed in a dump.
-enum RegisterIndex
-{
- eRegisterIndexRax,
- eRegisterIndexRbx,
- eRegisterIndexRcx,
- eRegisterIndexRdx,
- eRegisterIndexRdi,
- eRegisterIndexRsi,
- eRegisterIndexR8,
- eRegisterIndexR9,
- eRegisterIndexR10,
- eRegisterIndexR11,
- eRegisterIndexR12,
- eRegisterIndexR13,
- eRegisterIndexR14,
- eRegisterIndexR15,
- eRegisterIndexRbp,
- eRegisterIndexRsp,
- eRegisterIndexRip,
- eRegisterIndexRflags
+enum RegisterIndex {
+ eRegisterIndexRax,
+ eRegisterIndexRbx,
+ eRegisterIndexRcx,
+ eRegisterIndexRdx,
+ eRegisterIndexRdi,
+ eRegisterIndexRsi,
+ eRegisterIndexR8,
+ eRegisterIndexR9,
+ eRegisterIndexR10,
+ eRegisterIndexR11,
+ eRegisterIndexR12,
+ eRegisterIndexR13,
+ eRegisterIndexR14,
+ eRegisterIndexR15,
+ eRegisterIndexRbp,
+ eRegisterIndexRsp,
+ eRegisterIndexRip,
+ eRegisterIndexRflags
};
// Array of all register information supported by Windows x86
RegisterInfo g_register_infos[] = {
- // Macro auto defines most stuff eh_frame DWARF GENERIC
+ // Macro auto defines most stuff eh_frame DWARF
+ // GENERIC
// GDB LLDB VALUE REGS INVALIDATE REGS
- // ================================ ========================= ====================== =========================
+ // ================================ =========================
+ // ====================== =========================
// =================== ================= ========== ===============
{DEFINE_GPR(rax, nullptr),
- {dwarf_rax_x86_64, dwarf_rax_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_rax_x86_64},
+ {dwarf_rax_x86_64, dwarf_rax_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_rax_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rbx, nullptr),
- {dwarf_rbx_x86_64, dwarf_rbx_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_rbx_x86_64},
+ {dwarf_rbx_x86_64, dwarf_rbx_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_rbx_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rcx, nullptr),
- {dwarf_rcx_x86_64, dwarf_rcx_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_rcx_x86_64},
+ {dwarf_rcx_x86_64, dwarf_rcx_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_rcx_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rdx, nullptr),
- {dwarf_rdx_x86_64, dwarf_rdx_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_rdx_x86_64},
+ {dwarf_rdx_x86_64, dwarf_rdx_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_rdx_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rdi, nullptr),
- {dwarf_rdi_x86_64, dwarf_rdi_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_rdi_x86_64},
+ {dwarf_rdi_x86_64, dwarf_rdi_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_rdi_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rsi, nullptr),
- {dwarf_rsi_x86_64, dwarf_rsi_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_rsi_x86_64},
+ {dwarf_rsi_x86_64, dwarf_rsi_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_rsi_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r8, nullptr),
- {dwarf_r8_x86_64, dwarf_r8_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r8_x86_64},
+ {dwarf_r8_x86_64, dwarf_r8_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r8_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r9, nullptr),
- {dwarf_r9_x86_64, dwarf_r9_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r9_x86_64},
+ {dwarf_r9_x86_64, dwarf_r9_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r9_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r10, nullptr),
- {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r10_x86_64},
+ {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r10_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r11, nullptr),
- {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r11_x86_64},
+ {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r11_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r12, nullptr),
- {dwarf_r12_x86_64, dwarf_r12_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r12_x86_64},
+ {dwarf_r12_x86_64, dwarf_r12_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r12_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r13, nullptr),
- {dwarf_r13_x86_64, dwarf_r13_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r13_x86_64},
+ {dwarf_r13_x86_64, dwarf_r13_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r13_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r14, nullptr),
- {dwarf_r14_x86_64, dwarf_r14_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r14_x86_64},
+ {dwarf_r14_x86_64, dwarf_r14_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r14_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(r15, nullptr),
- {dwarf_r15_x86_64, dwarf_r15_x86_64, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_r15_x86_64},
+ {dwarf_r15_x86_64, dwarf_r15_x86_64, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_r15_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rbp, "fp"),
- {dwarf_rbp_x86_64, dwarf_rbp_x86_64, LLDB_REGNUM_GENERIC_FP, LLDB_INVALID_REGNUM, lldb_rbp_x86_64},
+ {dwarf_rbp_x86_64, dwarf_rbp_x86_64, LLDB_REGNUM_GENERIC_FP,
+ LLDB_INVALID_REGNUM, lldb_rbp_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rsp, "sp"),
- {dwarf_rsp_x86_64, dwarf_rsp_x86_64, LLDB_REGNUM_GENERIC_SP, LLDB_INVALID_REGNUM, lldb_rsp_x86_64},
+ {dwarf_rsp_x86_64, dwarf_rsp_x86_64, LLDB_REGNUM_GENERIC_SP,
+ LLDB_INVALID_REGNUM, lldb_rsp_x86_64},
nullptr,
nullptr},
{DEFINE_GPR(rip, "pc"),
- {dwarf_rip_x86_64, dwarf_rip_x86_64, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM, lldb_rip_x86_64},
+ {dwarf_rip_x86_64, dwarf_rip_x86_64, LLDB_REGNUM_GENERIC_PC,
+ LLDB_INVALID_REGNUM, lldb_rip_x86_64},
nullptr,
nullptr},
{DEFINE_GPR_BIN(eflags, "flags"),
- {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM, lldb_rflags_x86_64},
+ {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_FLAGS,
+ LLDB_INVALID_REGNUM, lldb_rflags_x86_64},
nullptr,
nullptr},
};
static size_t k_num_register_infos = llvm::array_lengthof(g_register_infos);
-// Array of lldb register numbers used to define the set of all General Purpose Registers
-uint32_t g_gpr_reg_indices[] = {eRegisterIndexRax, eRegisterIndexRbx, eRegisterIndexRcx, eRegisterIndexRdx,
- eRegisterIndexRdi, eRegisterIndexRsi, eRegisterIndexR8, eRegisterIndexR9,
- eRegisterIndexR10, eRegisterIndexR11, eRegisterIndexR12, eRegisterIndexR13,
- eRegisterIndexR14, eRegisterIndexR15, eRegisterIndexRbp, eRegisterIndexRsp,
- eRegisterIndexRip, eRegisterIndexRflags};
+// Array of lldb register numbers used to define the set of all General Purpose
+// Registers
+uint32_t g_gpr_reg_indices[] = {
+ eRegisterIndexRax, eRegisterIndexRbx, eRegisterIndexRcx,
+ eRegisterIndexRdx, eRegisterIndexRdi, eRegisterIndexRsi,
+ eRegisterIndexR8, eRegisterIndexR9, eRegisterIndexR10,
+ eRegisterIndexR11, eRegisterIndexR12, eRegisterIndexR13,
+ eRegisterIndexR14, eRegisterIndexR15, eRegisterIndexRbp,
+ eRegisterIndexRsp, eRegisterIndexRip, eRegisterIndexRflags};
RegisterSet g_register_sets[] = {
- {"General Purpose Registers", "gpr", llvm::array_lengthof(g_gpr_reg_indices), g_gpr_reg_indices},
+ {"General Purpose Registers", "gpr",
+ llvm::array_lengthof(g_gpr_reg_indices), g_gpr_reg_indices},
};
}
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
-RegisterContextWindows_x64::RegisterContextWindows_x64(Thread &thread, uint32_t concrete_frame_idx)
- : RegisterContextWindows(thread, concrete_frame_idx)
-{
-}
+RegisterContextWindows_x64::RegisterContextWindows_x64(
+ Thread &thread, uint32_t concrete_frame_idx)
+ : RegisterContextWindows(thread, concrete_frame_idx) {}
-RegisterContextWindows_x64::~RegisterContextWindows_x64()
-{
-}
+RegisterContextWindows_x64::~RegisterContextWindows_x64() {}
-size_t
-RegisterContextWindows_x64::GetRegisterCount()
-{
- return llvm::array_lengthof(g_register_infos);
+size_t RegisterContextWindows_x64::GetRegisterCount() {
+ return llvm::array_lengthof(g_register_infos);
}
const RegisterInfo *
-RegisterContextWindows_x64::GetRegisterInfoAtIndex(size_t reg)
-{
- if (reg < k_num_register_infos)
- return &g_register_infos[reg];
- return NULL;
+RegisterContextWindows_x64::GetRegisterInfoAtIndex(size_t reg) {
+ if (reg < k_num_register_infos)
+ return &g_register_infos[reg];
+ return NULL;
}
-size_t
-RegisterContextWindows_x64::GetRegisterSetCount()
-{
- return llvm::array_lengthof(g_register_sets);
+size_t RegisterContextWindows_x64::GetRegisterSetCount() {
+ return llvm::array_lengthof(g_register_sets);
}
-const RegisterSet *
-RegisterContextWindows_x64::GetRegisterSet(size_t reg_set)
-{
- return &g_register_sets[reg_set];
+const RegisterSet *RegisterContextWindows_x64::GetRegisterSet(size_t reg_set) {
+ return &g_register_sets[reg_set];
}
-bool
-RegisterContextWindows_x64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value)
-{
- if (!CacheAllRegisterValues())
- return false;
+bool RegisterContextWindows_x64::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &reg_value) {
+ if (!CacheAllRegisterValues())
+ return false;
- switch (reg_info->kinds[eRegisterKindLLDB])
- {
- case lldb_rax_x86_64:
- reg_value.SetUInt64(m_context.Rax);
- break;
- case lldb_rbx_x86_64:
- reg_value.SetUInt64(m_context.Rbx);
- break;
- case lldb_rcx_x86_64:
- reg_value.SetUInt64(m_context.Rcx);
- break;
- case lldb_rdx_x86_64:
- reg_value.SetUInt64(m_context.Rdx);
- break;
- case lldb_rdi_x86_64:
- reg_value.SetUInt64(m_context.Rdi);
- break;
- case lldb_rsi_x86_64:
- reg_value.SetUInt64(m_context.Rsi);
- break;
- case lldb_r8_x86_64:
- reg_value.SetUInt64(m_context.R8);
- break;
- case lldb_r9_x86_64:
- reg_value.SetUInt64(m_context.R9);
- break;
- case lldb_r10_x86_64:
- reg_value.SetUInt64(m_context.R10);
- break;
- case lldb_r11_x86_64:
- reg_value.SetUInt64(m_context.R11);
- break;
- case lldb_r12_x86_64:
- reg_value.SetUInt64(m_context.R12);
- break;
- case lldb_r13_x86_64:
- reg_value.SetUInt64(m_context.R13);
- break;
- case lldb_r14_x86_64:
- reg_value.SetUInt64(m_context.R14);
- break;
- case lldb_r15_x86_64:
- reg_value.SetUInt64(m_context.R15);
- break;
- case lldb_rbp_x86_64:
- reg_value.SetUInt64(m_context.Rbp);
- break;
- case lldb_rsp_x86_64:
- reg_value.SetUInt64(m_context.Rsp);
- break;
- case lldb_rip_x86_64:
- reg_value.SetUInt64(m_context.Rip);
- break;
- case lldb_rflags_x86_64:
- reg_value.SetUInt64(m_context.EFlags);
- break;
- }
- return true;
+ switch (reg_info->kinds[eRegisterKindLLDB]) {
+ case lldb_rax_x86_64:
+ reg_value.SetUInt64(m_context.Rax);
+ break;
+ case lldb_rbx_x86_64:
+ reg_value.SetUInt64(m_context.Rbx);
+ break;
+ case lldb_rcx_x86_64:
+ reg_value.SetUInt64(m_context.Rcx);
+ break;
+ case lldb_rdx_x86_64:
+ reg_value.SetUInt64(m_context.Rdx);
+ break;
+ case lldb_rdi_x86_64:
+ reg_value.SetUInt64(m_context.Rdi);
+ break;
+ case lldb_rsi_x86_64:
+ reg_value.SetUInt64(m_context.Rsi);
+ break;
+ case lldb_r8_x86_64:
+ reg_value.SetUInt64(m_context.R8);
+ break;
+ case lldb_r9_x86_64:
+ reg_value.SetUInt64(m_context.R9);
+ break;
+ case lldb_r10_x86_64:
+ reg_value.SetUInt64(m_context.R10);
+ break;
+ case lldb_r11_x86_64:
+ reg_value.SetUInt64(m_context.R11);
+ break;
+ case lldb_r12_x86_64:
+ reg_value.SetUInt64(m_context.R12);
+ break;
+ case lldb_r13_x86_64:
+ reg_value.SetUInt64(m_context.R13);
+ break;
+ case lldb_r14_x86_64:
+ reg_value.SetUInt64(m_context.R14);
+ break;
+ case lldb_r15_x86_64:
+ reg_value.SetUInt64(m_context.R15);
+ break;
+ case lldb_rbp_x86_64:
+ reg_value.SetUInt64(m_context.Rbp);
+ break;
+ case lldb_rsp_x86_64:
+ reg_value.SetUInt64(m_context.Rsp);
+ break;
+ case lldb_rip_x86_64:
+ reg_value.SetUInt64(m_context.Rip);
+ break;
+ case lldb_rflags_x86_64:
+ reg_value.SetUInt64(m_context.EFlags);
+ break;
+ }
+ return true;
}
-bool
-RegisterContextWindows_x64::WriteRegister(const RegisterInfo *reg_info, const RegisterValue &reg_value)
-{
- // Since we cannot only write a single register value to the inferior, we need to make sure
- // our cached copy of the register values are fresh. Otherwise when writing EAX, for example,
- // we may also overwrite some other register with a stale value.
- if (!CacheAllRegisterValues())
- return false;
+bool RegisterContextWindows_x64::WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue &reg_value) {
+ // Since we cannot only write a single register value to the inferior, we need
+ // to make sure
+ // our cached copy of the register values are fresh. Otherwise when writing
+ // EAX, for example,
+ // we may also overwrite some other register with a stale value.
+ if (!CacheAllRegisterValues())
+ return false;
- switch (reg_info->kinds[eRegisterKindLLDB])
- {
- case lldb_rax_x86_64:
- m_context.Rax = reg_value.GetAsUInt64();
- break;
- case lldb_rbx_x86_64:
- m_context.Rbx = reg_value.GetAsUInt64();
- break;
- case lldb_rcx_x86_64:
- m_context.Rcx = reg_value.GetAsUInt64();
- break;
- case lldb_rdx_x86_64:
- m_context.Rdx = reg_value.GetAsUInt64();
- break;
- case lldb_rdi_x86_64:
- m_context.Rdi = reg_value.GetAsUInt64();
- break;
- case lldb_rsi_x86_64:
- m_context.Rsi = reg_value.GetAsUInt64();
- break;
- case lldb_r8_x86_64:
- m_context.R8 = reg_value.GetAsUInt64();
- break;
- case lldb_r9_x86_64:
- m_context.R9 = reg_value.GetAsUInt64();
- break;
- case lldb_r10_x86_64:
- m_context.R10 = reg_value.GetAsUInt64();
- break;
- case lldb_r11_x86_64:
- m_context.R11 = reg_value.GetAsUInt64();
- break;
- case lldb_r12_x86_64:
- m_context.R12 = reg_value.GetAsUInt64();
- break;
- case lldb_r13_x86_64:
- m_context.R13 = reg_value.GetAsUInt64();
- break;
- case lldb_r14_x86_64:
- m_context.R14 = reg_value.GetAsUInt64();
- break;
- case lldb_r15_x86_64:
- m_context.R15 = reg_value.GetAsUInt64();
- break;
- case lldb_rbp_x86_64:
- m_context.Rbp = reg_value.GetAsUInt64();
- break;
- case lldb_rsp_x86_64:
- m_context.Rsp = reg_value.GetAsUInt64();
- break;
- case lldb_rip_x86_64:
- m_context.Rip = reg_value.GetAsUInt64();
- break;
- case lldb_rflags_x86_64:
- m_context.EFlags = reg_value.GetAsUInt64();
- break;
- }
+ switch (reg_info->kinds[eRegisterKindLLDB]) {
+ case lldb_rax_x86_64:
+ m_context.Rax = reg_value.GetAsUInt64();
+ break;
+ case lldb_rbx_x86_64:
+ m_context.Rbx = reg_value.GetAsUInt64();
+ break;
+ case lldb_rcx_x86_64:
+ m_context.Rcx = reg_value.GetAsUInt64();
+ break;
+ case lldb_rdx_x86_64:
+ m_context.Rdx = reg_value.GetAsUInt64();
+ break;
+ case lldb_rdi_x86_64:
+ m_context.Rdi = reg_value.GetAsUInt64();
+ break;
+ case lldb_rsi_x86_64:
+ m_context.Rsi = reg_value.GetAsUInt64();
+ break;
+ case lldb_r8_x86_64:
+ m_context.R8 = reg_value.GetAsUInt64();
+ break;
+ case lldb_r9_x86_64:
+ m_context.R9 = reg_value.GetAsUInt64();
+ break;
+ case lldb_r10_x86_64:
+ m_context.R10 = reg_value.GetAsUInt64();
+ break;
+ case lldb_r11_x86_64:
+ m_context.R11 = reg_value.GetAsUInt64();
+ break;
+ case lldb_r12_x86_64:
+ m_context.R12 = reg_value.GetAsUInt64();
+ break;
+ case lldb_r13_x86_64:
+ m_context.R13 = reg_value.GetAsUInt64();
+ break;
+ case lldb_r14_x86_64:
+ m_context.R14 = reg_value.GetAsUInt64();
+ break;
+ case lldb_r15_x86_64:
+ m_context.R15 = reg_value.GetAsUInt64();
+ break;
+ case lldb_rbp_x86_64:
+ m_context.Rbp = reg_value.GetAsUInt64();
+ break;
+ case lldb_rsp_x86_64:
+ m_context.Rsp = reg_value.GetAsUInt64();
+ break;
+ case lldb_rip_x86_64:
+ m_context.Rip = reg_value.GetAsUInt64();
+ break;
+ case lldb_rflags_x86_64:
+ m_context.EFlags = reg_value.GetAsUInt64();
+ break;
+ }
- // Physically update the registers in the target process.
- TargetThreadWindows &wthread = static_cast<TargetThreadWindows &>(m_thread);
- return ::SetThreadContext(wthread.GetHostThread().GetNativeThread().GetSystemHandle(), &m_context);
+ // Physically update the registers in the target process.
+ TargetThreadWindows &wthread = static_cast<TargetThreadWindows &>(m_thread);
+ return ::SetThreadContext(
+ wthread.GetHostThread().GetNativeThread().GetSystemHandle(), &m_context);
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.h b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.h
index e69179d99c6..62cedc8fbab 100644
--- a/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.h
+++ b/lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.h
@@ -10,38 +10,38 @@
#ifndef liblldb_RegisterContextWindows_x64_H_
#define liblldb_RegisterContextWindows_x64_H_
-#include "lldb/lldb-forward.h"
#include "RegisterContextWindows.h"
+#include "lldb/lldb-forward.h"
-namespace lldb_private
-{
+namespace lldb_private {
class Thread;
-class RegisterContextWindows_x64 : public RegisterContextWindows
-{
- public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- RegisterContextWindows_x64(Thread &thread, uint32_t concrete_frame_idx);
+class RegisterContextWindows_x64 : public RegisterContextWindows {
+public:
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ RegisterContextWindows_x64(Thread &thread, uint32_t concrete_frame_idx);
- virtual ~RegisterContextWindows_x64();
+ virtual ~RegisterContextWindows_x64();
- //------------------------------------------------------------------
- // Subclasses must override these functions
- //------------------------------------------------------------------
- size_t GetRegisterCount() override;
+ //------------------------------------------------------------------
+ // Subclasses must override these functions
+ //------------------------------------------------------------------
+ size_t GetRegisterCount() override;
- const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
+ const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
- size_t GetRegisterSetCount() override;
+ size_t GetRegisterSetCount() override;
- const RegisterSet *GetRegisterSet(size_t reg_set) override;
+ const RegisterSet *GetRegisterSet(size_t reg_set) override;
- bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value) override;
+ bool ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &reg_value) override;
- bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue &reg_value) override;
+ bool WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue &reg_value) override;
};
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp
index 11733eee7cb..04b6ab317ca 100644
--- a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp
@@ -7,16 +7,16 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-private-types.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Host/windows/HostThreadWindows.h"
#include "lldb/Host/windows/windows.h"
+#include "lldb/lldb-private-types.h"
-#include "lldb-x86-register-enums.h"
#include "ProcessWindowsLog.h"
-#include "RegisterContext_x86.h"
#include "RegisterContextWindows_x86.h"
+#include "RegisterContext_x86.h"
+#include "lldb-x86-register-enums.h"
#include "llvm/ADT/STLExtras.h"
@@ -26,150 +26,178 @@ using namespace lldb_private;
#define DEFINE_GPR(reg, alt) #reg, alt, 4, 0, eEncodingUint, eFormatHexUppercase
#define DEFINE_GPR_BIN(reg, alt) #reg, alt, 4, 0, eEncodingUint, eFormatBinary
-namespace
-{
+namespace {
-// This enum defines the layout of the global RegisterInfo array. This is necessary because
-// lldb register sets are defined in terms of indices into the register array. As such, the
-// order of RegisterInfos defined in global registers array must match the order defined here.
-// When defining the register set layouts, these values can appear in an arbitrary order, and that
+// This enum defines the layout of the global RegisterInfo array. This is
+// necessary because
+// lldb register sets are defined in terms of indices into the register array.
+// As such, the
+// order of RegisterInfos defined in global registers array must match the order
+// defined here.
+// When defining the register set layouts, these values can appear in an
+// arbitrary order, and that
// determines the order that register values are displayed in a dump.
-enum RegisterIndex
-{
- eRegisterIndexEax,
- eRegisterIndexEbx,
- eRegisterIndexEcx,
- eRegisterIndexEdx,
- eRegisterIndexEdi,
- eRegisterIndexEsi,
- eRegisterIndexEbp,
- eRegisterIndexEsp,
- eRegisterIndexEip,
- eRegisterIndexEflags
+enum RegisterIndex {
+ eRegisterIndexEax,
+ eRegisterIndexEbx,
+ eRegisterIndexEcx,
+ eRegisterIndexEdx,
+ eRegisterIndexEdi,
+ eRegisterIndexEsi,
+ eRegisterIndexEbp,
+ eRegisterIndexEsp,
+ eRegisterIndexEip,
+ eRegisterIndexEflags
};
// Array of all register information supported by Windows x86
-RegisterInfo g_register_infos[] =
-{
-// Macro auto defines most stuff eh_frame DWARF GENERIC GDB LLDB VALUE REGS INVALIDATE REGS
-// ============================== ======================= =================== ========================= =================== ================= ========== ===============
- { DEFINE_GPR(eax, nullptr), { ehframe_eax_i386, dwarf_eax_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_eax_i386 }, nullptr, nullptr},
- { DEFINE_GPR(ebx, nullptr), { ehframe_ebx_i386, dwarf_ebx_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_ebx_i386 }, nullptr, nullptr},
- { DEFINE_GPR(ecx, nullptr), { ehframe_ecx_i386, dwarf_ecx_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_ecx_i386 }, nullptr, nullptr},
- { DEFINE_GPR(edx, nullptr), { ehframe_edx_i386, dwarf_edx_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_edx_i386 }, nullptr, nullptr},
- { DEFINE_GPR(edi, nullptr), { ehframe_edi_i386, dwarf_edi_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_edi_i386 }, nullptr, nullptr},
- { DEFINE_GPR(esi, nullptr), { ehframe_esi_i386, dwarf_esi_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_esi_i386 }, nullptr, nullptr},
- { DEFINE_GPR(ebp, "fp"), { ehframe_ebp_i386, dwarf_ebp_i386, LLDB_REGNUM_GENERIC_FP, LLDB_INVALID_REGNUM, lldb_ebp_i386 }, nullptr, nullptr},
- { DEFINE_GPR(esp, "sp"), { ehframe_esp_i386, dwarf_esp_i386, LLDB_REGNUM_GENERIC_SP, LLDB_INVALID_REGNUM, lldb_esp_i386 }, nullptr, nullptr},
- { DEFINE_GPR(eip, "pc"), { ehframe_eip_i386, dwarf_eip_i386, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM, lldb_eip_i386 }, nullptr, nullptr},
- { DEFINE_GPR_BIN(eflags, "flags"), { ehframe_eflags_i386, dwarf_eflags_i386, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM, lldb_eflags_i386}, nullptr, nullptr},
+RegisterInfo g_register_infos[] = {
+ // Macro auto defines most stuff eh_frame DWARF
+ // GENERIC GDB LLDB
+ // VALUE REGS INVALIDATE REGS
+ // ============================== =======================
+ // =================== ========================= ===================
+ // ================= ========== ===============
+ {DEFINE_GPR(eax, nullptr),
+ {ehframe_eax_i386, dwarf_eax_i386, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_eax_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(ebx, nullptr),
+ {ehframe_ebx_i386, dwarf_ebx_i386, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_ebx_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(ecx, nullptr),
+ {ehframe_ecx_i386, dwarf_ecx_i386, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_ecx_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(edx, nullptr),
+ {ehframe_edx_i386, dwarf_edx_i386, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_edx_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(edi, nullptr),
+ {ehframe_edi_i386, dwarf_edi_i386, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_edi_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(esi, nullptr),
+ {ehframe_esi_i386, dwarf_esi_i386, LLDB_INVALID_REGNUM,
+ LLDB_INVALID_REGNUM, lldb_esi_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(ebp, "fp"),
+ {ehframe_ebp_i386, dwarf_ebp_i386, LLDB_REGNUM_GENERIC_FP,
+ LLDB_INVALID_REGNUM, lldb_ebp_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(esp, "sp"),
+ {ehframe_esp_i386, dwarf_esp_i386, LLDB_REGNUM_GENERIC_SP,
+ LLDB_INVALID_REGNUM, lldb_esp_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR(eip, "pc"),
+ {ehframe_eip_i386, dwarf_eip_i386, LLDB_REGNUM_GENERIC_PC,
+ LLDB_INVALID_REGNUM, lldb_eip_i386},
+ nullptr,
+ nullptr},
+ {DEFINE_GPR_BIN(eflags, "flags"),
+ {ehframe_eflags_i386, dwarf_eflags_i386, LLDB_REGNUM_GENERIC_FLAGS,
+ LLDB_INVALID_REGNUM, lldb_eflags_i386},
+ nullptr,
+ nullptr},
};
static size_t k_num_register_infos = llvm::array_lengthof(g_register_infos);
-// Array of lldb register numbers used to define the set of all General Purpose Registers
-uint32_t g_gpr_reg_indices[] =
-{
- eRegisterIndexEax,
- eRegisterIndexEbx,
- eRegisterIndexEcx,
- eRegisterIndexEdx,
- eRegisterIndexEdi,
- eRegisterIndexEsi,
- eRegisterIndexEbp,
- eRegisterIndexEsp,
- eRegisterIndexEip,
- eRegisterIndexEflags
-};
+// Array of lldb register numbers used to define the set of all General Purpose
+// Registers
+uint32_t g_gpr_reg_indices[] = {eRegisterIndexEax, eRegisterIndexEbx,
+ eRegisterIndexEcx, eRegisterIndexEdx,
+ eRegisterIndexEdi, eRegisterIndexEsi,
+ eRegisterIndexEbp, eRegisterIndexEsp,
+ eRegisterIndexEip, eRegisterIndexEflags};
RegisterSet g_register_sets[] = {
- {"General Purpose Registers", "gpr", llvm::array_lengthof(g_gpr_reg_indices), g_gpr_reg_indices},
+ {"General Purpose Registers", "gpr",
+ llvm::array_lengthof(g_gpr_reg_indices), g_gpr_reg_indices},
};
}
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
-RegisterContextWindows_x86::RegisterContextWindows_x86(Thread &thread, uint32_t concrete_frame_idx)
- : RegisterContextWindows(thread, concrete_frame_idx)
-{
-}
+RegisterContextWindows_x86::RegisterContextWindows_x86(
+ Thread &thread, uint32_t concrete_frame_idx)
+ : RegisterContextWindows(thread, concrete_frame_idx) {}
-RegisterContextWindows_x86::~RegisterContextWindows_x86()
-{
-}
+RegisterContextWindows_x86::~RegisterContextWindows_x86() {}
-size_t
-RegisterContextWindows_x86::GetRegisterCount()
-{
- return llvm::array_lengthof(g_register_infos);
+size_t RegisterContextWindows_x86::GetRegisterCount() {
+ return llvm::array_lengthof(g_register_infos);
}
const RegisterInfo *
-RegisterContextWindows_x86::GetRegisterInfoAtIndex(size_t reg)
-{
- if (reg < k_num_register_infos)
- return &g_register_infos[reg];
- return NULL;
+RegisterContextWindows_x86::GetRegisterInfoAtIndex(size_t reg) {
+ if (reg < k_num_register_infos)
+ return &g_register_infos[reg];
+ return NULL;
}
-size_t
-RegisterContextWindows_x86::GetRegisterSetCount()
-{
- return llvm::array_lengthof(g_register_sets);
+size_t RegisterContextWindows_x86::GetRegisterSetCount() {
+ return llvm::array_lengthof(g_register_sets);
}
-const RegisterSet *
-RegisterContextWindows_x86::GetRegisterSet(size_t reg_set)
-{
- return &g_register_sets[reg_set];
+const RegisterSet *RegisterContextWindows_x86::GetRegisterSet(size_t reg_set) {
+ return &g_register_sets[reg_set];
}
-bool
-RegisterContextWindows_x86::ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value)
-{
- if (!CacheAllRegisterValues())
- return false;
-
- uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
- switch (reg)
- {
- case lldb_eax_i386:
- return ReadRegisterHelper(CONTEXT_INTEGER, "EAX", m_context.Eax, reg_value);
- case lldb_ebx_i386:
- return ReadRegisterHelper(CONTEXT_INTEGER, "EBX", m_context.Ebx, reg_value);
- case lldb_ecx_i386:
- return ReadRegisterHelper(CONTEXT_INTEGER, "ECX", m_context.Ecx, reg_value);
- case lldb_edx_i386:
- return ReadRegisterHelper(CONTEXT_INTEGER, "EDX", m_context.Edx, reg_value);
- case lldb_edi_i386:
- return ReadRegisterHelper(CONTEXT_INTEGER, "EDI", m_context.Edi, reg_value);
- case lldb_esi_i386:
- return ReadRegisterHelper(CONTEXT_INTEGER, "ESI", m_context.Esi, reg_value);
- case lldb_ebp_i386:
- return ReadRegisterHelper(CONTEXT_CONTROL, "EBP", m_context.Ebp, reg_value);
- case lldb_esp_i386:
- return ReadRegisterHelper(CONTEXT_CONTROL, "ESP", m_context.Esp, reg_value);
- case lldb_eip_i386:
- return ReadRegisterHelper(CONTEXT_CONTROL, "EIP", m_context.Eip, reg_value);
- case lldb_eflags_i386:
- return ReadRegisterHelper(CONTEXT_CONTROL, "EFLAGS", m_context.EFlags, reg_value);
- default:
- WINWARN_IFALL(WINDOWS_LOG_REGISTERS, "Requested unknown register %u", reg);
- break;
- }
+bool RegisterContextWindows_x86::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &reg_value) {
+ if (!CacheAllRegisterValues())
return false;
+
+ uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
+ switch (reg) {
+ case lldb_eax_i386:
+ return ReadRegisterHelper(CONTEXT_INTEGER, "EAX", m_context.Eax, reg_value);
+ case lldb_ebx_i386:
+ return ReadRegisterHelper(CONTEXT_INTEGER, "EBX", m_context.Ebx, reg_value);
+ case lldb_ecx_i386:
+ return ReadRegisterHelper(CONTEXT_INTEGER, "ECX", m_context.Ecx, reg_value);
+ case lldb_edx_i386:
+ return ReadRegisterHelper(CONTEXT_INTEGER, "EDX", m_context.Edx, reg_value);
+ case lldb_edi_i386:
+ return ReadRegisterHelper(CONTEXT_INTEGER, "EDI", m_context.Edi, reg_value);
+ case lldb_esi_i386:
+ return ReadRegisterHelper(CONTEXT_INTEGER, "ESI", m_context.Esi, reg_value);
+ case lldb_ebp_i386:
+ return ReadRegisterHelper(CONTEXT_CONTROL, "EBP", m_context.Ebp, reg_value);
+ case lldb_esp_i386:
+ return ReadRegisterHelper(CONTEXT_CONTROL, "ESP", m_context.Esp, reg_value);
+ case lldb_eip_i386:
+ return ReadRegisterHelper(CONTEXT_CONTROL, "EIP", m_context.Eip, reg_value);
+ case lldb_eflags_i386:
+ return ReadRegisterHelper(CONTEXT_CONTROL, "EFLAGS", m_context.EFlags,
+ reg_value);
+ default:
+ WINWARN_IFALL(WINDOWS_LOG_REGISTERS, "Requested unknown register %u", reg);
+ break;
+ }
+ return false;
}
-bool
-RegisterContextWindows_x86::ReadRegisterHelper(DWORD flags_required, const char *reg_name, DWORD value,
- RegisterValue &reg_value) const
-{
- if ((m_context.ContextFlags & flags_required) != flags_required)
- {
- WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Thread context doesn't have %s", reg_name);
- return false;
- }
- WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from %s", value, reg_name);
- reg_value.SetUInt32(value);
- return true;
+bool RegisterContextWindows_x86::ReadRegisterHelper(
+ DWORD flags_required, const char *reg_name, DWORD value,
+ RegisterValue &reg_value) const {
+ if ((m_context.ContextFlags & flags_required) != flags_required) {
+ WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Thread context doesn't have %s",
+ reg_name);
+ return false;
+ }
+ WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from %s", value,
+ reg_name);
+ reg_value.SetUInt32(value);
+ return true;
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h
index 6c29d54dcae..1e3910b5edd 100644
--- a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h
+++ b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h
@@ -10,42 +10,40 @@
#ifndef liblldb_RegisterContextWindows_x86_H_
#define liblldb_RegisterContextWindows_x86_H_
-#include "lldb/lldb-forward.h"
#include "RegisterContextWindows.h"
+#include "lldb/lldb-forward.h"
-namespace lldb_private
-{
+namespace lldb_private {
class Thread;
-class RegisterContextWindows_x86 : public RegisterContextWindows
-{
- public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- RegisterContextWindows_x86(Thread &thread, uint32_t concrete_frame_idx);
+class RegisterContextWindows_x86 : public RegisterContextWindows {
+public:
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ RegisterContextWindows_x86(Thread &thread, uint32_t concrete_frame_idx);
- virtual ~RegisterContextWindows_x86();
+ virtual ~RegisterContextWindows_x86();
- //------------------------------------------------------------------
- // Subclasses must override these functions
- //------------------------------------------------------------------
- size_t GetRegisterCount() override;
+ //------------------------------------------------------------------
+ // Subclasses must override these functions
+ //------------------------------------------------------------------
+ size_t GetRegisterCount() override;
- const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
+ const RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
- size_t GetRegisterSetCount() override;
+ size_t GetRegisterSetCount() override;
- const RegisterSet *GetRegisterSet(size_t reg_set) override;
+ const RegisterSet *GetRegisterSet(size_t reg_set) override;
- bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value) override;
+ bool ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &reg_value) override;
private:
- bool
- ReadRegisterHelper(DWORD flags_required, const char *reg_name, DWORD value, RegisterValue &reg_value) const;
+ bool ReadRegisterHelper(DWORD flags_required, const char *reg_name,
+ DWORD value, RegisterValue &reg_value) const;
};
-
}
#endif // #ifndef liblldb_RegisterContextWindows_x86_H_
OpenPOWER on IntegriCloud