[Lldb-commits] [lldb] r131313 - in /lldb/trunk/source/Plugins: Platform/Linux/PlatformLinux.cpp Platform/Linux/PlatformLinux.h Process/Linux/ProcessMonitor.cpp Process/Linux/ProcessMonitor.h Process/Linux/RegisterContextLinux_i386.cpp Process/Linux/RegisterContextLinux_i386.h Process/Linux/RegisterContextLinux_x86_64.cpp Process/Linux/RegisterContextLinux_x86_64.h
Johnny Chen
johnny.chen at apple.com
Fri May 13 14:29:50 PDT 2011
Author: johnny
Date: Fri May 13 16:29:50 2011
New Revision: 131313
URL: http://llvm.org/viewvc/llvm-project?rev=131313&view=rev
Log:
This patch add a "fake" attach waiting for a real implementation and
solve the build break due to the lack of this method.
It also propose a solution to the API changes in RegisterContext.
I upgraded also the the python version in the makefile. My linux
installation has python2.7 and AFAIK also the latest ubuntu
has this version of python so maybe is worth upgrading.
Patch by Marco Minutoli <mminutoli at gmail.com>
[Note: I had to hand merge in the diffs since patch thinks it is a corrupt patch.]
Modified:
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h
lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp
lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.h
lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Fri May 13 16:29:50 2011
@@ -192,7 +192,7 @@
}
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 @@
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;
+}
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h Fri May 13 16:29:50 2011
@@ -85,7 +85,7 @@
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 @@
GetSoftwareBreakpointTrapOpcode (Target &target,
BreakpointSite *bp_site);
+ virtual lldb::ProcessSP
+ Attach(lldb::pid_t pid, Debugger &debugger, Target *target,
+ Listener &listener, Error &error);
+
protected:
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Fri May 13 16:29:50 2011
@@ -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 @@
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 @@
private:
unsigned m_offset;
- Scalar &m_value;
+ RegisterValue &m_value;
bool &m_result;
};
@@ -257,7 +258,7 @@
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 @@
private:
unsigned m_offset;
- const Scalar &m_value;
+ const RegisterValue &m_value;
bool &m_result;
};
@@ -274,7 +275,7 @@
{
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 @@
}
bool
-ProcessMonitor::ReadRegisterValue(unsigned offset, Scalar &value)
+ProcessMonitor::ReadRegisterValue(unsigned offset, RegisterValue &value)
{
bool result;
ReadRegOperation op(offset, value, result);
@@ -1106,7 +1107,7 @@
}
bool
-ProcessMonitor::WriteRegisterValue(unsigned offset, const Scalar &value)
+ProcessMonitor::WriteRegisterValue(unsigned offset, const RegisterValue &value)
{
bool result;
WriteRegOperation op(offset, value, result);
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.h Fri May 13 16:29:50 2011
@@ -100,14 +100,14 @@
///
/// 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
Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp Fri May 13 16:29:50 2011
@@ -1,4 +1,4 @@
-//===-- RegisterContextLinux_i386.cpp ----------------------------*- C++ -*-===//
+//===-- RegisterContextLinux_i386.cpp ---------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -411,6 +411,17 @@
}
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 @@
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 @@
return false;
}
+#endif
+
+bool RegisterContextLinux_i386::WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue &value)
+{
+ return false;
+}
+
bool
RegisterContextLinux_i386::WriteAllRegisterValues(const DataBufferSP &data)
{
Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.h?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.h Fri May 13 16:29:50 2011
@@ -42,21 +42,33 @@
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);
Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Fri May 13 16:29:50 2011
@@ -475,6 +475,7 @@
return NULL;
}
+#if 0
bool
RegisterContextLinux_x86_64::ReadRegisterValue(uint32_t reg,
Scalar &value)
@@ -506,12 +507,15 @@
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 @@
{
return false;
}
+#endif
bool
RegisterContextLinux_x86_64::WriteAllRegisterValues(const DataBufferSP &data)
Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h?rev=131313&r1=131312&r2=131313&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h Fri May 13 16:29:50 2011
@@ -41,21 +41,33 @@
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);
More information about the lldb-commits
mailing list