aboutsummaryrefslogtreecommitdiff
path: root/source/Host/linux/HostThreadLinux.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Host/linux/HostThreadLinux.cpp')
-rw-r--r--source/Host/linux/HostThreadLinux.cpp43
1 files changed, 18 insertions, 25 deletions
diff --git a/source/Host/linux/HostThreadLinux.cpp b/source/Host/linux/HostThreadLinux.cpp
index 2312ced0107b..625f05d0e9d8 100644
--- a/source/Host/linux/HostThreadLinux.cpp
+++ b/source/Host/linux/HostThreadLinux.cpp
@@ -7,9 +7,9 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/DataBuffer.h"
#include "lldb/Host/linux/HostThreadLinux.h"
#include "Plugins/Process/Linux/ProcFileReader.h"
+#include "lldb/Core/DataBuffer.h"
#include "llvm/ADT/SmallVector.h"
@@ -17,36 +17,29 @@
using namespace lldb_private;
-HostThreadLinux::HostThreadLinux()
- : HostThreadPosix()
-{
-}
+HostThreadLinux::HostThreadLinux() : HostThreadPosix() {}
HostThreadLinux::HostThreadLinux(lldb::thread_t thread)
- : HostThreadPosix(thread)
-{
-}
+ : HostThreadPosix(thread) {}
-void
-HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name)
-{
+void HostThreadLinux::SetName(lldb::thread_t thread, llvm::StringRef name) {
#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__)
- ::pthread_setname_np(thread, name.data());
+ ::pthread_setname_np(thread, name.data());
#else
- (void) thread;
- (void) name;
+ (void)thread;
+ (void)name;
#endif
}
-void
-HostThreadLinux::GetName(lldb::thread_t thread, llvm::SmallVectorImpl<char> &name)
-{
- // Read /proc/$TID/comm file.
- lldb::DataBufferSP buf_sp = process_linux::ProcFileReader::ReadIntoDataBuffer(thread, "comm");
- const char *comm_str = (const char *)buf_sp->GetBytes();
- const char *cr_str = ::strchr(comm_str, '\n');
- size_t length = cr_str ? (cr_str - comm_str) : strlen(comm_str);
-
- name.clear();
- name.append(comm_str, comm_str + length);
+void HostThreadLinux::GetName(lldb::thread_t thread,
+ llvm::SmallVectorImpl<char> &name) {
+ // Read /proc/$TID/comm file.
+ lldb::DataBufferSP buf_sp =
+ process_linux::ProcFileReader::ReadIntoDataBuffer(thread, "comm");
+ const char *comm_str = (const char *)buf_sp->GetBytes();
+ const char *cr_str = ::strchr(comm_str, '\n');
+ size_t length = cr_str ? (cr_str - comm_str) : strlen(comm_str);
+
+ name.clear();
+ name.append(comm_str, comm_str + length);
}