LLDB  mainline
HostNativeThreadBase.cpp
Go to the documentation of this file.
1 //===-- HostNativeThreadBase.cpp ------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "lldb/Host/HostInfo.h"
12 #include "lldb/Utility/LLDBLog.h"
13 #include "lldb/Utility/Log.h"
14 
15 #include "llvm/ADT/StringExtras.h"
16 #include "llvm/Support/Threading.h"
17 
18 using namespace lldb;
19 using namespace lldb_private;
20 
21 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
22  : m_thread(thread) {}
23 
25  return m_thread;
26 }
27 
29  return m_result;
30 }
31 
34 }
35 
38  m_result = 0; // NOLINT(modernize-use-nullptr)
39 }
40 
42  return m_thread == thread;
43 }
44 
46  lldb::thread_t result = m_thread;
48  m_result = 0; // NOLINT(modernize-use-nullptr)
49 
50  return result;
51 }
52 
55  std::unique_ptr<ThreadLauncher::HostThreadCreateInfo> info_up(
57  llvm::set_thread_name(info_up->thread_name);
58 
59  Log *log = GetLog(LLDBLog::Thread);
60  LLDB_LOGF(log, "thread created");
61 
62  return info_up->impl();
63 }
lldb_private::HostNativeThreadBase::GetResult
lldb::thread_result_t GetResult() const
Definition: HostNativeThreadBase.cpp:28
lldb_private::HostNativeThreadBase::ThreadCreateTrampoline
static lldb::thread_result_t THREAD_ROUTINE ThreadCreateTrampoline(lldb::thread_arg_t arg)
Definition: HostNativeThreadBase.cpp:54
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:343
ThreadLauncher.h
HostNativeThreadBase.h
lldb::thread_t
pthread_t thread_t
Definition: lldb-types.h:58
Log.h
lldb_private::LLDBLog::Thread
@ Thread
HostInfo.h
lldb_private::HostNativeThreadBase::GetSystemHandle
lldb::thread_t GetSystemHandle() const
Definition: HostNativeThreadBase.cpp:24
lldb::thread_arg_t
void * thread_arg_t
Definition: lldb-types.h:61
lldb_private::HostNativeThreadBase::Release
lldb::thread_t Release()
Definition: HostNativeThreadBase.cpp:45
lldb_private::HostNativeThreadBase::IsJoinable
virtual bool IsJoinable() const
Definition: HostNativeThreadBase.cpp:32
lldb_private::ThreadLauncher::HostThreadCreateInfo
Definition: ThreadLauncher.h:30
lldb::thread_result_t
void * thread_result_t
Definition: lldb-types.h:62
lldb_private::HostNativeThreadBase::m_result
lldb::thread_result_t m_result
Definition: HostNativeThreadBase.h:49
lldb_private::HostNativeThreadBase::Reset
virtual void Reset()
Definition: HostNativeThreadBase.cpp:36
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::HostNativeThreadBase::EqualsThread
virtual bool EqualsThread(lldb::thread_t thread) const
Definition: HostNativeThreadBase.cpp:41
lldb_private::Log
Definition: Log.h:115
lldb_private::HostNativeThreadBase::m_thread
lldb::thread_t m_thread
Definition: HostNativeThreadBase.h:48
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:308
lldb
Definition: SBAddress.h:15
LLDBLog.h
LLDB_INVALID_HOST_THREAD
#define LLDB_INVALID_HOST_THREAD
Definition: lldb-types.h:79