diff options
author | Pavel Labath <labath@google.com> | 2015-07-21 13:20:32 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2015-07-21 13:20:32 +0000 |
commit | 19cbe96a4575ec3ba250914b914b9a0e954308ee (patch) | |
tree | 5c52ab01590881b838358b2cc1d67430a5dd5692 /lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp | |
parent | c7749c3acdedc6e09a302622cd29f4bfe4672f3f (diff) | |
download | bcm5719-llvm-19cbe96a4575ec3ba250914b914b9a0e954308ee.tar.gz bcm5719-llvm-19cbe96a4575ec3ba250914b914b9a0e954308ee.zip |
[NativeProcessLinux] Integrate MainLoop
Summary:
This commit integrates MainLoop into NativeProcessLinux. By registering a SIGCHLD handler with
the llgs main loop, we can get rid of the special monitor thread in NPL, which saves as a lot of
thread ping-pong when responding to client requests (e.g. qThreadInfo processing time has been
reduced by about 40%). It also makes the code simpler, IMHO.
Reviewers: ovyalov, clayborg, tberghammer, chaoren
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D11150
This is a resubmission of r242305 after it was reverted due to bad interactions with the stdio
thread.
llvm-svn: 242783
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp | 68 |
1 files changed, 10 insertions, 58 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp index 41ce680e377..9628b4e6f72 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp @@ -50,14 +50,7 @@ NativeRegisterContextLinux::ReadRegisterRaw(uint32_t reg_index, RegisterValue &r if (!reg_info) return Error("register %" PRIu32 " not found", reg_index); - NativeProcessProtocolSP process_sp(m_thread.GetProcess()); - if (!process_sp) - return Error("NativeProcessProtocol is NULL"); - - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*>(process_sp.get()); - return process_p->DoOperation([&] { - return DoReadRegisterValue(reg_info->byte_offset, reg_info->name, reg_info->byte_size, reg_value); - }); + return DoReadRegisterValue(reg_info->byte_offset, reg_info->name, reg_info->byte_size, reg_value); } Error @@ -108,111 +101,70 @@ 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); - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*> (process_sp.get ()); - return process_p->DoOperation([&] { - return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, reg_value); - }); + 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(); - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*>(process_sp.get()); - return process_p->DoOperation([&] { return DoReadGPR(buf, buf_size); }); + 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(); - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*>(process_sp.get()); - return process_p->DoOperation([&] { return DoWriteGPR(buf, buf_size); }); + 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(); - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*>(process_sp.get()); - return process_p->DoOperation([&] { return DoReadFPR(buf, buf_size); }); + 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(); - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*>(process_sp.get()); - return process_p->DoOperation([&] { return DoWriteFPR(buf, buf_size); }); + return DoWriteFPR(buf, buf_size); } Error NativeRegisterContextLinux::ReadRegisterSet(void *buf, size_t buf_size, unsigned int regset) { - NativeProcessProtocolSP process_sp (m_thread.GetProcess()); - if (!process_sp) - return Error("NativeProcessProtocol is NULL"); - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*>(process_sp.get()); - - return process_p->DoOperation([&] { - return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, m_thread.GetID(), - static_cast<void *>(®set), buf, buf_size); - }); + return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, m_thread.GetID(), + static_cast<void *>(®set), buf, buf_size); } Error NativeRegisterContextLinux::WriteRegisterSet(void *buf, size_t buf_size, unsigned int regset) { - NativeProcessProtocolSP process_sp (m_thread.GetProcess()); - if (!process_sp) - return Error("NativeProcessProtocol is NULL"); - NativeProcessLinux* process_p = static_cast<NativeProcessLinux*>(process_sp.get()); - - return process_p->DoOperation([&] { - return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGSET, m_thread.GetID(), - static_cast<void *>(®set), buf, buf_size); - }); + return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGSET, m_thread.GetID(), + static_cast<void *>(®set), buf, buf_size); } Error |