StopInfo.h revision d168690e51f9020b926d3d0d57dc9a2cfb2095a8
1//===-- StopInfo.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_StopInfo_h_ 11#define liblldb_StopInfo_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/lldb-include.h" 18 19namespace lldb_private { 20 21class StopInfo 22{ 23public: 24 //------------------------------------------------------------------ 25 // Constructors and Destructors 26 //------------------------------------------------------------------ 27 StopInfo (Thread &thread, uint64_t value); 28 29 virtual ~StopInfo() 30 { 31 } 32 33 34 bool 35 IsValid () const; 36 37 Thread & 38 GetThread() 39 { 40 return m_thread; 41 } 42 43 const Thread & 44 GetThread() const 45 { 46 return m_thread; 47 } 48 49 uint64_t 50 GetValue() const 51 { 52 return m_value; 53 } 54 55 virtual lldb::StopReason 56 GetStopReason () const = 0; 57 58 // Perform any action that is associated with this stop. This is done as the 59 // Event is removed from the event queue. 60 virtual void 61 PerformAction (Event *event_ptr) 62 { 63 } 64 65 // Stop the thread by default. Subclasses can override this to allow 66 // the thread to continue if desired. 67 virtual bool 68 ShouldStop (Event *event_ptr) 69 { 70 return true; 71 } 72 73 // If should stop returns false, check if we should notify of this event 74 virtual bool 75 ShouldNotify (Event *event_ptr) 76 { 77 return false; 78 } 79 80 virtual void 81 WillResume (lldb::StateType resume_state) 82 { 83 // By default, don't do anything 84 } 85 86 virtual const char * 87 GetDescription () = 0; 88 89 90 static lldb::StopInfoSP 91 CreateStopReasonWithBreakpointSiteID (Thread &thread, lldb::break_id_t break_id); 92 93 // This creates a StopInfo for the thread where the should_stop is already set, and won't be recalculated. 94 static lldb::StopInfoSP 95 CreateStopReasonWithBreakpointSiteID (Thread &thread, lldb::break_id_t break_id, bool should_stop); 96 97 static lldb::StopInfoSP 98 CreateStopReasonWithWatchpointID (Thread &thread, lldb::break_id_t watch_id); 99 100 static lldb::StopInfoSP 101 CreateStopReasonWithSignal (Thread &thread, int signo); 102 103 static lldb::StopInfoSP 104 CreateStopReasonToTrace (Thread &thread); 105 106 static lldb::StopInfoSP 107 CreateStopReasonWithPlan (lldb::ThreadPlanSP &plan); 108 109protected: 110 //------------------------------------------------------------------ 111 // Classes that inherit from StackID can see and modify these 112 //------------------------------------------------------------------ 113 Thread & m_thread; // The thread corresponding to the stop reason. 114 const uint32_t m_stop_id; // The process stop ID for which this stop info is valid 115 uint64_t m_value; // A generic value that can be used for things pertaining to this stop info 116private: 117 DISALLOW_COPY_AND_ASSIGN (StopInfo); 118}; 119 120 121} // namespace lldb_private 122 123#endif // liblldb_StopInfo_h_ 124