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:
25   NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid);
26 
~NativeThreadProtocol()27   virtual ~NativeThreadProtocol() {}
28 
29   virtual std::string GetName() = 0;
30 
31   virtual lldb::StateType GetState() = 0;
32 
33   virtual NativeRegisterContext &GetRegisterContext() = 0;
34 
35   virtual bool GetStopReason(ThreadStopInfo &stop_info,
36                              std::string &description) = 0;
37 
GetID()38   lldb::tid_t GetID() const { return m_tid; }
39 
GetProcess()40   NativeProcessProtocol &GetProcess() { return m_process; }
41 
42   // ---------------------------------------------------------------------
43   // Thread-specific watchpoints
44   // ---------------------------------------------------------------------
45   virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
46                                uint32_t watch_flags, bool hardware) = 0;
47 
48   virtual Status RemoveWatchpoint(lldb::addr_t addr) = 0;
49 
50   // ---------------------------------------------------------------------
51   // Thread-specific Hardware Breakpoint routines
52   // ---------------------------------------------------------------------
53   virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0;
54 
55   virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0;
56 
57 protected:
58   NativeProcessProtocol &m_process;
59   lldb::tid_t m_tid;
60 };
61 }
62 
63 #endif // #ifndef liblldb_NativeThreadProtocol_h_
64