SBBreakpoint.h revision 3fcc297c999218b19d7d5ad049e9c955c4bc481d
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
15namespace lldb {
16
17class SBBreakpoint
18{
19public:
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    break_id_t
41    GetID () const;
42
43    bool
44    IsValid() const;
45
46    void
47    ClearAllBreakpointSites ();
48
49    lldb::SBBreakpointLocation
50    FindLocationByAddress (lldb::addr_t vm_addr);
51
52    lldb::break_id_t
53    FindLocationIDByAddress (lldb::addr_t vm_addr);
54
55    lldb::SBBreakpointLocation
56    FindLocationByID (lldb::break_id_t bp_loc_id);
57
58    lldb::SBBreakpointLocation
59    GetLocationAtIndex (uint32_t index);
60
61    void
62    SetEnabled (bool enable);
63
64    bool
65    IsEnabled ();
66
67    bool
68    IsInternal ();
69
70    uint32_t
71    GetHitCount () const;
72
73    void
74    SetIgnoreCount (uint32_t count);
75
76    uint32_t
77    GetIgnoreCount () const;
78
79    void
80    SetCondition (const char *condition);
81
82    const char *
83    GetCondition ();
84
85    void
86    SetThreadID (lldb::tid_t sb_thread_id);
87
88    lldb::tid_t
89    GetThreadID ();
90
91    void
92    SetThreadIndex (uint32_t index);
93
94    uint32_t
95    GetThreadIndex() const;
96
97    void
98    SetThreadName (const char *thread_name);
99
100    const char *
101    GetThreadName () const;
102
103    void
104    SetQueueName (const char *queue_name);
105
106    const char *
107    GetQueueName () const;
108
109    void
110    SetCallback (BreakpointHitCallback callback, void *baton);
111
112    size_t
113    GetNumResolvedLocations() const;
114
115    size_t
116    GetNumLocations() const;
117
118    bool
119    GetDescription (lldb::SBStream &description);
120
121    static bool
122    EventIsBreakpointEvent (const lldb::SBEvent &event);
123
124    static lldb::BreakpointEventType
125    GetBreakpointEventTypeFromEvent (const lldb::SBEvent& event);
126
127    static lldb::SBBreakpoint
128    GetBreakpointFromEvent (const lldb::SBEvent& event);
129
130    static lldb::SBBreakpointLocation
131    GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx);
132
133    static uint32_t
134    GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp);
135
136
137private:
138    friend class SBBreakpointLocation;
139    friend class SBTarget;
140
141    SBBreakpoint (const lldb::BreakpointSP &bp_sp);
142
143    lldb_private::Breakpoint *
144    operator->() const;
145
146    lldb_private::Breakpoint *
147    get() const;
148
149    lldb::BreakpointSP &
150    operator *();
151
152    const lldb::BreakpointSP &
153    operator *() const;
154
155    static bool
156    PrivateBreakpointHitCallback (void *baton,
157                                  lldb_private::StoppointCallbackContext *context,
158                                  lldb::user_id_t break_id,
159                                  lldb::user_id_t break_loc_id);
160
161    lldb::BreakpointSP m_opaque_sp;
162};
163
164} // namespace lldb
165
166#endif  // LLDB_SBBreakpoint_h_
167