39 "SymbolName",
"SourceRegex",
40 "Python",
"Exception",
44 BreakpointResolver::OptionNames::LastOptionName)] = {
45 "AddressOffset",
"Exact",
"FileName",
"Inlines",
"Language",
46 "LineNumber",
"Column",
"ModuleName",
"NameMask",
"Offset",
47 "PythonClass",
"Regex",
"ScriptArgs",
"SectionName",
"SearchDepth",
48 "SkipPrologue",
"SymbolNames"};
67 const unsigned char resolverTy,
69 : m_breakpoint(bkpt), m_offset(offset), SubclassID(resolverTy) {}
77 error.SetErrorString(
"Can't deserialize from an invalid data object.");
81 llvm::StringRef subclass_name;
87 error.SetErrorString(
"Resolver data missing subclass resolver key");
93 error.SetErrorStringWithFormatv(
"Unknown resolver type: {0}.",
101 if (!success || !subclass_options || !subclass_options->
IsValid()) {
102 error.SetErrorString(
"Resolver data missing subclass options key.");
110 error.SetErrorString(
"Resolver data missing offset options key.");
114 switch (resolver_type) {
117 *subclass_options,
error);
121 *subclass_options,
error);
125 *subclass_options,
error);
129 *subclass_options,
error);
133 *subclass_options,
error);
136 error.SetErrorString(
"Exception resolvers are hard.");
139 llvm_unreachable(
"Should never get an unresolvable resolver type.");
142 if (
error.Fail() || !result_sp)
146 result_sp->SetOffset(offset);
152 if (!options_dict_sp || !options_dict_sp->IsValid())
184 SourceLoc(uint32_t
l, std::optional<uint16_t> c)
187 : line(sc.line_entry.line),
188 column(sc.line_entry.column ? sc.line_entry.column
192bool operator<(
const SourceLoc lhs,
const SourceLoc rhs) {
193 if (lhs.line < rhs.line)
195 if (lhs.line > rhs.line)
199 return lhs.column < rhs.column;
205 llvm::StringRef log_ident, uint32_t line, std::optional<uint16_t> column) {
206 llvm::SmallVector<SymbolContext, 16> all_scs;
208 for (
const auto &sc : sc_list) {
210 .GetEnableFilterForLineBreakpoints())
214 all_scs.push_back(sc);
217 while (all_scs.size()) {
221 auto &match = all_scs[0];
222 auto worklist_begin = std::partition(
223 all_scs.begin(), all_scs.end(), [&](
const SymbolContext &sc) {
224 if (sc.line_entry.GetFile() == match.line_entry.GetFile() ||
225 sc.line_entry.original_file_sp->Equal(
226 *match.line_entry.original_file_sp,
227 SupportFile::eEqualFileSpecAndChecksumIfSet)) {
229 closest_line = std::min(closest_line, sc.line_entry.line);
236 auto worklist_end = all_scs.end();
242 SourceLoc requested(line, *column);
244 worklist_end = std::remove_if(
245 worklist_begin, worklist_end,
246 [&](
const SymbolContext &sc) {
return requested < SourceLoc(sc); });
248 llvm::sort(worklist_begin, worklist_end,
250 return SourceLoc(a) < SourceLoc(b);
254 if (worklist_begin != worklist_end)
255 worklist_end = std::remove_if(
257 return SourceLoc(*worklist_begin) < SourceLoc(sc);
264 worklist_end = std::remove_if(worklist_begin, worklist_end,
271 llvm::sort(worklist_begin, worklist_end,
280 llvm::SmallDenseSet<Block *, 8> blocks_with_breakpoints;
281 for (
auto first = worklist_begin; first != worklist_end; ++first) {
282 assert(!blocks_with_breakpoints.count(first->block));
283 blocks_with_breakpoints.insert(first->block);
285 std::remove_if(std::next(first), worklist_end,
287 return blocks_with_breakpoints.count(sc.
block);
292 for (
auto &sc : llvm::make_range(worklist_begin, worklist_end))
296 all_scs.erase(worklist_begin, all_scs.end());
303 llvm::StringRef log_ident) {
308 "error: Unable to set breakpoint %s at file address "
316 "Breakpoint %s at file address 0x%" PRIx64
317 " didn't pass the filter.\n",
322 bool skipped_prologue =
false;
325 if (prologue_addr.
IsValid() && (line_start == prologue_addr)) {
327 if (prologue_byte_size) {
328 prologue_addr.
Slide(prologue_byte_size);
331 skipped_prologue =
true;
332 line_start = prologue_addr;
342 LLDB_LOGF(log,
"Added location (skipped prologue: %s): %s \n",
343 skipped_prologue ?
"yes" :
"no", s.
GetData());
348 bool *new_location) {
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
Address & GetBaseAddress()
Get accessor for the base address of the range.
A section + offset based address class.
bool Slide(int64_t offset)
lldb::addr_t GetFileAddress() const
Get the file address.
bool IsValid() const
Check if the object state is valid.
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &options_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &data_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &options_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &data_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &options_dict, Status &error)
const char * GetResolverName()
BreakpointResolver(const lldb::BreakpointSP &bkpt, unsigned char resolverType, lldb::addr_t offset=0)
The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint to make sense.
void SetBreakpoint(const lldb::BreakpointSP &bkpt)
This sets the breakpoint for this resolver.
~BreakpointResolver() override
The Destructor is virtual, all significant breakpoint resolvers derive from this class.
lldb::BreakpointLocationSP AddLocation(Address loc_addr, bool *new_location=nullptr)
static const char * GetKey(OptionNames enum_value)
static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &resolver_dict, Status &error)
This section handles serializing and deserializing from StructuredData objects.
static ResolverTy NameToResolverTy(llvm::StringRef name)
StructuredData::DictionarySP WrapOptionsDict(StructuredData::DictionarySP options_dict_sp)
ResolverTy
An enumeration for keeping track of the concrete subclass that is actually instantiated.
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 ...
lldb::BreakpointSP GetBreakpoint() const
This gets the breakpoint for this resolver.
void SetOffset(lldb::addr_t offset)
This updates the offset for this breakpoint.
static const char * g_option_names[static_cast< uint32_t >(OptionNames::LastOptionName)]
static const char * ResolverTyToName(enum ResolverTy)
virtual void NotifyBreakpointSet()
static const char * g_ty_to_name[LastKnownResolverType+2]
static const char * GetSerializationSubclassKey()
virtual void ResolveBreakpointInModules(SearchFilter &filter, ModuleList &modules)
In response to this method the resolver scans the modules in the module list modules,...
static const char * GetSerializationSubclassOptionsKey()
virtual void ResolveBreakpoint(SearchFilter &filter)
In response to this method the resolver scans all the modules in the breakpoint's target,...
lldb::BreakpointWP m_breakpoint
const AddressRange & GetAddressRange()
uint32_t GetPrologueByteSize()
Get the size of the prologue instructions for this function.
virtual bool IgnoreForLineBreakpoints(const SymbolContext &) const
Returns true if this SymbolContext should be ignored when setting breakpoints by line (number or rege...
static Language * FindPlugin(lldb::LanguageType language)
static LanguageProperties & GetGlobalLanguageProperties()
A collection class for Module objects.
General Outline: Provides the callback and search depth for the SearchFilter search.
virtual void SearchInModuleList(Searcher &searcher, ModuleList &modules)
Call this method to do the search using the Searcher in the module list modules.
virtual bool AddressPasses(Address &addr)
Call this method with a Address to see if address passes the filter.
virtual void Search(Searcher &searcher)
Call this method to do the search using the Searcher.
const char * GetData() const
bool GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const
bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result) const
bool GetValueForKeyAsDictionary(llvm::StringRef key, Dictionary *&result) const
virtual bool IsValid() const
std::shared_ptr< Dictionary > DictionarySP
Defines a list of symbol context objects.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Block * block
The Block for a given query.
LineEntry line_entry
The LineEntry for a given query.
#define LLDB_INVALID_COLUMN_NUMBER
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.
bool operator<(const Address &lhs, const Address &rhs)
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
AddressRange range
The section offset address range for this line entry.
uint32_t line
The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line number information.