1 //===-- NativeThreadNetBSD.h ---------------------------------- -*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_NativeThreadNetBSD_H_
11 #define liblldb_NativeThreadNetBSD_H_
12 
13 #include "lldb/Host/common/NativeThreadProtocol.h"
14 
15 namespace lldb_private {
16 namespace process_netbsd {
17 
18 class NativeProcessNetBSD;
19 
20 class NativeThreadNetBSD : public NativeThreadProtocol {
21   friend class NativeProcessNetBSD;
22 
23 public:
24   NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
25 
26   // ---------------------------------------------------------------------
27   // NativeThreadProtocol Interface
28   // ---------------------------------------------------------------------
29   std::string GetName() override;
30 
31   lldb::StateType GetState() override;
32 
33   bool GetStopReason(ThreadStopInfo &stop_info,
34                      std::string &description) override;
35 
36   NativeRegisterContextSP GetRegisterContext() override;
37 
38   Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
39                       bool hardware) override;
40 
41   Error RemoveWatchpoint(lldb::addr_t addr) override;
42 
43   Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
44 
45   Error RemoveHardwareBreakpoint(lldb::addr_t addr) override;
46 
47 private:
48   // ---------------------------------------------------------------------
49   // Interface for friend classes
50   // ---------------------------------------------------------------------
51 
52   void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
53   void SetStoppedByBreakpoint();
54   void SetStoppedByTrace();
55   void SetStoppedByExec();
56   void SetStopped();
57   void SetRunning();
58   void SetStepping();
59 
60   // ---------------------------------------------------------------------
61   // Member Variables
62   // ---------------------------------------------------------------------
63   lldb::StateType m_state;
64   ThreadStopInfo m_stop_info;
65   NativeRegisterContextSP m_reg_context_sp;
66   std::string m_stop_description;
67 };
68 
69 typedef std::shared_ptr<NativeThreadNetBSD> NativeThreadNetBSDSP;
70 } // namespace process_netbsd
71 } // namespace lldb_private
72 
73 #endif // #ifndef liblldb_NativeThreadNetBSD_H_
74