From 5abe726911d4e2bf80bbbd93d0a2e2b8064c2fd3 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 16 Jul 2015 08:45:03 +0000 Subject: Revert "[NativeProcessLinux] Integrate MainLoop" This seems to be causing major slowdows on the android buildbot. Reverting while I investigate. llvm-svn: 242391 --- .../Process/Linux/NativeRegisterContextLinux.cpp | 68 ++++++++++++++++++---- 1 file changed, 58 insertions(+), 10 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp index 9628b4e6f723..41ce680e3772 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp @@ -50,7 +50,14 @@ NativeRegisterContextLinux::ReadRegisterRaw(uint32_t reg_index, RegisterValue &r if (!reg_info) return Error("register %" PRIu32 " not found", reg_index); - return DoReadRegisterValue(reg_info->byte_offset, reg_info->name, reg_info->byte_size, reg_value); + NativeProcessProtocolSP process_sp(m_thread.GetProcess()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + + NativeProcessLinux* process_p = static_cast(process_sp.get()); + return process_p->DoOperation([&] { + return DoReadRegisterValue(reg_info->byte_offset, reg_info->name, reg_info->byte_size, reg_value); + }); } Error @@ -101,70 +108,111 @@ NativeRegisterContextLinux::WriteRegisterRaw(uint32_t reg_index, const RegisterV } } + NativeProcessProtocolSP process_sp (m_thread.GetProcess ()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + const RegisterInfo *const register_to_write_info_p = GetRegisterInfoAtIndex (reg_to_write); assert (register_to_write_info_p && "register to write does not have valid RegisterInfo"); if (!register_to_write_info_p) return Error("NativeRegisterContextLinux::%s failed to get RegisterInfo for write register index %" PRIu32, __FUNCTION__, reg_to_write); - return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, reg_value); + NativeProcessLinux* process_p = static_cast (process_sp.get ()); + return process_p->DoOperation([&] { + return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, reg_value); + }); } Error NativeRegisterContextLinux::ReadGPR() { + NativeProcessProtocolSP process_sp (m_thread.GetProcess ()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + void* buf = GetGPRBuffer(); if (!buf) return Error("GPR buffer is NULL"); size_t buf_size = GetGPRSize(); - return DoReadGPR(buf, buf_size); + NativeProcessLinux* process_p = static_cast(process_sp.get()); + return process_p->DoOperation([&] { return DoReadGPR(buf, buf_size); }); } Error NativeRegisterContextLinux::WriteGPR() { + NativeProcessProtocolSP process_sp (m_thread.GetProcess ()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + void* buf = GetGPRBuffer(); if (!buf) return Error("GPR buffer is NULL"); size_t buf_size = GetGPRSize(); - return DoWriteGPR(buf, buf_size); + NativeProcessLinux* process_p = static_cast(process_sp.get()); + return process_p->DoOperation([&] { return DoWriteGPR(buf, buf_size); }); } Error NativeRegisterContextLinux::ReadFPR() { + NativeProcessProtocolSP process_sp (m_thread.GetProcess ()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + void* buf = GetFPRBuffer(); if (!buf) return Error("GPR buffer is NULL"); size_t buf_size = GetFPRSize(); - return DoReadFPR(buf, buf_size); + NativeProcessLinux* process_p = static_cast(process_sp.get()); + return process_p->DoOperation([&] { return DoReadFPR(buf, buf_size); }); } Error NativeRegisterContextLinux::WriteFPR() { + NativeProcessProtocolSP process_sp (m_thread.GetProcess ()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + void* buf = GetFPRBuffer(); if (!buf) return Error("GPR buffer is NULL"); size_t buf_size = GetFPRSize(); - return DoWriteFPR(buf, buf_size); + NativeProcessLinux* process_p = static_cast(process_sp.get()); + return process_p->DoOperation([&] { return DoWriteFPR(buf, buf_size); }); } Error NativeRegisterContextLinux::ReadRegisterSet(void *buf, size_t buf_size, unsigned int regset) { - return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, m_thread.GetID(), - static_cast(®set), buf, buf_size); + NativeProcessProtocolSP process_sp (m_thread.GetProcess()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + NativeProcessLinux* process_p = static_cast(process_sp.get()); + + return process_p->DoOperation([&] { + return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, m_thread.GetID(), + static_cast(®set), buf, buf_size); + }); } Error NativeRegisterContextLinux::WriteRegisterSet(void *buf, size_t buf_size, unsigned int regset) { - return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGSET, m_thread.GetID(), - static_cast(®set), buf, buf_size); + NativeProcessProtocolSP process_sp (m_thread.GetProcess()); + if (!process_sp) + return Error("NativeProcessProtocol is NULL"); + NativeProcessLinux* process_p = static_cast(process_sp.get()); + + return process_p->DoOperation([&] { + return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGSET, m_thread.GetID(), + static_cast(®set), buf, buf_size); + }); } Error -- cgit v1.2.3