24 const std::unordered_set<std::string> &func_names,
bool exact_match)
26 m_regex(std::move(regex)), m_exact_match(exact_match),
27 m_function_names(func_names) {}
33 llvm::StringRef regex_string;
37 error.SetErrorString(
"BRFR::CFSD: Couldn't find regex entry.");
46 error.SetErrorString(
"BRFL::CFSD: Couldn't find exact match entry.");
51 std::unordered_set<std::string> names_set;
55 if (success && names_array) {
56 size_t num_names = names_array->
GetSize();
57 for (
size_t i = 0; i < num_names; i++) {
58 std::optional<llvm::StringRef> maybe_name =
61 error.SetErrorStringWithFormat(
62 "BRFR::CFSD: Malformed element %zu in the names array.", i);
65 names_set.insert(std::string(*maybe_name));
69 return std::make_shared<BreakpointResolverFileRegex>(
70 nullptr, std::move(regex), names_set, exact_match);
86 names_array_sp->AddItem(item);
102 std::vector<uint32_t> line_matches;
103 context.
target_sp->GetSourceManager().FindLinesMatchingRegex(
106 uint32_t num_matches = line_matches.size();
107 for (uint32_t i = 0; i < num_matches; i++) {
116 std::vector<size_t> sc_to_remove;
117 for (
size_t i = 0; i < sc_list.
GetSize(); i++) {
126 sc_to_remove.push_back(i);
130 if (!sc_to_remove.empty()) {
131 std::vector<size_t>::reverse_iterator iter;
132 std::vector<size_t>::reverse_iterator rend = sc_to_remove.rend();
133 for (iter = sc_to_remove.rbegin(); iter != rend; iter++) {
139 const bool skip_prologue =
true;
153 s->
Printf(
"source regex = \"%s\", exact_match = %d",
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
"lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets breakpoints by file and line.
StructuredData::ObjectSP SerializeToStructuredData() override
void GetDescription(Stream *s) override
Prints a canonical description for the breakpoint to the stream s.
Searcher::CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) override
std::unordered_set< std::string > m_function_names
void AddFunctionName(const char *func_name)
void Dump(Stream *s) const override
Standard "Dump" method. At present it does nothing.
lldb::SearchDepth GetDepth() override
BreakpointResolverFileRegex(const lldb::BreakpointSP &bkpt, RegularExpression regex, const std::unordered_set< std::string > &func_name_set, bool exact_match)
lldb::BreakpointResolverSP CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &options_dict, Status &error)
RegularExpression m_regex
General Outline: The BreakpointResolver is a Searcher.
static const char * GetKey(OptionNames enum_value)
StructuredData::DictionarySP WrapOptionsDict(StructuredData::DictionarySP options_dict_sp)
void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, llvm::StringRef log_ident, uint32_t line=0, std::optional< uint16_t > column=std::nullopt)
Takes a symbol context list of matches which supposedly represent the same file and line number in a ...
A class that describes a compilation unit.
const FileSpec & GetPrimaryFile() const
Return the primary source spec associated with this compile unit.
void ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list, RealpathPrefixes *realpath_prefixes=nullptr)
Resolve symbol contexts by file and line.
@ ePreferDemangledWithoutArguments
llvm::StringRef GetText() const
Access the regular expression text.
General Outline: Provides the callback and search depth for the SearchFilter search.
@ eCallbackReturnContinue
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
std::optional< llvm::StringRef > GetItemAtIndexAsString(size_t idx) const
bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result) const
bool GetValueForKeyAsBoolean(llvm::StringRef key, bool &result) const
bool GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
std::shared_ptr< String > StringSP
std::shared_ptr< Array > ArraySP
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
uint32_t GetSize() const
Get accessor for a symbol context list size.
bool RemoveContextAtIndex(size_t idx)
Defines a symbol context baton that can be handed other debug core functions.
CompileUnit * comp_unit
The CompileUnit for a given query.
lldb::TargetSP target_sp
The Target for a given query.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP