1 //===-- ThreadFreeBSDKernel.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_FREEBSDKERNEL_THREADFREEBSDKERNEL_H 10 #define LLDB_SOURCE_PLUGINS_PROCESS_FREEBSDKERNEL_THREADFREEBSDKERNEL_H 11 12 #include "lldb/Target/Thread.h" 13 14 class ThreadFreeBSDKernel : public lldb_private::Thread { 15 public: 16 ThreadFreeBSDKernel(lldb_private::Process &process, lldb::tid_t tid, 17 lldb::addr_t pcb_addr, std::string thread_name); 18 19 ~ThreadFreeBSDKernel() override; 20 21 void RefreshStateAfterStop() override; 22 23 lldb::RegisterContextSP GetRegisterContext() override; 24 25 lldb::RegisterContextSP 26 CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override; 27 GetName()28 const char *GetName() override { 29 if (m_thread_name.empty()) 30 return nullptr; 31 return m_thread_name.c_str(); 32 } 33 SetName(const char * name)34 void SetName(const char *name) override { 35 if (name && name[0]) 36 m_thread_name.assign(name); 37 else 38 m_thread_name.clear(); 39 } 40 41 protected: 42 bool CalculateStopInfo() override; 43 44 private: 45 std::string m_thread_name; 46 lldb::RegisterContextSP m_thread_reg_ctx_sp; 47 lldb::addr_t m_pcb_addr; 48 }; 49 50 #endif // LLDB_SOURCE_PLUGINS_PROCESS_FREEBSDKERNEL_THREADFREEBSDKERNEL_H 51