diff options
author | Pavel Labath <labath@google.com> | 2017-03-17 09:51:23 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-03-17 09:51:23 +0000 |
commit | 225b79524de987d810f4085e6a1bf61a289e4adf (patch) | |
tree | ce526121fcde21c1dd730c01c9629b3d3a465d3e /lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | |
parent | c7c9b75804e8cd0f25b421fc5146213dc482e95b (diff) | |
download | llvm-225b79524de987d810f4085e6a1bf61a289e4adf.zip llvm-225b79524de987d810f4085e6a1bf61a289e4adf.tar.gz llvm-225b79524de987d810f4085e6a1bf61a289e4adf.tar.bz2 |
Remove HostThreadLinux/Free/NetBSD
Summary:
These classes existed only because of the GetName() static function,
which can be moved to a more natural place anyway. I move the linux
version to NativeProcessLinux (and get rid of ProcFileReader), the
freebsd version to ProcessFreeBSD (and fix a bug where it was using the
current process ID, instead of the inferior pid), and remove the NetBSD
version (which was probably incorrect anyway, as it assumes the current
process instead of the inferior.
I also add an llgs test to that verifies thread names are read
correctly.
Reviewers: zturner, krytarowski, emaste
Subscribers: lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D30981
llvm-svn: 298058
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index f97816e..04b6fe6 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/State.h" #include "lldb/Host/HostNativeThread.h" #include "lldb/Host/linux/Ptrace.h" +#include "lldb/Host/linux/Support.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" #include "lldb/lldb-enumerations.h" @@ -90,15 +91,12 @@ NativeThreadLinux::NativeThreadLinux(NativeProcessLinux *process, m_stop_info(), m_reg_context_sp(), m_stop_description() {} std::string NativeThreadLinux::GetName() { - NativeProcessProtocolSP process_sp = m_process_wp.lock(); - if (!process_sp) - return "<unknown: no process>"; - - // const NativeProcessLinux *const process = - // reinterpret_cast<NativeProcessLinux*> (process_sp->get ()); - llvm::SmallString<32> thread_name; - HostNativeThread::GetName(GetID(), thread_name); - return thread_name.c_str(); + NativeProcessLinux &process = GetProcess(); + + auto BufferOrError = getProcFile(process.GetID(), GetID(), "comm"); + if (!BufferOrError) + return ""; + return BufferOrError.get()->getBuffer().rtrim('\n'); } lldb::StateType NativeThreadLinux::GetState() { return m_state; } |