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