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
16namespace lldb_private {
18namespace python {
19class SWIGBridge;
20}
21} // namespace lldb_private
22
23namespace lldb {
24
26public:
27
29
31
33
35
36 // Tests to see if the opaque breakpoint object in this object matches the
37 // opaque breakpoint object in "rhs".
38 bool operator==(const lldb::SBBreakpoint &rhs);
39
40 bool operator!=(const lldb::SBBreakpoint &rhs);
41
42 break_id_t GetID() const;
43
44 explicit operator bool() const;
45
46 bool IsValid() const;
47
49
51
53
55
57
59
60 void SetEnabled(bool enable);
61
62 bool IsEnabled();
63
64 void SetOneShot(bool one_shot);
65
66 bool IsOneShot() const;
67
68 bool IsInternal();
69
70 uint32_t GetHitCount() const;
71
72 void SetIgnoreCount(uint32_t count);
73
74 uint32_t GetIgnoreCount() const;
75
76 void SetCondition(const char *condition);
77
78 const char *GetCondition();
79
80 void SetAutoContinue(bool auto_continue);
81
82 bool GetAutoContinue();
83
84 void SetThreadID(lldb::tid_t sb_thread_id);
85
87
88 void SetThreadIndex(uint32_t index);
89
90 uint32_t GetThreadIndex() const;
91
92 void SetThreadName(const char *thread_name);
93
94 const char *GetThreadName() const;
95
96 void SetQueueName(const char *queue_name);
97
98 const char *GetQueueName() const;
99
100#ifndef SWIG
101 void SetCallback(SBBreakpointHitCallback callback, void *baton);
102#endif
103
104 void SetScriptCallbackFunction(const char *callback_function_name);
105
106 SBError SetScriptCallbackFunction(const char *callback_function_name,
107 SBStructuredData &extra_args);
108
109 void SetCommandLineCommands(SBStringList &commands);
110
111 bool GetCommandLineCommands(SBStringList &commands);
112
113 SBError SetScriptCallbackBody(const char *script_body_text);
114
115 LLDB_DEPRECATED_FIXME("Doesn't provide error handling",
116 "AddNameWithErrorHandling")
117 bool AddName(const char *new_name);
118
119 SBError AddNameWithErrorHandling(const char *new_name);
120
121 void RemoveName(const char *name_to_remove);
122
123 bool MatchesName(const char *name);
124
125 void GetNames(SBStringList &names);
126
127 size_t GetNumResolvedLocations() const;
128
129 size_t GetNumLocations() const;
130
131 bool GetDescription(lldb::SBStream &description);
132
133 bool GetDescription(lldb::SBStream &description, bool include_locations);
134
135 static bool EventIsBreakpointEvent(const lldb::SBEvent &event);
136
137 static lldb::BreakpointEventType
139
140 static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);
141
144 uint32_t loc_idx);
145
146 static uint32_t
148
149 bool IsHardware() const;
150
151 /// Make this breakpoint a hardware breakpoint. This will replace all existing
152 /// breakpoint locations with hardware breakpoints. Returns an error if this
153 /// fails, e.g. when there aren't enough hardware resources available.
154 lldb::SBError SetIsHardware(bool is_hardware);
155
156 /// Adds a location to the breakpoint at the address passed in.
157 /// Can only be called from a ScriptedBreakpointResolver...
158 SBError
159 AddLocation(SBAddress &address);
160 /// Add a "Facade location" to the breakpoint. This returns the Facade
161 /// Location that was added, which you can then use in
162 /// get_location_description and was_hit in your breakpoint resolver.
163 /// Can only be called from a ScriptedBreakpointResolver.
165
167
168private:
169 friend class SBBreakpointList;
171 friend class SBBreakpointName;
172 friend class SBTarget;
173
175 friend class lldb_private::python::SWIGBridge;
176
177 SBBreakpoint(const lldb::BreakpointSP &bp_sp);
178
179 lldb::BreakpointSP GetSP() const;
180
182};
183
185public:
186 SBBreakpointList(SBTarget &target);
187
189
190 size_t GetSize() const;
191
193
195
196 void Append(const SBBreakpoint &sb_bkpt);
197
198 bool AppendIfUnique(const SBBreakpoint &sb_bkpt);
199
201
202 void Clear();
203
204protected:
205 friend class SBTarget;
206
208
209private:
210 std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
211};
212
213} // namespace lldb
214
215#endif // LLDB_API_SBBREAKPOINT_H
#define LLDB_API
Definition SBDefines.h:28
std::shared_ptr< SBBreakpointListImpl > m_opaque_sp
SBBreakpoint GetBreakpointAtIndex(size_t idx)
bool AppendIfUnique(const SBBreakpoint &sb_bkpt)
SBBreakpoint FindBreakpointByID(lldb::break_id_t)
SBBreakpointList(SBTarget &target)
void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list)
void Append(const SBBreakpoint &sb_bkpt)
void AppendByID(lldb::break_id_t id)
void SetOneShot(bool one_shot)
SBError SetScriptCallbackBody(const char *script_body_text)
SBBreakpointLocation AddFacadeLocation()
Add a "Facade location" to the breakpoint.
uint32_t GetThreadIndex() const
lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id)
LLDB_DEPRECATED_FIXME("Doesn't provide error handling", "AddNameWithErrorHandling") bool AddName(const char *new_name)
SBError AddLocation(SBAddress &address)
Adds a location to the breakpoint at the address passed in.
break_id_t GetID() const
void SetThreadID(lldb::tid_t sb_thread_id)
lldb::BreakpointWP m_opaque_wp
bool GetCommandLineCommands(SBStringList &commands)
void SetAutoContinue(bool auto_continue)
friend class lldb_private::python::SWIGBridge
void SetEnabled(bool enable)
void SetThreadName(const char *thread_name)
void SetThreadIndex(uint32_t index)
const char * GetThreadName() const
static lldb::BreakpointEventType GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event)
friend class SBTarget
uint32_t GetHitCount() const
lldb::SBError SetIsHardware(bool is_hardware)
Make this breakpoint a hardware breakpoint.
static lldb::SBBreakpointLocation GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event, uint32_t loc_idx)
lldb::tid_t GetThreadID()
bool MatchesName(const char *name)
bool operator!=(const lldb::SBBreakpoint &rhs)
void SetIgnoreCount(uint32_t count)
lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr)
size_t GetNumLocations() const
SBStructuredData SerializeToStructuredData()
const lldb::SBBreakpoint & operator=(const lldb::SBBreakpoint &rhs)
lldb::SBTarget GetTarget() const
void SetScriptCallbackFunction(const char *callback_function_name)
lldb::BreakpointSP GetSP() const
static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event)
bool GetDescription(lldb::SBStream &description)
static bool EventIsBreakpointEvent(const lldb::SBEvent &event)
void SetCommandLineCommands(SBStringList &commands)
size_t GetNumResolvedLocations() const
bool IsHardware() const
friend class lldb_private::ScriptInterpreter
bool IsOneShot() const
void SetCondition(const char *condition)
void SetQueueName(const char *queue_name)
friend class SBBreakpointList
lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr)
const char * GetCondition()
const char * GetQueueName() const
friend class SBBreakpointName
void GetNames(SBStringList &names)
friend class SBBreakpointLocation
void RemoveName(const char *name_to_remove)
uint32_t GetIgnoreCount() const
static uint32_t GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp)
SBError AddNameWithErrorHandling(const char *new_name)
lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index)
bool operator==(const lldb::SBBreakpoint &rhs)
void SetCallback(SBBreakpointHitCallback callback, void *baton)
A class that represents a running process on the host machine.
std::weak_ptr< lldb_private::Breakpoint > BreakpointWP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
int32_t break_id_t
Definition lldb-types.h:86
bool(* SBBreakpointHitCallback)(void *baton, lldb::SBProcess &process, lldb::SBThread &thread, lldb::SBBreakpointLocation &location)
Definition SBDefines.h:141
uint64_t addr_t
Definition lldb-types.h:80
uint64_t tid_t
Definition lldb-types.h:84