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

source code of lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h