1 //===-- SBBreakpoint.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBBreakpoint_h_
11 #define LLDB_SBBreakpoint_h_
13 #include "lldb/API/SBDefines.h"
15 class SBBreakpointListImpl;
19 class LLDB_API SBBreakpoint {
21 typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
23 lldb::SBBreakpointLocation &location);
27 SBBreakpoint(const lldb::SBBreakpoint &rhs);
31 const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
33 // Tests to see if the opaque breakpoint object in this object matches the
34 // opaque breakpoint object in "rhs".
35 bool operator==(const lldb::SBBreakpoint &rhs);
37 bool operator!=(const lldb::SBBreakpoint &rhs);
39 break_id_t GetID() const;
43 void ClearAllBreakpointSites();
45 lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);
47 lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);
49 lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);
51 lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);
53 void SetEnabled(bool enable);
57 void SetOneShot(bool one_shot);
59 bool IsOneShot() const;
63 uint32_t GetHitCount() const;
65 void SetIgnoreCount(uint32_t count);
67 uint32_t GetIgnoreCount() const;
69 void SetCondition(const char *condition);
71 const char *GetCondition();
73 void SetThreadID(lldb::tid_t sb_thread_id);
75 lldb::tid_t GetThreadID();
77 void SetThreadIndex(uint32_t index);
79 uint32_t GetThreadIndex() const;
81 void SetThreadName(const char *thread_name);
83 const char *GetThreadName() const;
85 void SetQueueName(const char *queue_name);
87 const char *GetQueueName() const;
89 void SetCallback(BreakpointHitCallback callback, void *baton);
91 void SetScriptCallbackFunction(const char *callback_function_name);
93 void SetCommandLineCommands(SBStringList &commands);
95 bool GetCommandLineCommands(SBStringList &commands);
97 SBError SetScriptCallbackBody(const char *script_body_text);
99 bool AddName(const char *new_name);
101 void RemoveName(const char *name_to_remove);
103 bool MatchesName(const char *name);
105 void GetNames(SBStringList &names);
107 size_t GetNumResolvedLocations() const;
109 size_t GetNumLocations() const;
111 bool GetDescription(lldb::SBStream &description);
113 bool GetDescription(lldb::SBStream &description, bool include_locations);
115 static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
117 static lldb::BreakpointEventType
118 GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);
120 static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
122 static lldb::SBBreakpointLocation
123 GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
127 GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
130 friend class SBBreakpointList;
131 friend class SBBreakpointLocation;
132 friend class SBTarget;
134 SBBreakpoint(const lldb::BreakpointSP &bp_sp);
136 lldb_private::Breakpoint *operator->() const;
138 lldb_private::Breakpoint *get() const;
140 lldb::BreakpointSP &operator*();
142 const lldb::BreakpointSP &operator*() const;
144 static bool PrivateBreakpointHitCallback(
145 void *baton, lldb_private::StoppointCallbackContext *context,
146 lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
148 lldb::BreakpointSP m_opaque_sp;
151 class LLDB_API SBBreakpointList {
153 SBBreakpointList(SBTarget &target);
157 size_t GetSize() const;
159 SBBreakpoint GetBreakpointAtIndex(size_t idx);
161 SBBreakpoint FindBreakpointByID(lldb::break_id_t);
163 void Append(const SBBreakpoint &sb_file);
165 bool AppendIfUnique(const SBBreakpoint &sb_file);
167 void AppendByID(lldb::break_id_t id);
172 friend class SBTarget;
174 void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);
177 std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
182 #endif // LLDB_SBBreakpoint_h_