1//===-- ThreadMachCore.h ----------------------------------------*- C++ -*-===//
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#ifndef LLDB_SOURCE_PLUGINS_PROCESS_MACH_CORE_THREADMACHCORE_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_MACH_CORE_THREADMACHCORE_H
11
12#include <string>
13
14#include "lldb/Target/Thread.h"
15
16class ProcessMachCore;
17
18class ThreadMachCore : public lldb_private::Thread {
19public:
20 ThreadMachCore(lldb_private::Process &process, lldb::tid_t tid,
21 uint32_t objfile_lc_thread_idx);
22
23 ~ThreadMachCore() override;
24
25 void RefreshStateAfterStop() override;
26
27 const char *GetName() override;
28
29 lldb::RegisterContextSP GetRegisterContext() override;
30
31 lldb::RegisterContextSP
32 CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override;
33
34 static bool ThreadIDIsValid(lldb::tid_t thread);
35
36 bool ShouldStop(bool &step_more);
37
38 const char *GetBasicInfoAsString();
39
40 void SetName(const char *name) override {
41 if (name && name[0])
42 m_thread_name.assign(s: name);
43 else
44 m_thread_name.clear();
45 }
46
47 lldb::addr_t GetThreadDispatchQAddr() { return m_thread_dispatch_qaddr; }
48
49 void SetThreadDispatchQAddr(lldb::addr_t thread_dispatch_qaddr) {
50 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
51 }
52
53protected:
54 friend class ProcessMachCore;
55
56 // Member variables.
57 std::string m_thread_name;
58 std::string m_dispatch_queue_name;
59 lldb::addr_t m_thread_dispatch_qaddr;
60 lldb::RegisterContextSP m_thread_reg_ctx_sp;
61 uint32_t m_objfile_lc_thread_idx;
62
63 // Protected member functions.
64 bool CalculateStopInfo() override;
65};
66
67#endif // LLDB_SOURCE_PLUGINS_PROCESS_MACH_CORE_THREADMACHCORE_H
68

source code of lldb/source/Plugins/Process/mach-core/ThreadMachCore.h