33 offset_is_insn_count),
34 m_match_type(type), m_language(language), m_skip_prologue(skip_prologue) {
37 if (!m_regex.IsValid()) {
41 log->
Warning(
"function name regexp: \"%s\" did not compile.",
45 AddNameLookup(
ConstString(name_cstr), name_type_mask);
50 const BreakpointSP &bkpt,
const char *names[],
size_t num_names,
54 m_match_type(
Breakpoint::Exact), m_language(language),
55 m_skip_prologue(skip_prologue) {
56 for (
size_t i = 0; i < num_names; i++) {
57 AddNameLookup(
ConstString(names[i]), name_type_mask);
62 const BreakpointSP &bkpt,
const std::vector<std::string> &names,
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);
94 llvm::StringRef language_name;
101 "BRN::CFSD: Unknown language: {0}.", language_name);
122 llvm::StringRef regex_text;
126 return std::make_shared<BreakpointResolverName>(
142 "BRN::CFSD: Missing symbol names mask entry.");
146 size_t num_elem = names_array->
GetSize();
147 if (num_elem != names_mask_array->
GetSize()) {
149 "BRN::CFSD: names and names mask arrays have different sizes.");
155 "BRN::CFSD: no name entry in a breakpoint by name breakpoint.");
158 std::vector<std::string> names;
159 std::vector<FunctionNameType> name_masks;
160 for (
size_t i = 0; i < num_elem; i++) {
161 std::optional<llvm::StringRef> maybe_name =
169 std::underlying_type<FunctionNameType>::type>(i);
172 "BRN::CFSD: name mask entry is not an integer.");
175 names.push_back(std::string(*maybe_name));
176 name_masks.push_back(
static_cast<FunctionNameType
>(*maybe_fnt));
179 std::shared_ptr<BreakpointResolverName> resolver_sp =
180 std::make_shared<BreakpointResolverName>(
181 nullptr, names[0].c_str(), name_masks[0], language,
183 false, skip_prologue);
184 for (
size_t i = 1; i < num_elem; i++) {
185 resolver_sp->AddNameLookup(
ConstString(names[i]), name_masks[i]);
201 names_sp->AddItem(std::make_shared<StructuredData::String>(
202 lookup.GetName().GetStringRef()));
203 name_masks_sp->AddItem(std::make_shared<StructuredData::UnsignedInteger>(
204 lookup.GetNameTypeMask()));
210 options_dict_sp->AddStringItem(
220 FunctionNameType name_type_mask) {
225 auto add_variant_funcs = [&](
Language *lang) {
227 lang->GetMethodNameVariants(name)) {
229 if (variant.GetType() & lldb::eFunctionNameTypeFull) {
231 lang->GetLanguageType());
240 add_variant_funcs(lang);
262 log->
Warning(
"Class/method function specification not supported yet.\n");
279 const size_t start_func_idx = func_list.
GetSize();
281 function_options, func_list);
283 const size_t end_func_idx = func_list.
GetSize();
285 if (start_func_idx < end_func_idx)
286 lookup.Prune(func_list, start_func_idx);
297 log->
Warning(
"glob is not supported yet.");
303 if (filter_by_cu || filter_by_language) {
304 uint32_t num_functions = func_list.
GetSize();
306 for (
size_t idx = 0; idx < num_functions; idx++) {
307 bool remove_it =
false;
315 if (filter_by_language) {
338 bool is_reexported =
false;
340 if (sc.block && sc.block->GetInlinedFunctionInfo()) {
341 if (!sc.block->GetStartAddress(break_addr))
343 }
else if (sc.function) {
344 break_addr = sc.function->GetAddress();
346 const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
347 if (prologue_byte_size)
350 }
else if (sc.symbol) {
352 const Symbol *actual_symbol =
355 is_reexported =
true;
359 break_addr = sc.symbol->GetAddress();
363 const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
364 if (prologue_byte_size)
383 bp_loc_sp->SetIsReExported(is_reexported);
384 if (bp_loc_sp && new_location && !breakpoint.
IsInternal()) {
409 for (
size_t i = 0; i < num_names; i++) {
410 s->
Printf(
"%s'%s'", (i == 0 ?
"" :
", "),
426 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.
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
BreakpointResolverName(const lldb::BreakpointSP &bkpt, const char *name, lldb::FunctionNameType name_type_mask, lldb::LanguageType language, Breakpoint::MatchType type, lldb::addr_t offset, bool offset_is_insn_count, bool skip_prologue)
lldb::BreakpointResolverSP CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override
StructuredData::ObjectSP SerializeToStructuredData() override
Breakpoint::MatchType m_match_type
lldb::LanguageType m_language
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::addr_t GetOffset() const
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::addr_t GetOffsetIsInsnCount() const
lldb::BreakpointSP GetBreakpoint() const
This gets the breakpoint for this resolver.
BreakpointResolver(const lldb::BreakpointSP &bkpt, unsigned char resolverType, lldb::addr_t offset=0, bool offset_is_insn_count=false)
The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint to make sense.
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)
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< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
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.