Coverage Report

Created: 2023-09-21 18:56

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Host/common/HostNativeThreadBase.cpp
Line
Count
Source (jump to first uncovered line)
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
9
#include "lldb/Host/HostNativeThreadBase.h"
10
#include "lldb/Host/HostInfo.h"
11
#include "lldb/Host/ThreadLauncher.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
7.95k
    : m_thread(thread) {}
23
24
0
lldb::thread_t HostNativeThreadBase::GetSystemHandle() const {
25
0
  return m_thread;
26
0
}
27
28
0
lldb::thread_result_t HostNativeThreadBase::GetResult() const {
29
0
  return m_result;
30
0
}
31
32
1.58M
bool HostNativeThreadBase::IsJoinable() const {
33
1.58M
  return m_thread != LLDB_INVALID_HOST_THREAD;
34
1.58M
}
35
36
12.0k
void HostNativeThreadBase::Reset() {
37
12.0k
  m_thread = LLDB_INVALID_HOST_THREAD;
38
12.0k
  m_result = 0; // NOLINT(modernize-use-nullptr)
39
12.0k
}
40
41
1.53M
bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const {
42
1.53M
  return m_thread == thread;
43
1.53M
}
44
45
0
lldb::thread_t HostNativeThreadBase::Release() {
46
0
  lldb::thread_t result = m_thread;
47
0
  m_thread = LLDB_INVALID_HOST_THREAD;
48
0
  m_result = 0; // NOLINT(modernize-use-nullptr)
49
50
0
  return result;
51
0
}
52
53
lldb::thread_result_t
54
7.41k
HostNativeThreadBase::ThreadCreateTrampoline(lldb::thread_arg_t arg) {
55
7.41k
  std::unique_ptr<ThreadLauncher::HostThreadCreateInfo> info_up(
56
7.41k
      (ThreadLauncher::HostThreadCreateInfo *)arg);
57
7.41k
  llvm::set_thread_name(info_up->thread_name);
58
59
7.41k
  Log *log = GetLog(LLDBLog::Thread);
60
7.41k
  LLDB_LOGF(log, "thread created");
61
62
7.41k
  return info_up->impl();
63
7.41k
}