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 namespace lldb {
16 
17 class SBBreakpoint
18 {
19 public:
20 
21     typedef bool (*BreakpointHitCallback) (void *baton,
22                                            SBProcess &process,
23                                            SBThread &thread,
24                                            lldb::SBBreakpointLocation &location);
25 
26     SBBreakpoint ();
27 
28     SBBreakpoint (const lldb::SBBreakpoint& rhs);
29 
30     ~SBBreakpoint();
31 
32     const lldb::SBBreakpoint &
33     operator = (const lldb::SBBreakpoint& rhs);
34 
35     // Tests to see if the opaque breakpoint object in this object matches the
36     // opaque breakpoint object in "rhs".
37     bool
38     operator == (const lldb::SBBreakpoint& rhs);
39 
40     bool
41     operator != (const lldb::SBBreakpoint& rhs);
42 
43     break_id_t
44     GetID () const;
45 
46     bool
47     IsValid() const;
48 
49     void
50     ClearAllBreakpointSites ();
51 
52     lldb::SBBreakpointLocation
53     FindLocationByAddress (lldb::addr_t vm_addr);
54 
55     lldb::break_id_t
56     FindLocationIDByAddress (lldb::addr_t vm_addr);
57 
58     lldb::SBBreakpointLocation
59     FindLocationByID (lldb::break_id_t bp_loc_id);
60 
61     lldb::SBBreakpointLocation
62     GetLocationAtIndex (uint32_t index);
63 
64     void
65     SetEnabled (bool enable);
66 
67     bool
68     IsEnabled ();
69 
70     void
71     SetOneShot (bool one_shot);
72 
73     bool
74     IsOneShot () const;
75 
76     bool
77     IsInternal ();
78 
79     uint32_t
80     GetHitCount () const;
81 
82     void
83     SetIgnoreCount (uint32_t count);
84 
85     uint32_t
86     GetIgnoreCount () const;
87 
88     void
89     SetCondition (const char *condition);
90 
91     const char *
92     GetCondition ();
93 
94     void
95     SetThreadID (lldb::tid_t sb_thread_id);
96 
97     lldb::tid_t
98     GetThreadID ();
99 
100     void
101     SetThreadIndex (uint32_t index);
102 
103     uint32_t
104     GetThreadIndex() const;
105 
106     void
107     SetThreadName (const char *thread_name);
108 
109     const char *
110     GetThreadName () const;
111 
112     void
113     SetQueueName (const char *queue_name);
114 
115     const char *
116     GetQueueName () const;
117 
118     void
119     SetCallback (BreakpointHitCallback callback, void *baton);
120 
121     size_t
122     GetNumResolvedLocations() const;
123 
124     size_t
125     GetNumLocations() const;
126 
127     bool
128     GetDescription (lldb::SBStream &description);
129 
130     static bool
131     EventIsBreakpointEvent (const lldb::SBEvent &event);
132 
133     static lldb::BreakpointEventType
134     GetBreakpointEventTypeFromEvent (const lldb::SBEvent& event);
135 
136     static lldb::SBBreakpoint
137     GetBreakpointFromEvent (const lldb::SBEvent& event);
138 
139     static lldb::SBBreakpointLocation
140     GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx);
141 
142     static uint32_t
143     GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp);
144 
145 
146 private:
147     friend class SBBreakpointLocation;
148     friend class SBTarget;
149 
150     SBBreakpoint (const lldb::BreakpointSP &bp_sp);
151 
152     lldb_private::Breakpoint *
153     operator->() const;
154 
155     lldb_private::Breakpoint *
156     get() const;
157 
158     lldb::BreakpointSP &
159     operator *();
160 
161     const lldb::BreakpointSP &
162     operator *() const;
163 
164     static bool
165     PrivateBreakpointHitCallback (void *baton,
166                                   lldb_private::StoppointCallbackContext *context,
167                                   lldb::user_id_t break_id,
168                                   lldb::user_id_t break_loc_id);
169 
170     lldb::BreakpointSP m_opaque_sp;
171 };
172 
173 } // namespace lldb
174 
175 #endif  // LLDB_SBBreakpoint_h_
176