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/Log.h"
13 
14 #include "llvm/ADT/StringExtras.h"
15 #include "llvm/Support/Threading.h"
16 
17 using namespace lldb;
18 using namespace lldb_private;
19 
20 HostNativeThreadBase::HostNativeThreadBase(thread_t thread)
21  : m_thread(thread), m_result(0) {}
22 
24  return m_thread;
25 }
26 
28  return m_result;
29 }
30 
33 }
34 
37  m_result = 0;
38 }
39 
41  return m_thread == thread;
42 }
43 
45  lldb::thread_t result = m_thread;
47  m_result = 0;
48 
49  return result;
50 }
51 
56  llvm::set_thread_name(info->thread_name);
57 
58  thread_func_t thread_fptr = info->thread_fptr;
59  thread_arg_t thread_arg = info->thread_arg;
60 
62  LLDB_LOGF(log, "thread created");
63 
64  delete info;
65  return thread_fptr(thread_arg);
66 }
lldb_private::HostNativeThreadBase::GetResult
lldb::thread_result_t GetResult() const
Definition: HostNativeThreadBase.cpp:27
lldb::thread_func_t
void *(* thread_func_t)(void *)
Definition: lldb-types.h:63
lldb_private::HostNativeThreadBase::ThreadCreateTrampoline
static lldb::thread_result_t THREAD_ROUTINE ThreadCreateTrampoline(lldb::thread_arg_t arg)
Definition: HostNativeThreadBase.cpp:53
lldb_private::ThreadLauncher::HostThreadCreateInfo::thread_fptr
lldb::thread_func_t thread_fptr
Definition: ThreadLauncher.h:32
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
ThreadLauncher.h
HostNativeThreadBase.h
lldb_private::ThreadLauncher::HostThreadCreateInfo::thread_arg
lldb::thread_arg_t thread_arg
Definition: ThreadLauncher.h:33
lldb::thread_t
pthread_t thread_t
Definition: lldb-types.h:58
Log.h
lldb_private::GetLogIfAllCategoriesSet
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:58
HostInfo.h
lldb_private::HostNativeThreadBase::GetSystemHandle
lldb::thread_t GetSystemHandle() const
Definition: HostNativeThreadBase.cpp:23
lldb::thread_arg_t
void * thread_arg_t
Definition: lldb-types.h:61
lldb_private::HostNativeThreadBase::Release
lldb::thread_t Release()
Definition: HostNativeThreadBase.cpp:44
lldb_private::HostNativeThreadBase::IsJoinable
virtual bool IsJoinable() const
Definition: HostNativeThreadBase.cpp:31
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:35
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:40
lldb_private::Log
Definition: Log.h:49
lldb_private::HostNativeThreadBase::m_thread
lldb::thread_t m_thread
Definition: HostNativeThreadBase.h:48
lldb
Definition: SBAddress.h:15
LIBLLDB_LOG_THREAD
#define LIBLLDB_LOG_THREAD
Definition: Logging.h:16
LLDB_INVALID_HOST_THREAD
#define LLDB_INVALID_HOST_THREAD
Definition: lldb-types.h:79
lldb_private::ThreadLauncher::HostThreadCreateInfo::thread_name
std::string thread_name
Definition: ThreadLauncher.h:31