]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
Merge llvm, clang, lld and lldb trunk r300890, and update build glue.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / NetBSD / NativeThreadNetBSD.h
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 #include <map>
16 #include <string>
17
18 namespace lldb_private {
19 namespace process_netbsd {
20
21 class NativeProcessNetBSD;
22
23 class NativeThreadNetBSD : public NativeThreadProtocol {
24   friend class NativeProcessNetBSD;
25
26 public:
27   NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
28
29   // ---------------------------------------------------------------------
30   // NativeThreadProtocol Interface
31   // ---------------------------------------------------------------------
32   std::string GetName() override;
33
34   lldb::StateType GetState() override;
35
36   bool GetStopReason(ThreadStopInfo &stop_info,
37                      std::string &description) override;
38
39   NativeRegisterContextSP GetRegisterContext() override;
40
41   Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
42                       bool hardware) override;
43
44   Error RemoveWatchpoint(lldb::addr_t addr) override;
45
46   Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
47
48   Error RemoveHardwareBreakpoint(lldb::addr_t addr) override;
49
50 private:
51   // ---------------------------------------------------------------------
52   // Interface for friend classes
53   // ---------------------------------------------------------------------
54
55   void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
56   void SetStoppedByBreakpoint();
57   void SetStoppedByTrace();
58   void SetStoppedByExec();
59   void SetStoppedByWatchpoint(uint32_t wp_index);
60   void SetStopped();
61   void SetRunning();
62   void SetStepping();
63
64   // ---------------------------------------------------------------------
65   // Member Variables
66   // ---------------------------------------------------------------------
67   lldb::StateType m_state;
68   ThreadStopInfo m_stop_info;
69   NativeRegisterContextSP m_reg_context_sp;
70   std::string m_stop_description;
71   using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
72   WatchpointIndexMap m_watchpoint_index_map;
73   WatchpointIndexMap m_hw_break_index_map;
74 };
75
76 typedef std::shared_ptr<NativeThreadNetBSD> NativeThreadNetBSDSP;
77 } // namespace process_netbsd
78 } // namespace lldb_private
79
80 #endif // #ifndef liblldb_NativeThreadNetBSD_H_