]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/common/NativeThreadProtocol.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / common / NativeThreadProtocol.h
1 //===-- NativeThreadProtocol.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_NativeThreadProtocol_h_
11 #define liblldb_NativeThreadProtocol_h_
12
13 #include <memory>
14
15 #include "lldb/Host/Debug.h"
16 #include "lldb/lldb-private-forward.h"
17 #include "lldb/lldb-types.h"
18
19 namespace lldb_private {
20 //------------------------------------------------------------------
21 // NativeThreadProtocol
22 //------------------------------------------------------------------
23 class NativeThreadProtocol
24     : public std::enable_shared_from_this<NativeThreadProtocol> {
25 public:
26   NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid);
27
28   virtual ~NativeThreadProtocol() {}
29
30   virtual std::string GetName() = 0;
31
32   virtual lldb::StateType GetState() = 0;
33
34   virtual NativeRegisterContextSP GetRegisterContext() = 0;
35
36   virtual Status ReadRegister(uint32_t reg, RegisterValue &reg_value);
37
38   virtual Status WriteRegister(uint32_t reg, const RegisterValue &reg_value);
39
40   virtual Status SaveAllRegisters(lldb::DataBufferSP &data_sp);
41
42   virtual Status RestoreAllRegisters(lldb::DataBufferSP &data_sp);
43
44   virtual bool GetStopReason(ThreadStopInfo &stop_info,
45                              std::string &description) = 0;
46
47   lldb::tid_t GetID() const { return m_tid; }
48
49   NativeProcessProtocol &GetProcess() { return m_process; }
50
51   // ---------------------------------------------------------------------
52   // Thread-specific watchpoints
53   // ---------------------------------------------------------------------
54   virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
55                                uint32_t watch_flags, bool hardware) = 0;
56
57   virtual Status RemoveWatchpoint(lldb::addr_t addr) = 0;
58
59   // ---------------------------------------------------------------------
60   // Thread-specific Hardware Breakpoint routines
61   // ---------------------------------------------------------------------
62   virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0;
63
64   virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0;
65
66 protected:
67   NativeProcessProtocol &m_process;
68   lldb::tid_t m_tid;
69 };
70 }
71
72 #endif // #ifndef liblldb_NativeThreadProtocol_h_