39 "SymbolName",
"SourceRegex",
40 "Python",
"Exception",
45 "AddressOffset",
"Exact",
"FileName",
"Inlines",
"Language",
46 "LineNumber",
"Column",
"ModuleName",
"NameMask",
"Offset",
47 "PythonClass",
"Regex",
"ScriptArgs",
"SectionName",
"SearchDepth",
48 "SkipPrologue",
"SymbolNames"};
67 if (mask == eResolverUnknown)
78 return eResolverFileAndLine;
80 return eResolverAddress;
84 return eResolverFileRegex;
86 return eResolverPython;
88 return eResolverException;
90 return eResolverUnknown;
96 if (mask & eResolverFileAndLine)
97 result.push_back(
'F');
98 if (mask & eResolverAddress)
99 result.push_back(
'A');
100 if (mask & eResolverName)
101 result.push_back(
'N');
102 if (mask & eResolverFileRegex)
103 result.push_back(
'S');
104 if (mask & eResolverPython)
105 result.push_back(
'P');
106 if (mask & eResolverException)
107 result.push_back(
'E');
118 const unsigned char resolverTy,
120 bool offset_is_insn_count)
129 if (!resolver_dict.
IsValid()) {
131 "Can't deserialize from an invalid data object.");
135 llvm::StringRef subclass_name;
156 if (!success || !subclass_options || !subclass_options->
IsValid()) {
171 switch (resolver_type) {
174 *subclass_options,
error);
178 *subclass_options,
error);
182 *subclass_options,
error);
186 *subclass_options,
error);
190 *subclass_options,
error);
196 llvm_unreachable(
"Should never get an unresolvable resolver type.");
199 if (
error.Fail() || !result_sp)
203 result_sp->SetOffset(offset);
209 if (!options_dict_sp || !options_dict_sp->IsValid())
241 SourceLoc(uint32_t
l, std::optional<uint16_t> c)
244 : line(sc.line_entry.line),
245 column(sc.line_entry.column ? sc.line_entry.column
249bool operator<(
const SourceLoc lhs,
const SourceLoc rhs) {
250 if (lhs.line < rhs.line)
252 if (lhs.line > rhs.line)
256 return lhs.column < rhs.column;
262 llvm::StringRef log_ident, uint32_t line, std::optional<uint16_t> column) {
263 llvm::SmallVector<SymbolContext, 16> all_scs(sc_list.
begin(), sc_list.
end());
269 .GetEnableFilterForLineBreakpoints())
271 lang->FilterForLineBreakpoints(all_scs);
273 while (all_scs.size()) {
277 auto &match = all_scs[0];
278 auto worklist_begin = std::partition(
279 all_scs.begin(), all_scs.end(), [&](
const SymbolContext &sc) {
280 if (sc.line_entry.GetFile() == match.line_entry.GetFile() ||
281 sc.line_entry.original_file_sp->Equal(
282 *match.line_entry.original_file_sp,
283 SupportFile::eEqualFileSpecAndChecksumIfSet)) {
285 closest_line = std::min(closest_line, sc.line_entry.line);
292 auto worklist_end = all_scs.end();
298 SourceLoc requested(line, *column);
300 worklist_end = std::remove_if(
301 worklist_begin, worklist_end,
302 [&](
const SymbolContext &sc) {
return requested < SourceLoc(sc); });
304 llvm::sort(worklist_begin, worklist_end,
306 return SourceLoc(a) < SourceLoc(b);
310 if (worklist_begin != worklist_end)
311 worklist_end = std::remove_if(
313 return SourceLoc(*worklist_begin) < SourceLoc(sc);
320 worklist_end = std::remove_if(worklist_begin, worklist_end,
327 llvm::sort(worklist_begin, worklist_end,
336 llvm::SmallDenseSet<Block *, 8> blocks_with_breakpoints;
337 for (
auto first = worklist_begin; first != worklist_end; ++first) {
338 assert(!blocks_with_breakpoints.count(first->block));
339 blocks_with_breakpoints.insert(first->block);
341 std::remove_if(std::next(first), worklist_end,
343 return blocks_with_breakpoints.count(sc.
block);
348 for (
auto &sc : llvm::make_range(worklist_begin, worklist_end))
352 all_scs.erase(worklist_begin, all_scs.end());
359 llvm::StringRef log_ident) {
364 "error: Unable to set breakpoint %s at file address "
372 "Breakpoint %s at file address 0x%" PRIx64
373 " didn't pass the filter.\n",
378 bool skipped_prologue =
false;
381 if (prologue_addr.
IsValid() && (line_start == prologue_addr)) {
383 if (prologue_byte_size) {
384 prologue_addr.
Slide(prologue_byte_size);
387 skipped_prologue =
true;
388 line_start = prologue_addr;
399 if (!skipped_prologue && bp_loc_sp &&
405 if (!bp_loc_sp->SetPreferredLineEntry(sc.
line_entry)) {
406 LLDB_LOG(log,
"Tried to add a preferred line entry that didn't have the "
407 "same address as this location's address.");
413 LLDB_LOGF(log,
"Added location (skipped prologue: %s): %s \n",
414 skipped_prologue ?
"yes" :
"no", s.
GetData());
419 bool *new_location) {
422 llvm::Expected<DisassemblerSP> expected_instructions =
424 if (!expected_instructions) {
426 expected_instructions.takeError(),
427 "error: Unable to read instructions at address 0x{0:x}",
434 instructions->GetInstructionList().GetSize() !=
m_offset) {
436 "error: Unable to read {0} instructions at address 0x{1:x}",
441 loc_addr.
Slide(instructions->GetInstructionList().GetTotalByteSize());
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,...)
#define LLDB_LOG_ERROR(log, error,...)
Address & GetBaseAddress()
Get accessor for the base address of the range.
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
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)
bool ResolverTyInMask(uint64_t mask)
This checks whether the resolver's type matches the enum lldb::BreakpointResolverType.
const char * GetResolverName()
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)
enum ResolverTy GetResolverTy()
const unsigned char SubclassID
ResolverTy
An enumeration for keeping track of the concrete subclass that is actually instantiated.
uint64_t MaskForResolverTy()
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)
static bool TypeMaskIsValid(uint64_t mask)
virtual void NotifyBreakpointSet()
static std::string DescribeMask(uint64_t mask)
bool m_offset_is_insn_count
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
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.
const Address & GetAddress() const
Return the address of the function (its entry point).
uint32_t GetPrologueByteSize()
Get the size of the prologue instructions for this function.
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.
const_iterator begin() const
const_iterator end() const
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.
llvm::Expected< lldb::DisassemblerSP > ReadInstructions(const Address &start_addr, uint32_t count, const char *flavor_string=nullptr)
#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)
constexpr unsigned BreakpointResolverAllResolversMask
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
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.