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