87 BreakpointName::Permissions ::PermissionKinds purpose,
Args &new_args) {
89 llvm::StringRef range_from;
90 llvm::StringRef range_to;
91 llvm::StringRef current_arg;
92 std::set<std::string> names_found;
94 for (
size_t i = 0; i < old_args.
size(); ++i) {
95 bool is_range =
false;
97 current_arg = old_args[i].ref();
99 if (allow_locations && current_arg ==
".") {
103 return llvm::createStringError(
"no current thread");
105 StopInfoSP stop_info_sp = thread->GetStopInfo();
109 return llvm::createStringError(
110 "current thread is not stopped at a breakpoint");
113 uint32_t data_count = stop_info_sp->GetStopReasonDataCount();
114 for (uint32_t j = 0; j < data_count; j += 2) {
122 if (!allow_locations && current_arg.contains(
'.')) {
124 return llvm::createStringError(
125 llvm::inconvertibleErrorCode(),
126 "Breakpoint locations not allowed, saw location: %s.",
127 current_arg.str().c_str());
132 std::tie(range_from, range_to) =
134 if (!range_from.empty() && !range_to.empty()) {
137 if (!
error.Success()) {
139 return llvm::createStringError(llvm::inconvertibleErrorCode(),
142 names_found.insert(std::string(current_arg));
143 }
else if ((i + 2 < old_args.
size()) &&
147 range_from = current_arg;
148 range_to = old_args[i + 2].ref();
153 llvm::StringRef tmp_str = old_args[i].ref();
154 auto [prefix, suffix] = tmp_str.split(
'.');
161 if (!breakpoint_sp) {
163 return llvm::createStringError(llvm::inconvertibleErrorCode(),
164 "'%d' is not a valid breakpoint ID.\n",
165 bp_id->GetBreakpointID());
167 const size_t num_locations = breakpoint_sp->GetNumLocations();
168 for (
size_t j = 0; j < num_locations; ++j) {
170 breakpoint_sp->GetLocationAtIndex(j).get();
173 &canonical_id_str, bp_id->GetBreakpointID(), bp_loc->
GetID());
190 return llvm::createStringError(llvm::inconvertibleErrorCode(),
191 "'%s' is not a valid breakpoint ID.\n",
192 range_from.str().c_str());
198 return llvm::createStringError(llvm::inconvertibleErrorCode(),
199 "'%s' is not a valid breakpoint ID.\n",
200 range_to.str().c_str());
202 break_id_t start_bp_id = start_bp->GetBreakpointID();
203 break_id_t start_loc_id = start_bp->GetLocationID();
204 break_id_t end_bp_id = end_bp->GetBreakpointID();
205 break_id_t end_loc_id = end_bp->GetLocationID();
211 return llvm::createStringError(llvm::inconvertibleErrorCode(),
212 "Invalid breakpoint id range: Either "
213 "both ends of range must specify"
214 " a breakpoint location, or neither can "
215 "specify a breakpoint location.");
229 if (start_bp_id != end_bp_id) {
231 return llvm::createStringError(
232 llvm::inconvertibleErrorCode(),
233 "Invalid range: Ranges that specify particular breakpoint "
235 " must be within the same major breakpoint; you specified two"
236 " different major breakpoints, %d and %d.\n",
237 start_bp_id, end_bp_id);
242 const size_t num_breakpoints = breakpoints.
GetSize();
243 for (
size_t j = 0; j < num_breakpoints; ++j) {
247 if ((cur_bp_id < start_bp_id) || (cur_bp_id > end_bp_id))
252 if ((cur_bp_id == start_bp_id) &&
254 for (
size_t k = 0; k < num_locations; ++k) {
256 if ((bp_loc->
GetID() >= start_loc_id) &&
257 (bp_loc->
GetID() <= end_loc_id)) {
264 }
else if ((cur_bp_id == end_bp_id) &&
266 for (
size_t k = 0; k < num_locations; ++k) {
268 if (bp_loc->
GetID() <= end_loc_id) {
285 if (target && !names_found.empty()) {
288 auto iter = names_found.begin();
289 while (iter != names_found.end()) {
294 iter = names_found.erase(iter);
299 if (!names_found.empty()) {
301 for (
const std::string &name : names_found) {
302 if (bkpt_sp->MatchesName(name.c_str())) {
312 return llvm::Error::success();
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Target * GetTargetPtr() const
Returns a pointer to the target object.
Thread * GetThreadPtr() const
Returns a pointer to the thread object.