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 std::vector<std::string> names,
61 FunctionNameType name_type_mask,
66 m_match_type(
Breakpoint::Exact), m_language(language),
67 m_skip_prologue(skip_prologue) {
68 for (
const std::string &name : names) {
69 AddNameLookup(
ConstString(name.c_str(), name.size()), name_type_mask);
79 m_class_name(nullptr), m_regex(std::move(func_regex)),
80 m_match_type(
Breakpoint::Regexp), m_language(language),
81 m_skip_prologue(skip_prologue) {}
87 m_lookups(rhs.m_lookups), m_class_name(rhs.m_class_name),
88 m_regex(rhs.m_regex), m_match_type(rhs.m_match_type),
89 m_language(rhs.m_language), m_skip_prologue(rhs.m_skip_prologue) {}
95 llvm::StringRef language_name;
101 error.SetErrorStringWithFormatv(
"BRN::CFSD: Unknown language: {0}.",
111 error.SetErrorString(
"BRN::CFSD: Missing offset entry.");
119 error.SetErrorString(
"BRN::CFSD: Missing Skip prologue entry.");
123 llvm::StringRef regex_text;
128 language, offset, skip_prologue);
134 error.SetErrorString(
"BRN::CFSD: Missing symbol names entry.");
141 error.SetErrorString(
"BRN::CFSD: Missing symbol names mask entry.");
145 size_t num_elem = names_array->
GetSize();
146 if (num_elem != names_mask_array->
GetSize()) {
147 error.SetErrorString(
148 "BRN::CFSD: names and names mask arrays have different sizes.");
153 error.SetErrorString(
154 "BRN::CFSD: no name entry in a breakpoint by name breakpoint.");
157 std::vector<std::string> names;
158 std::vector<FunctionNameType> name_masks;
159 for (
size_t i = 0; i < num_elem; i++) {
160 llvm::StringRef name;
164 error.SetErrorString(
"BRN::CFSD: name entry is not a string.");
167 std::underlying_type<FunctionNameType>::type fnt;
170 error.SetErrorString(
"BRN::CFSD: name mask entry is not an integer.");
173 names.push_back(std::string(name));
174 name_masks.push_back(
static_cast<FunctionNameType
>(fnt));
178 bkpt, names[0].c_str(), name_masks[0], language,
180 for (
size_t i = 1; i < num_elem; i++) {
207 options_dict_sp->AddStringItem(
217 FunctionNameType name_type_mask) {
222 auto add_variant_funcs = [&](
Language *lang) {
224 lang->GetMethodNameVariants(name)) {
226 if (variant.GetType() & lldb::eFunctionNameTypeFull) {
228 lang->GetLanguageType());
237 add_variant_funcs(lang);
259 log->
Warning(
"Class/method function specification not supported yet.\n");
276 const size_t start_func_idx = func_list.
GetSize();
278 function_options, func_list);
280 const size_t end_func_idx = func_list.
GetSize();
282 if (start_func_idx < end_func_idx)
283 lookup.Prune(func_list, start_func_idx);
294 log->
Warning(
"glob is not supported yet.");
300 if (filter_by_cu || filter_by_language) {
303 for (
size_t idx = 0; idx < num_functions; idx++) {
304 bool remove_it =
false;
312 if (filter_by_language) {
335 bool is_reexported =
false;
337 if (sc.block && sc.block->GetInlinedFunctionInfo()) {
338 if (!sc.block->GetStartAddress(break_addr))
340 }
else if (sc.function) {
341 break_addr = sc.function->GetAddressRange().GetBaseAddress();
343 const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
344 if (prologue_byte_size)
347 }
else if (sc.symbol) {
349 const Symbol *actual_symbol =
352 is_reexported =
true;
356 break_addr = sc.symbol->GetAddress();
360 const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
361 if (prologue_byte_size)
379 BreakpointLocationSP bp_loc_sp(
AddLocation(break_addr, &new_location));
380 bp_loc_sp->SetIsReExported(is_reexported);
381 if (bp_loc_sp && new_location && !breakpoint.
IsInternal()) {
406 for (
size_t i = 0; i < num_names; i++) {
407 s->
Printf(
"%s'%s'", (i == 0 ?
"" :
", "),
420lldb::BreakpointResolverSP
423 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 BreakpointResolver * CreateFromStructuredData(const lldb::BreakpointSP &bkpt, 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
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.
bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result) const
bool GetItemAtIndexAsInteger(size_t idx, IntType &result) 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.
@ eDescriptionLevelVerbose
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
Options used by Module::FindFunctions.
bool include_inlines
Include inlined functions.
bool include_symbols
Include the symbol table.