1 //===-- NativeThreadLinux.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_NativeThreadLinux_H_ 11 #define liblldb_NativeThreadLinux_H_ 12 13 #include "lldb/lldb-private-forward.h" 14 #include "../../../Host/common/NativeThreadProtocol.h" 15 16 namespace lldb_private 17 { 18 class NativeProcessLinux; 19 20 class NativeThreadLinux : public NativeThreadProtocol 21 { 22 friend class NativeProcessLinux; 23 24 public: 25 NativeThreadLinux (NativeProcessLinux *process, lldb::tid_t tid); 26 27 // --------------------------------------------------------------------- 28 // NativeThreadProtocol Interface 29 // --------------------------------------------------------------------- 30 std::string 31 GetName() override; 32 33 lldb::StateType 34 GetState () override; 35 36 bool 37 GetStopReason (ThreadStopInfo &stop_info) override; 38 39 NativeRegisterContextSP 40 GetRegisterContext () override; 41 42 Error 43 SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override; 44 45 Error 46 RemoveWatchpoint (lldb::addr_t addr) override; 47 48 uint32_t 49 TranslateStopInfoToGdbSignal (const ThreadStopInfo &stop_info) const override; 50 51 private: 52 // --------------------------------------------------------------------- 53 // Interface for friend classes 54 // --------------------------------------------------------------------- 55 void 56 SetLaunching (); 57 58 void 59 SetRunning (); 60 61 void 62 SetStepping (); 63 64 void 65 SetStoppedBySignal (uint32_t signo); 66 67 /// Return true if the thread is stopped. 68 /// If stopped by a signal, indicate the signo in the signo argument. 69 /// Otherwise, return LLDB_INVALID_SIGNAL_NUMBER. 70 bool 71 IsStopped (int *signo); 72 73 void 74 SetStoppedByExec (); 75 76 void 77 SetStoppedByBreakpoint (); 78 79 bool 80 IsStoppedAtBreakpoint (); 81 82 void 83 SetCrashedWithException (uint64_t exception_type, lldb::addr_t exception_addr); 84 85 void 86 SetSuspended (); 87 88 void 89 SetExited (); 90 91 // --------------------------------------------------------------------- 92 // Private interface 93 // --------------------------------------------------------------------- 94 void 95 MaybeLogStateChange (lldb::StateType new_state); 96 97 // --------------------------------------------------------------------- 98 // Member Variables 99 // --------------------------------------------------------------------- 100 lldb::StateType m_state; 101 ThreadStopInfo m_stop_info; 102 NativeRegisterContextSP m_reg_context_sp; 103 }; 104 } 105 106 #endif // #ifndef liblldb_NativeThreadLinux_H_ 107