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