1 //===-- SBBreakpoint.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 LLDB_SBBreakpoint_h_ 11 #define LLDB_SBBreakpoint_h_ 12 13 #include "lldb/API/SBDefines.h" 14 15 class SBBreakpointListImpl; 16 17 namespace lldb { 18 19 class LLDB_API SBBreakpoint { 20 public: 21 22 SBBreakpoint(); 23 24 SBBreakpoint(const lldb::SBBreakpoint &rhs); 25 26 SBBreakpoint(const lldb::BreakpointSP &bp_sp); 27 28 ~SBBreakpoint(); 29 30 const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs); 31 32 // Tests to see if the opaque breakpoint object in this object matches the 33 // opaque breakpoint object in "rhs". 34 bool operator==(const lldb::SBBreakpoint &rhs); 35 36 bool operator!=(const lldb::SBBreakpoint &rhs); 37 38 break_id_t GetID() const; 39 40 bool IsValid() const; 41 42 void ClearAllBreakpointSites(); 43 44 lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr); 45 46 lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr); 47 48 lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id); 49 50 lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index); 51 52 void SetEnabled(bool enable); 53 54 bool IsEnabled(); 55 56 void SetOneShot(bool one_shot); 57 58 bool IsOneShot() const; 59 60 bool IsInternal(); 61 62 uint32_t GetHitCount() const; 63 64 void SetIgnoreCount(uint32_t count); 65 66 uint32_t GetIgnoreCount() const; 67 68 void SetCondition(const char *condition); 69 70 const char *GetCondition(); 71 72 void SetAutoContinue(bool auto_continue); 73 74 bool GetAutoContinue(); 75 76 void SetThreadID(lldb::tid_t sb_thread_id); 77 78 lldb::tid_t GetThreadID(); 79 80 void SetThreadIndex(uint32_t index); 81 82 uint32_t GetThreadIndex() const; 83 84 void SetThreadName(const char *thread_name); 85 86 const char *GetThreadName() const; 87 88 void SetQueueName(const char *queue_name); 89 90 const char *GetQueueName() const; 91 92 void SetCallback(SBBreakpointHitCallback callback, void *baton); 93 94 void SetScriptCallbackFunction(const char *callback_function_name); 95 96 void SetCommandLineCommands(SBStringList &commands); 97 98 bool GetCommandLineCommands(SBStringList &commands); 99 100 SBError SetScriptCallbackBody(const char *script_body_text); 101 102 bool AddName(const char *new_name); 103 104 void RemoveName(const char *name_to_remove); 105 106 bool MatchesName(const char *name); 107 108 void GetNames(SBStringList &names); 109 110 size_t GetNumResolvedLocations() const; 111 112 size_t GetNumLocations() const; 113 114 bool GetDescription(lldb::SBStream &description); 115 116 bool GetDescription(lldb::SBStream &description, bool include_locations); 117 118 static bool EventIsBreakpointEvent(const lldb::SBEvent &event); 119 120 static lldb::BreakpointEventType 121 GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event); 122 123 static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event); 124 125 static lldb::SBBreakpointLocation 126 GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event, 127 uint32_t loc_idx); 128 129 static uint32_t 130 GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp); 131 132 bool IsHardware() const; 133 134 // Can only be called from a ScriptedBreakpointResolver... 135 SBError 136 AddLocation(SBAddress &address); 137 138 private: 139 friend class SBBreakpointList; 140 friend class SBBreakpointLocation; 141 friend class SBBreakpointName; 142 friend class SBTarget; 143 144 lldb::BreakpointSP GetSP() const; 145 146 lldb::BreakpointWP m_opaque_wp; 147 }; 148 149 class LLDB_API SBBreakpointList { 150 public: 151 SBBreakpointList(SBTarget &target); 152 153 ~SBBreakpointList(); 154 155 size_t GetSize() const; 156 157 SBBreakpoint GetBreakpointAtIndex(size_t idx); 158 159 SBBreakpoint FindBreakpointByID(lldb::break_id_t); 160 161 void Append(const SBBreakpoint &sb_bkpt); 162 163 bool AppendIfUnique(const SBBreakpoint &sb_bkpt); 164 165 void AppendByID(lldb::break_id_t id); 166 167 void Clear(); 168 169 protected: 170 friend class SBTarget; 171 172 void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list); 173 174 private: 175 std::shared_ptr<SBBreakpointListImpl> m_opaque_sp; 176 }; 177 178 } // namespace lldb 179 180 #endif // LLDB_SBBreakpoint_h_ 181