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/lldb-private-forward.h" 16 #include "lldb/lldb-types.h" 17 #include "lldb/Host/Debug.h" 18 19 namespace lldb_private 20 { 21 //------------------------------------------------------------------ 22 // NativeThreadProtocol 23 //------------------------------------------------------------------ 24 class NativeThreadProtocol: 25 public std::enable_shared_from_this<NativeThreadProtocol> 26 { 27 public: 28 NativeThreadProtocol (NativeProcessProtocol *process, lldb::tid_t tid); 29 ~NativeThreadProtocol()30 virtual ~NativeThreadProtocol() 31 { 32 } 33 34 virtual std::string 35 GetName() = 0; 36 37 virtual lldb::StateType 38 GetState () = 0; 39 40 virtual NativeRegisterContextSP 41 GetRegisterContext () = 0; 42 43 virtual Error 44 ReadRegister (uint32_t reg, RegisterValue ®_value); 45 46 virtual Error 47 WriteRegister (uint32_t reg, const RegisterValue ®_value); 48 49 virtual Error 50 SaveAllRegisters (lldb::DataBufferSP &data_sp); 51 52 virtual Error 53 RestoreAllRegisters (lldb::DataBufferSP &data_sp); 54 55 virtual bool 56 GetStopReason (ThreadStopInfo &stop_info, std::string& description) = 0; 57 58 lldb::tid_t GetID()59 GetID() const 60 { 61 return m_tid; 62 } 63 64 NativeProcessProtocolSP 65 GetProcess (); 66 67 // --------------------------------------------------------------------- 68 // Thread-specific watchpoints 69 // --------------------------------------------------------------------- 70 virtual Error 71 SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) = 0; 72 73 virtual Error 74 RemoveWatchpoint (lldb::addr_t addr) = 0; 75 76 protected: 77 NativeProcessProtocolWP m_process_wp; 78 lldb::tid_t m_tid; 79 }; 80 } 81 82 #endif // #ifndef liblldb_NativeThreadProtocol_h_ 83