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) {}
78 "Can't deserialize from an invalid data object.");
82 llvm::StringRef subclass_name;
103 if (!success || !subclass_options || !subclass_options->
IsValid()) {
118 switch (resolver_type) {
121 *subclass_options,
error);
125 *subclass_options,
error);
129 *subclass_options,
error);
133 *subclass_options,
error);
137 *subclass_options,
error);
143 llvm_unreachable(
"Should never get an unresolvable resolver type.");
146 if (
error.Fail() || !result_sp)
150 result_sp->SetOffset(offset);
156 if (!options_dict_sp || !options_dict_sp->IsValid())
188 SourceLoc(uint32_t
l, std::optional<uint16_t> c)
191 : line(sc.line_entry.line),
192 column(sc.line_entry.column ? sc.line_entry.column
196bool operator<(
const SourceLoc lhs,
const SourceLoc rhs) {
197 if (lhs.line < rhs.line)
199 if (lhs.line > rhs.line)
203 return lhs.column < rhs.column;
209 llvm::StringRef log_ident, uint32_t line, std::optional<uint16_t> column) {
210 llvm::SmallVector<SymbolContext, 16> all_scs;
212 for (
const auto &sc : sc_list) {
214 .GetEnableFilterForLineBreakpoints())
218 all_scs.push_back(sc);
221 while (all_scs.size()) {
225 auto &match = all_scs[0];
226 auto worklist_begin = std::partition(
227 all_scs.begin(), all_scs.end(), [&](
const SymbolContext &sc) {
228 if (sc.line_entry.GetFile() == match.line_entry.GetFile() ||
229 sc.line_entry.original_file_sp->Equal(
230 *match.line_entry.original_file_sp,
231 SupportFile::eEqualFileSpecAndChecksumIfSet)) {
233 closest_line = std::min(closest_line, sc.line_entry.line);
240 auto worklist_end = all_scs.end();
246 SourceLoc requested(line, *column);
248 worklist_end = std::remove_if(
249 worklist_begin, worklist_end,
250 [&](
const SymbolContext &sc) {
return requested < SourceLoc(sc); });
252 llvm::sort(worklist_begin, worklist_end,
254 return SourceLoc(a) < SourceLoc(b);
258 if (worklist_begin != worklist_end)
259 worklist_end = std::remove_if(
261 return SourceLoc(*worklist_begin) < SourceLoc(sc);
268 worklist_end = std::remove_if(worklist_begin, worklist_end,
275 llvm::sort(worklist_begin, worklist_end,
284 llvm::SmallDenseSet<Block *, 8> blocks_with_breakpoints;
285 for (
auto first = worklist_begin; first != worklist_end; ++first) {
286 assert(!blocks_with_breakpoints.count(first->block));
287 blocks_with_breakpoints.insert(first->block);
289 std::remove_if(std::next(first), worklist_end,
291 return blocks_with_breakpoints.count(sc.
block);
296 for (
auto &sc : llvm::make_range(worklist_begin, worklist_end))
300 all_scs.erase(worklist_begin, all_scs.end());
307 llvm::StringRef log_ident) {
312 "error: Unable to set breakpoint %s at file address "
320 "Breakpoint %s at file address 0x%" PRIx64
321 " didn't pass the filter.\n",
326 bool skipped_prologue =
false;
329 if (prologue_addr.
IsValid() && (line_start == prologue_addr)) {
331 if (prologue_byte_size) {
332 prologue_addr.
Slide(prologue_byte_size);
335 skipped_prologue =
true;
336 line_start = prologue_addr;
347 if (!skipped_prologue && bp_loc_sp &&
353 if (!bp_loc_sp->SetPreferredLineEntry(sc.
line_entry)) {
354 LLDB_LOG(log,
"Tried to add a preferred line entry that didn't have the "
355 "same address as this location's address.");
361 LLDB_LOGF(log,
"Added location (skipped prologue: %s): %s \n",
362 skipped_prologue ?
"yes" :
"no", s.
GetData());
367 bool *new_location) {
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#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.
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const
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()
DEPRECATED: Use GetAddressRanges instead.
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.
static Status FromErrorString(const char *str)
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
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
A line table entry class.
static int Compare(const LineEntry &lhs, const LineEntry &rhs)
Compare two LineEntry objects.
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.