diff options
8 files changed, 81 insertions, 12 deletions
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 379a08ef19f..f37a312cdfa 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -192,7 +192,7 @@ PlatformLinux::~PlatformLinux() } bool -PlatformLinux::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info) +PlatformLinux::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info) { return Host::GetProcessInfo (pid, process_info); } @@ -247,3 +247,15 @@ PlatformLinux::GetSoftwareBreakpointTrapOpcode (Target &target, bp_site->SetTrapOpcode(opcode, opcode_size); return opcode_size; } + +lldb::ProcessSP +PlatformLinux::Attach(lldb::pid_t pid, + Debugger &debugger, + Target *target, + Listener &listener, + Error &error) +{ + ProcessSP processSP; + assert(!"Not implemented yet!"); + return processSP; +} diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index bb9f62c5955..cbe18eb4055 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -85,7 +85,7 @@ namespace lldb_private { const UUID* uuid, FileSpec &local_file); virtual bool - GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info); + GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info); virtual bool GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch); @@ -94,6 +94,10 @@ namespace lldb_private { GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite *bp_site); + virtual lldb::ProcessSP + Attach(lldb::pid_t pid, Debugger &debugger, Target *target, + Listener &listener, Error &error); + protected: diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index 48a57a8b010..f482c014ee1 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -20,6 +20,7 @@ // C++ Includes // Other libraries and framework includes #include "lldb/Core/Error.h" +#include "lldb/Core/RegisterValue.h" #include "lldb/Core/Scalar.h" #include "lldb/Host/Host.h" #include "lldb/Target/Thread.h" @@ -221,7 +222,7 @@ WriteOperation::Execute(ProcessMonitor *monitor) class ReadRegOperation : public Operation { public: - ReadRegOperation(unsigned offset, Scalar &value, bool &result) + ReadRegOperation(unsigned offset, RegisterValue &value, bool &result) : m_offset(offset), m_value(value), m_result(result) { } @@ -229,7 +230,7 @@ public: private: unsigned m_offset; - Scalar &m_value; + RegisterValue &m_value; bool &m_result; }; @@ -257,7 +258,7 @@ ReadRegOperation::Execute(ProcessMonitor *monitor) class WriteRegOperation : public Operation { public: - WriteRegOperation(unsigned offset, const Scalar &value, bool &result) + WriteRegOperation(unsigned offset, const RegisterValue &value, bool &result) : m_offset(offset), m_value(value), m_result(result) { } @@ -265,7 +266,7 @@ public: private: unsigned m_offset; - const Scalar &m_value; + const RegisterValue &m_value; bool &m_result; }; @@ -274,7 +275,7 @@ WriteRegOperation::Execute(ProcessMonitor *monitor) { lldb::pid_t pid = monitor->GetPID(); - if (ptrace(PTRACE_POKEUSER, pid, m_offset, m_value.ULong())) + if (ptrace(PTRACE_POKEUSER, pid, m_offset, m_value.GetAsUInt64())) m_result = false; else m_result = true; @@ -1097,7 +1098,7 @@ ProcessMonitor::WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, } bool -ProcessMonitor::ReadRegisterValue(unsigned offset, Scalar &value) +ProcessMonitor::ReadRegisterValue(unsigned offset, RegisterValue &value) { bool result; ReadRegOperation op(offset, value, result); @@ -1106,7 +1107,7 @@ ProcessMonitor::ReadRegisterValue(unsigned offset, Scalar &value) } bool -ProcessMonitor::WriteRegisterValue(unsigned offset, const Scalar &value) +ProcessMonitor::WriteRegisterValue(unsigned offset, const RegisterValue &value) { bool result; WriteRegOperation op(offset, value, result); diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.h b/lldb/source/Plugins/Process/Linux/ProcessMonitor.h index 1bfdb862d88..0f2f61c8d58 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.h +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.h @@ -100,14 +100,14 @@ public: /// /// This method is provided for use by RegisterContextLinux derivatives. bool - ReadRegisterValue(unsigned offset, lldb_private::Scalar &value); + ReadRegisterValue(unsigned offset, lldb_private::RegisterValue &value); /// Writes the given value to the register identified by the given /// (architecture dependent) offset. /// /// This method is provided for use by RegisterContextLinux derivatives. bool - WriteRegisterValue(unsigned offset, const lldb_private::Scalar &value); + WriteRegisterValue(unsigned offset, const lldb_private::RegisterValue &value); /// Reads all general purpose registers into the specified buffer. bool diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp index 6bee0c90906..0a8ec5a1c0d 100644 --- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp +++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp @@ -1,4 +1,4 @@ -//===-- RegisterContextLinux_i386.cpp ----------------------------*- C++ -*-===// +//===-- RegisterContextLinux_i386.cpp ---------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -411,6 +411,17 @@ RegisterContextLinux_i386::GetRegisterSet(uint32_t set) } bool +RegisterContextLinux_i386::ReadRegister(const RegisterInfo *reg_info, + RegisterValue &value) +{ + const uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; + ProcessMonitor &monitor = GetMonitor(); + return monitor.ReadRegisterValue(GetRegOffset(reg), value); +} + +#if 0 + +bool RegisterContextLinux_i386::ReadRegisterValue(uint32_t reg, Scalar &value) { @@ -441,12 +452,16 @@ RegisterContextLinux_i386::ReadRegisterBytes(uint32_t reg, return status; } +#endif + bool RegisterContextLinux_i386::ReadAllRegisterValues(DataBufferSP &data_sp) { return false; } +#if 0 + bool RegisterContextLinux_i386::WriteRegisterValue(uint32_t reg, const Scalar &value) @@ -463,6 +478,14 @@ RegisterContextLinux_i386::WriteRegisterBytes(uint32_t reg, return false; } +#endif + +bool RegisterContextLinux_i386::WriteRegister(const RegisterInfo *reg_info, + const RegisterValue &value) +{ + return false; +} + bool RegisterContextLinux_i386::WriteAllRegisterValues(const DataBufferSP &data) { diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.h b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.h index 890fd88240e..ef3a76b8e0a 100644 --- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.h +++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.h @@ -42,21 +42,33 @@ public: const lldb_private::RegisterSet * GetRegisterSet(uint32_t set); +#if 0 bool ReadRegisterValue(uint32_t reg, lldb_private::Scalar &value); bool ReadRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data); +#endif + + virtual bool + ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value); bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp); +#if 0 bool WriteRegisterValue(uint32_t reg, const lldb_private::Scalar &value); bool WriteRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data, uint32_t data_offset = 0); +#endif + + virtual bool + WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value); bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp); diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp index 27ca5b8690e..012690ffac4 100644 --- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp +++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp @@ -475,6 +475,7 @@ RegisterContextLinux_x86_64::GetRegisterSet(uint32_t set) return NULL; } +#if 0 bool RegisterContextLinux_x86_64::ReadRegisterValue(uint32_t reg, Scalar &value) @@ -506,12 +507,15 @@ RegisterContextLinux_x86_64::ReadRegisterBytes(uint32_t reg, return status; } +#endif + bool RegisterContextLinux_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp) { return false; } +#if 0 bool RegisterContextLinux_x86_64::WriteRegisterValue(uint32_t reg, const Scalar &value) @@ -527,6 +531,7 @@ RegisterContextLinux_x86_64::WriteRegisterBytes(uint32_t reg, { return false; } +#endif bool RegisterContextLinux_x86_64::WriteAllRegisterValues(const DataBufferSP &data) diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h index 48540b4e60a..2d210c61541 100644 --- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h +++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h @@ -41,21 +41,33 @@ public: const lldb_private::RegisterSet * GetRegisterSet(uint32_t set); +#if 0 bool ReadRegisterValue(uint32_t reg, lldb_private::Scalar &value); bool ReadRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data); +#endif + + virtual bool + ReadRegister(const lldb_private::RegisterInfo *reg_info, + lldb_private::RegisterValue &value); bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp); +#if 0 bool WriteRegisterValue(uint32_t reg, const lldb_private::Scalar &value); bool WriteRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data, uint32_t data_offset = 0); +#endif + + virtual bool + WriteRegister(const lldb_private::RegisterInfo *reg_info, + const lldb_private::RegisterValue &value); bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp); |

