28 const char *name_cstr, FunctionNameType name_type_mask,
32 m_match_type(type), m_language(language), m_skip_prologue(skip_prologue) {
35 if (!m_regex.IsValid()) {
39 log->
Warning(
"function name regexp: \"%s\" did not compile.",
43 AddNameLookup(
ConstString(name_cstr), name_type_mask);
48 const BreakpointSP &bkpt,
const char *names[],
size_t num_names,
52 m_match_type(
Breakpoint::Exact), m_language(language),
53 m_skip_prologue(skip_prologue) {
54 for (
size_t i = 0; i < num_names; i++) {
55 AddNameLookup(
ConstString(names[i]), name_type_mask);
60 const BreakpointSP &bkpt,
const std::vector<std::string> &names,
64 m_match_type(
Breakpoint::Exact), m_language(language),
65 m_skip_prologue(skip_prologue) {
66 for (
const std::string &name : names) {
67 AddNameLookup(
ConstString(name.c_str(), name.size()), name_type_mask);
77 m_class_name(nullptr), m_regex(std::move(func_regex)),
78 m_match_type(
Breakpoint::Regexp), m_language(language),
79 m_skip_prologue(skip_prologue) {}
85 m_lookups(rhs.m_lookups), m_class_name(rhs.m_class_name),
86 m_regex(rhs.m_regex), m_match_type(rhs.m_match_type),
87 m_language(rhs.m_language), m_skip_prologue(rhs.m_skip_prologue) {}
92 llvm::StringRef language_name;
99 "BRN::CFSD: Unknown language: {0}.", language_name);
120 llvm::StringRef regex_text;
124 return std::make_shared<BreakpointResolverName>(
140 "BRN::CFSD: Missing symbol names mask entry.");
144 size_t num_elem = names_array->
GetSize();
145 if (num_elem != names_mask_array->
GetSize()) {
147 "BRN::CFSD: names and names mask arrays have different sizes.");
153 "BRN::CFSD: no name entry in a breakpoint by name breakpoint.");
156 std::vector<std::string> names;
157 std::vector<FunctionNameType> name_masks;
158 for (
size_t i = 0; i < num_elem; i++) {
159 std::optional<llvm::StringRef> maybe_name =
167 std::underlying_type<FunctionNameType>::type>(i);
170 "BRN::CFSD: name mask entry is not an integer.");
173 names.push_back(std::string(*maybe_name));
174 name_masks.push_back(
static_cast<FunctionNameType
>(*maybe_fnt));
177 std::shared_ptr<BreakpointResolverName> resolver_sp =
178 std::make_shared<BreakpointResolverName>(
179 nullptr, names[0].c_str(), name_masks[0], language,
181 for (
size_t i = 1; i < num_elem; i++) {
182 resolver_sp->AddNameLookup(
ConstString(names[i]), name_masks[i]);
208 options_dict_sp->AddStringItem(
218 FunctionNameType name_type_mask) {
223 auto add_variant_funcs = [&](
Language *lang) {
225 lang->GetMethodNameVariants(name)) {
227 if (variant.GetType() & lldb::eFunctionNameTypeFull) {
229 lang->GetLanguageType());
238 add_variant_funcs(lang);
260 log->
Warning(
"Class/method function specification not supported yet.\n");
277 const size_t start_func_idx = func_list.
GetSize();
279 function_options, func_list);
281 const size_t end_func_idx = func_list.
GetSize();
283 if (start_func_idx < end_func_idx)
284 lookup.Prune(func_list, start_func_idx);
295 log->
Warning(
"glob is not supported yet.");
301 if (filter_by_cu || filter_by_language) {
302 uint32_t num_functions = func_list.
GetSize();
304 for (
size_t idx = 0; idx < num_functions; idx++) {
305 bool remove_it =
false;
313 if (filter_by_language) {
336 bool is_reexported =
false;
338 if (sc.block && sc.block->GetInlinedFunctionInfo()) {
339 if (!sc.block->GetStartAddress(break_addr))
341 }
else if (sc.function) {
342 break_addr = sc.function->GetAddressRange().GetBaseAddress();
344 const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
345 if (prologue_byte_size)
348 }
else if (sc.symbol) {
350 const Symbol *actual_symbol =
353 is_reexported =
true;
357 break_addr = sc.symbol->GetAddress();
361 const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
362 if (prologue_byte_size)
381 bp_loc_sp->SetIsReExported(is_reexported);
382 if (bp_loc_sp && new_location && !breakpoint.
IsInternal()) {
407 for (
size_t i = 0; i < num_names; i++) {
408 s->
Printf(
"%s'%s'", (i == 0 ?
"" :
", "),
424 ret_sp->SetBreakpoint(breakpoint);
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
static llvm::StringRef GetName(XcodeSDK::Type type)
A section + offset based address class.
void Clear()
Clear the object's state.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool IsValid() const
Check if the object state is valid.
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
virtual void AdjustBreakpointAddress(const Symbol &func, Address &addr) const
Adjust function breakpoint address, if needed.
"lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on a given function name,...
void AddNameLookup(ConstString name, lldb::FunctionNameType name_type_mask)
std::vector< Module::LookupInfo > m_lookups
void Dump(Stream *s) const override
Standard "Dump" method. At present it does nothing.
Searcher::CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr) override
lldb::BreakpointResolverSP CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override
StructuredData::ObjectSP SerializeToStructuredData() override
Breakpoint::MatchType m_match_type
lldb::LanguageType m_language
BreakpointResolverName(const lldb::BreakpointSP &bkpt, const char *name, lldb::FunctionNameType name_type_mask, lldb::LanguageType language, Breakpoint::MatchType type, lldb::addr_t offset, bool skip_prologue)
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &data_dict, Status &error)
void GetDescription(Stream *s) override
Prints a canonical description for the breakpoint to the stream s.
RegularExpression m_regex
lldb::SearchDepth GetDepth() override
General Outline: The BreakpointResolver is a Searcher.
lldb::BreakpointLocationSP AddLocation(Address loc_addr, bool *new_location=nullptr)
static const char * GetKey(OptionNames enum_value)
StructuredData::DictionarySP WrapOptionsDict(StructuredData::DictionarySP options_dict_sp)
lldb::BreakpointSP GetBreakpoint() const
This gets the breakpoint for this resolver.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
MatchType
An enum specifying the match style for breakpoint settings.
Target & GetTarget()
Accessor for the breakpoint Target.
bool IsInternal() const
Tell whether this breakpoint is an "internal" breakpoint.
Represents a generic declaration context in a program.
A uniqued constant string class.
static Language * FindPlugin(lldb::LanguageType language)
static const char * GetNameForLanguageType(lldb::LanguageType language)
static lldb::LanguageType GetPrimaryLanguage(lldb::LanguageType language)
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
static void ForEach(std::function< bool(Language *)> callback)
void void void void void Warning(const char *fmt,...) __attribute__((format(printf
A class that encapsulates name lookup information.
void SetLookupName(ConstString name)
bool IsValid() const
Test if this object contains a valid regular expression.
llvm::StringRef GetText() const
Access the regular expression text.
General Outline: Provides the callback and search depth for the SearchFilter search.
virtual bool AddressPasses(Address &addr)
Call this method with a Address to see if address passes the filter.
virtual bool CompUnitPasses(FileSpec &fileSpec)
Call this method with a FileSpec to see if file spec passes the filter as the name of a compilation u...
virtual uint32_t GetFilterRequiredItems()
This determines which items are REQUIRED for the filter to pass.
@ eCallbackReturnContinue
static Status FromErrorString(const char *str)
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
const char * GetData() const
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< IntType > GetItemAtIndexAsInteger(size_t idx) const
std::optional< llvm::StringRef > GetItemAtIndexAsString(size_t idx) const
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) 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< UnsignedInteger > UnsignedIntegerSP
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.
lldb::LanguageType GetLanguage() const
lldb::ModuleSP module_sp
The Module for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
Address GetAddress() const
Symbol * ResolveReExportedSymbol(Target &target) const
Architecture * GetArchitecturePlugin() const
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
@ eDescriptionLevelVerbose
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
Options used by Module::FindFunctions.
bool include_inlines
Include inlined functions.
bool include_symbols
Include the symbol table.