63 size_t *position)
const {
77 size_t *position)
const {
87 if(string_array.empty())
90 for (
const char *str : string_array) {
112 bool allow_locations,
114 ::PermissionKinds purpose,
117 llvm::StringRef range_from;
118 llvm::StringRef range_to;
119 llvm::StringRef current_arg;
120 std::set<std::string> names_found;
122 for (
size_t i = 0; i < old_args.
size(); ++i) {
123 bool is_range =
false;
125 current_arg = old_args[i].ref();
126 if (!allow_locations && current_arg.contains(
'.')) {
128 "Breakpoint locations not allowed, saw location: %s.",
129 current_arg.str().c_str());
136 std::tie(range_from, range_to) =
138 if (!range_from.empty() && !range_to.empty()) {
141 if (!
error.Success()) {
146 names_found.insert(std::string(current_arg));
147 }
else if ((i + 2 < old_args.
size()) &&
151 range_from = current_arg;
152 range_to = old_args[i + 2].ref();
157 llvm::StringRef tmp_str = old_args[i].ref();
158 size_t pos = tmp_str.find(
'.');
159 if (pos != llvm::StringRef::npos) {
160 llvm::StringRef bp_id_str = tmp_str.substr(0, pos);
162 tmp_str[pos + 1] ==
'*' && tmp_str.size() == (pos + 2)) {
168 if (!breakpoint_sp) {
171 bp_id->GetBreakpointID());
174 const size_t num_locations = breakpoint_sp->GetNumLocations();
175 for (
size_t j = 0; j < num_locations; ++j) {
177 breakpoint_sp->GetLocationAtIndex(j).get();
180 &canonical_id_str, bp_id->GetBreakpointID(), bp_loc->
GetID());
199 range_from.str().c_str());
207 range_to.str().c_str());
210 break_id_t start_bp_id = start_bp->GetBreakpointID();
211 break_id_t start_loc_id = start_bp->GetLocationID();
212 break_id_t end_bp_id = end_bp->GetBreakpointID();
213 break_id_t end_loc_id = end_bp->GetLocationID();
219 result.
AppendError(
"Invalid breakpoint id range: Either "
220 "both ends of range must specify"
221 " a breakpoint location, or neither can "
222 "specify a breakpoint location.");
237 if (start_bp_id != end_bp_id) {
240 "Invalid range: Ranges that specify particular breakpoint "
242 " must be within the same major breakpoint; you specified two"
243 " different major breakpoints, %d and %d.\n",
244 start_bp_id, end_bp_id);
250 const size_t num_breakpoints = breakpoints.
GetSize();
251 for (
size_t j = 0; j < num_breakpoints; ++j) {
255 if ((cur_bp_id < start_bp_id) || (cur_bp_id > end_bp_id))
260 if ((cur_bp_id == start_bp_id) &&
262 for (
size_t k = 0; k < num_locations; ++k) {
264 if ((bp_loc->
GetID() >= start_loc_id) &&
265 (bp_loc->
GetID() <= end_loc_id)) {
272 }
else if ((cur_bp_id == end_bp_id) &&
274 for (
size_t k = 0; k < num_locations; ++k) {
276 if (bp_loc->
GetID() <= end_loc_id) {
293 if (target && !names_found.empty()) {
296 auto iter = names_found.begin();
297 while (iter != names_found.end()) {
302 iter = names_found.erase(iter);
307 if (!names_found.empty()) {
309 for (std::string name : names_found) {
310 if (bkpt_sp->MatchesName(name.c_str())) {
324std::pair<llvm::StringRef, llvm::StringRef>
327 size_t idx = in_string.find(specifier_str);
328 if (idx == llvm::StringRef::npos)
330 llvm::StringRef right1 = in_string.drop_front(idx);
332 llvm::StringRef from = in_string.take_front(idx);
333 llvm::StringRef to = right1.drop_front(specifier_str.size());
337 return std::make_pair(from, to);
341 return std::pair<llvm::StringRef, llvm::StringRef>();
static llvm::raw_ostream & error(Stream &strm)
A command line argument class.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
void Clear()
Clear the arguments.
const BreakpointID & GetBreakpointIDAtIndex(size_t index) const
BreakpointIDArray m_breakpoint_ids
static void FindAndReplaceIDRanges(Args &old_args, Target *target, bool allow_locations, BreakpointName::Permissions ::PermissionKinds purpose, CommandReturnObject &result, Args &new_args)
virtual ~BreakpointIDList()
bool AddBreakpointID(BreakpointID bp_id)
BreakpointID m_invalid_id
bool RemoveBreakpointIDAtIndex(size_t index)
static std::pair< llvm::StringRef, llvm::StringRef > SplitIDRangeExpression(llvm::StringRef in_string)
bool FindBreakpointID(BreakpointID &bp_id, size_t *position) const
void InsertStringArray(llvm::ArrayRef< const char * > string_array, CommandReturnObject &result)
static std::optional< BreakpointID > ParseCanonicalReference(llvm::StringRef input)
Takes an input string containing the description of a breakpoint or breakpoint and location and retur...
lldb::break_id_t GetBreakpointID() const
lldb::break_id_t GetLocationID() const
static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
Takes a breakpoint ID and the breakpoint location id and returns a string containing the canonical de...
static bool IsValidIDExpression(llvm::StringRef str)
static bool IsRangeIdentifier(llvm::StringRef str)
static llvm::ArrayRef< llvm::StringRef > GetRangeSpecifiers()
static bool StringIsBreakpointName(llvm::StringRef str, Status &error)
Takes an input string and checks to see whether it is a breakpoint name.
General Outline: Allows adding and removing breakpoints and find by ID and index.
BreakpointIterable Breakpoints()
size_t GetSize() const
Returns the number of elements in this breakpoint list.
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const
Returns a shared pointer to the breakpoint with index i.
General Outline: A breakpoint location is defined by the breakpoint that produces it,...
lldb::break_id_t GetID() const
Returns the breakpoint location ID.
bool GetPermission(Permissions::PermissionKinds permission) const
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
lldb::BreakpointLocationSP GetLocationAtIndex(size_t index)
Get breakpoint locations by index.
size_t GetNumLocations() const
Return the number of breakpoint locations.
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
A uniqued constant string class.
lldb::break_id_t GetID() const
llvm::StringRef GetString() const
lldb::BreakpointSP GetBreakpointByID(lldb::break_id_t break_id)
BreakpointList & GetBreakpointList(bool internal=false)
BreakpointName * FindBreakpointName(ConstString name, bool can_create, Status &error)
#define LLDB_INVALID_BREAK_ID
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
@ eReturnStatusSuccessFinishNoResult