38 "SymbolName",
"SourceRegex",
39 "Python",
"Exception",
43 BreakpointResolver::OptionNames::LastOptionName)] = {
44 "AddressOffset",
"Exact",
"FileName",
"Inlines",
"Language",
45 "LineNumber",
"Column",
"ModuleName",
"NameMask",
"Offset",
46 "PythonClass",
"Regex",
"ScriptArgs",
"SectionName",
"SearchDepth",
47 "SkipPrologue",
"SymbolNames"};
66 const unsigned char resolverTy,
68 : m_breakpoint(bkpt), m_offset(offset), SubclassID(resolverTy) {}
76 error.SetErrorString(
"Can't deserialize from an invalid data object.");
80 llvm::StringRef subclass_name;
86 error.SetErrorString(
"Resolver data missing subclass resolver key");
92 error.SetErrorStringWithFormatv(
"Unknown resolver type: {0}.",
100 if (!success || !subclass_options || !subclass_options->
IsValid()) {
101 error.SetErrorString(
"Resolver data missing subclass options key.");
109 error.SetErrorString(
"Resolver data missing offset options key.");
113 switch (resolver_type) {
116 nullptr, *subclass_options,
error);
120 nullptr, *subclass_options,
error);
124 nullptr, *subclass_options,
error);
128 nullptr, *subclass_options,
error);
132 nullptr, *subclass_options,
error);
135 error.SetErrorString(
"Exception resolvers are hard.");
138 llvm_unreachable(
"Should never get an unresolvable resolver type.");
141 if (
error.Fail() || !result_sp)
145 result_sp->SetOffset(offset);
151 if (!options_dict_sp || !options_dict_sp->IsValid())
183 SourceLoc(uint32_t
l, std::optional<uint16_t> c)
186 : line(sc.line_entry.line),
187 column(sc.line_entry.column ? sc.line_entry.column
191bool operator<(
const SourceLoc lhs,
const SourceLoc rhs) {
192 if (lhs.line < rhs.line)
194 if (lhs.line > rhs.line)
198 return lhs.column < rhs.column;
204 llvm::StringRef log_ident, uint32_t line, std::optional<uint16_t> column) {
205 llvm::SmallVector<SymbolContext, 16> all_scs;
206 for (uint32_t i = 0; i < sc_list.
GetSize(); ++i)
207 all_scs.push_back(sc_list[i]);
209 while (all_scs.size()) {
213 auto &match = all_scs[0];
214 auto worklist_begin = std::partition(
215 all_scs.begin(), all_scs.end(), [&](
const SymbolContext &sc) {
216 if (sc.line_entry.file == match.line_entry.file ||
217 sc.line_entry.original_file == match.line_entry.original_file) {
219 closest_line = std::min(closest_line, sc.line_entry.line);
226 auto worklist_end = all_scs.end();
232 SourceLoc requested(line, *column);
234 worklist_end = std::remove_if(
235 worklist_begin, worklist_end,
236 [&](
const SymbolContext &sc) {
return requested < SourceLoc(sc); });
238 llvm::sort(worklist_begin, worklist_end,
240 return SourceLoc(a) < SourceLoc(b);
244 if (worklist_begin != worklist_end)
245 worklist_end = std::remove_if(
247 return SourceLoc(*worklist_begin) < SourceLoc(sc);
254 worklist_end = std::remove_if(worklist_begin, worklist_end,
261 llvm::sort(worklist_begin, worklist_end,
270 llvm::SmallDenseSet<Block *, 8> blocks_with_breakpoints;
271 for (
auto first = worklist_begin; first != worklist_end; ++first) {
272 assert(!blocks_with_breakpoints.count(first->block));
273 blocks_with_breakpoints.insert(first->block);
275 std::remove_if(std::next(first), worklist_end,
277 return blocks_with_breakpoints.count(sc.
block);
282 for (
auto &sc : llvm::make_range(worklist_begin, worklist_end))
286 all_scs.erase(worklist_begin, all_scs.end());
293 llvm::StringRef log_ident) {
298 "error: Unable to set breakpoint %s at file address "
306 "Breakpoint %s at file address 0x%" PRIx64
307 " didn't pass the filter.\n",
312 bool skipped_prologue =
false;
315 if (prologue_addr.
IsValid() && (line_start == prologue_addr)) {
317 if (prologue_byte_size) {
318 prologue_addr.
Slide(prologue_byte_size);
321 skipped_prologue =
true;
322 line_start = prologue_addr;
332 LLDB_LOGF(log,
"Added location (skipped prologue: %s): %s \n",
333 skipped_prologue ?
"yes" :
"no", s.
GetData());
338 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 lldb::BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const lldb::BreakpointSP &bkpt, const StructuredData::Dictionary &data_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const lldb::BreakpointSP &bkpt, const StructuredData::Dictionary &options_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const lldb::BreakpointSP &bkpt, const StructuredData::Dictionary &data_dict, Status &error)
static lldb::BreakpointResolverSP CreateFromStructuredData(const lldb::BreakpointSP &bkpt, 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.
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.
uint32_t GetSize() const
Get accessor for a symbol context list size.
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 zero if there is no line number information.