LLDB mainline
lldb_private::BreakpointResolver Class Referenceabstract

General Outline: The BreakpointResolver is a Searcher. More...

#include <BreakpointResolver.h>

Inheritance diagram for lldb_private::BreakpointResolver:
[legend]

Public Types

enum  ResolverTy {
  FileLineResolver = 0 , AddressResolver , NameResolver , FileRegexResolver ,
  PythonResolver , ExceptionResolver , LastKnownResolverType = ExceptionResolver , UnknownResolver
}
 An enumeration for keeping track of the concrete subclass that is actually instantiated. More...
Public Types inherited from lldb_private::Searcher
enum  CallbackReturn { eCallbackReturnStop = 0 , eCallbackReturnContinue , eCallbackReturnPop }

Public Member Functions

 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.
 ~BreakpointResolver () override
 The Destructor is virtual, all significant breakpoint resolvers derive from this class.
void SetBreakpoint (const lldb::BreakpointSP &bkpt)
 This sets the breakpoint for this resolver.
lldb::BreakpointSP GetBreakpoint () const
 This gets the breakpoint for this resolver.
void SetOffset (lldb::addr_t offset)
 This updates the offset for this breakpoint.
lldb::addr_t GetOffset () const
lldb::addr_t GetOffsetIsInsnCount () const
virtual void ResolveBreakpoint (SearchFilter &filter)
 In response to this method the resolver scans all the modules in the breakpoint's target, and adds any new locations it finds.
virtual void ResolveBreakpointInModules (SearchFilter &filter, ModuleList &modules)
 In response to this method the resolver scans the modules in the module list modules, and adds any new locations it finds.
void GetDescription (Stream *s) override=0
 Prints a canonical description for the breakpoint to the stream s.
virtual void Dump (Stream *s) const =0
 Standard "Dump" method. At present it does nothing.
virtual StructuredData::ObjectSP SerializeToStructuredData ()
StructuredData::DictionarySP WrapOptionsDict (StructuredData::DictionarySP options_dict_sp)
unsigned getResolverID () const
 getResolverID - Return an ID for the concrete type of this object.
enum ResolverTy GetResolverTy ()
const char * GetResolverName ()
virtual lldb::BreakpointResolverSP CopyForBreakpoint (lldb::BreakpointSP &breakpoint)=0
Public Member Functions inherited from lldb_private::Searcher
 Searcher ()
virtual ~Searcher ()
virtual CallbackReturn SearchCallback (SearchFilter &filter, SymbolContext &context, Address *addr)=0
virtual lldb::SearchDepth GetDepth ()=0

Static Public Member Functions

static lldb::BreakpointResolverSP CreateFromStructuredData (const StructuredData::Dictionary &resolver_dict, Status &error)
 This section handles serializing and deserializing from StructuredData objects.
static const char * GetSerializationKey ()
static const char * GetSerializationSubclassKey ()
static const char * GetSerializationSubclassOptionsKey ()
static const char * ResolverTyToName (enum ResolverTy)
static ResolverTy NameToResolverTy (llvm::StringRef name)
static const char * GetKey (OptionNames enum_value)

Static Public Attributes

static const char * g_ty_to_name [LastKnownResolverType+2]

Protected Types

enum class  OptionNames : uint32_t {
  AddressOffset = 0 , ExactMatch , FileName , Inlines ,
  LanguageName , LineNumber , Column , ModuleName ,
  NameMaskArray , Offset , PythonClassName , RegexString ,
  ScriptArgs , SectionName , SearchDepth , SkipPrologue ,
  SymbolNameArray , LastOptionName
}

Protected Member Functions

virtual void NotifyBreakpointSet ()
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 CU, and find the nearest actual line number that matches, and then filter down the matching addresses to unique entries, and skip the prologue if asked to do so, and then set breakpoint locations in this breakpoint for all the resultant addresses.
void SetSCMatchesByLine (SearchFilter &, SymbolContextList &, bool, const char *)=delete
lldb::BreakpointLocationSP AddLocation (Address loc_addr, bool *new_location=nullptr)

Static Protected Attributes

static const char * g_option_names [static_cast< uint32_t >(OptionNames::LastOptionName)]

Private Member Functions

void AddLocation (SearchFilter &filter, const SymbolContext &sc, bool skip_prologue, llvm::StringRef log_ident)
 Helper for SetSCMatchesByLine.
 BreakpointResolver (const BreakpointResolver &)=delete
const BreakpointResolveroperator= (const BreakpointResolver &)=delete

Private Attributes

lldb::BreakpointWP m_breakpoint
lldb::addr_t m_offset
bool m_offset_is_insn_count
const unsigned char SubclassID

Friends

class Breakpoint

Detailed Description

General Outline: The BreakpointResolver is a Searcher.

"lldb/Breakpoint/BreakpointResolver.h" This class works with SearchFilter to resolve logical breakpoints to their of concrete breakpoint locations.

In that protocol, the SearchFilter asks the question "At what depth of the symbol context descent do you want your callback to get called?" of the filter. The resolver answers this question (in the GetDepth method) and provides the resolution callback. Each Breakpoint has a BreakpointResolver, and it calls either ResolveBreakpoint or ResolveBreakpointInModules to tell it to look for new breakpoint locations.

Definition at line 36 of file BreakpointResolver.h.

Member Enumeration Documentation

◆ OptionNames

enum class lldb_private::BreakpointResolver::OptionNames : uint32_t
strongprotected
Enumerator
AddressOffset 
ExactMatch 
FileName 
Inlines 
LanguageName 
LineNumber 
Column 
ModuleName 
NameMaskArray 
Offset 
PythonClassName 
RegexString 
ScriptArgs 
SectionName 
SearchDepth 
SkipPrologue 
SymbolNameArray 
LastOptionName 

Definition at line 168 of file BreakpointResolver.h.

◆ ResolverTy

An enumeration for keeping track of the concrete subclass that is actually instantiated.

Values of this enumeration are kept in the BreakpointResolver's SubclassID field. They are used for concrete type identification.

Enumerator
FileLineResolver 
AddressResolver 
NameResolver 
FileRegexResolver 
PythonResolver 
ExceptionResolver 
LastKnownResolverType 
UnknownResolver 

Definition at line 129 of file BreakpointResolver.h.

Constructor & Destructor Documentation

◆ BreakpointResolver() [1/2]

BreakpointResolver::BreakpointResolver ( const lldb::BreakpointSP & bkpt,
unsigned char resolverType,
lldb::addr_t offset = 0,
bool offset_is_insn_count = false )

◆ ~BreakpointResolver()

BreakpointResolver::~BreakpointResolver ( )
overridedefault

The Destructor is virtual, all significant breakpoint resolvers derive from this class.

◆ BreakpointResolver() [2/2]

lldb_private::BreakpointResolver::BreakpointResolver ( const BreakpointResolver & )
privatedelete

References BreakpointResolver().

Member Function Documentation

◆ AddLocation() [1/2]

◆ AddLocation() [2/2]

◆ CopyForBreakpoint()

◆ CreateFromStructuredData()

◆ Dump()

virtual void lldb_private::BreakpointResolver::Dump ( Stream * s) const
pure virtual

◆ GetBreakpoint()

◆ GetDescription()

void lldb_private::BreakpointResolver::GetDescription ( Stream * s)
overridepure virtual

Prints a canonical description for the breakpoint to the stream s.

Parameters
[in]sStream to which the output is copied.

Reimplemented from lldb_private::Searcher.

Implemented in ExceptionBreakpointResolver, lldb_private::BreakpointResolverAddress, lldb_private::BreakpointResolverFileLine, lldb_private::BreakpointResolverFileRegex, lldb_private::BreakpointResolverName, and lldb_private::BreakpointResolverScripted.

◆ GetKey()

◆ GetOffset()

lldb::addr_t lldb_private::BreakpointResolver::GetOffset ( ) const
inline

◆ GetOffsetIsInsnCount()

lldb::addr_t lldb_private::BreakpointResolver::GetOffsetIsInsnCount ( ) const
inline

◆ getResolverID()

unsigned lldb_private::BreakpointResolver::getResolverID ( ) const
inline

getResolverID - Return an ID for the concrete type of this object.

This is used to implement the LLVM classof checks. This should not be used for any other purpose, as the values may change as LLDB evolves.

Definition at line 147 of file BreakpointResolver.h.

References SubclassID.

Referenced by ExceptionBreakpointResolver::classof(), lldb_private::BreakpointResolverAddress::classof(), lldb_private::BreakpointResolverFileLine::classof(), lldb_private::BreakpointResolverFileRegex::classof(), lldb_private::BreakpointResolverName::classof(), and lldb_private::BreakpointResolverScripted::classof().

◆ GetResolverName()

const char * lldb_private::BreakpointResolver::GetResolverName ( )
inline

Definition at line 155 of file BreakpointResolver.h.

References GetResolverTy(), and ResolverTyToName().

Referenced by WrapOptionsDict().

◆ GetResolverTy()

enum ResolverTy lldb_private::BreakpointResolver::GetResolverTy ( )
inline

Definition at line 149 of file BreakpointResolver.h.

References LastKnownResolverType, SubclassID, and UnknownResolver.

Referenced by GetResolverName().

◆ GetSerializationKey()

const char * lldb_private::BreakpointResolver::GetSerializationKey ( )
inlinestatic

◆ GetSerializationSubclassKey()

const char * lldb_private::BreakpointResolver::GetSerializationSubclassKey ( )
inlinestatic

Definition at line 118 of file BreakpointResolver.h.

Referenced by CreateFromStructuredData(), and WrapOptionsDict().

◆ GetSerializationSubclassOptionsKey()

const char * lldb_private::BreakpointResolver::GetSerializationSubclassOptionsKey ( )
inlinestatic

Definition at line 120 of file BreakpointResolver.h.

Referenced by CreateFromStructuredData(), and WrapOptionsDict().

◆ NameToResolverTy()

BreakpointResolver::ResolverTy BreakpointResolver::NameToResolverTy ( llvm::StringRef name)
static

Definition at line 58 of file BreakpointResolver.cpp.

References g_ty_to_name, LastKnownResolverType, and UnknownResolver.

Referenced by CreateFromStructuredData().

◆ NotifyBreakpointSet()

virtual void lldb_private::BreakpointResolver::NotifyBreakpointSet ( )
inlineprotectedvirtual

Reimplemented in lldb_private::BreakpointResolverScripted.

Definition at line 191 of file BreakpointResolver.h.

Referenced by SetBreakpoint().

◆ operator=()

const BreakpointResolver & lldb_private::BreakpointResolver::operator= ( const BreakpointResolver & )
privatedelete

References BreakpointResolver().

◆ ResolveBreakpoint()

void BreakpointResolver::ResolveBreakpoint ( SearchFilter & filter)
virtual

In response to this method the resolver scans all the modules in the breakpoint's target, and adds any new locations it finds.

Parameters
[in]filterThe filter that will manage the search for this resolver.

Reimplemented in lldb_private::BreakpointResolverAddress.

Definition at line 182 of file BreakpointResolver.cpp.

References lldb_private::SearchFilter::Search().

Referenced by lldb_private::BreakpointResolverAddress::ResolveBreakpoint().

◆ ResolveBreakpointInModules()

void BreakpointResolver::ResolveBreakpointInModules ( SearchFilter & filter,
ModuleList & modules )
virtual

In response to this method the resolver scans the modules in the module list modules, and adds any new locations it finds.

Parameters
[in]filterThe filter that will manage the search for this resolver.

Reimplemented in lldb_private::BreakpointResolverAddress.

Definition at line 177 of file BreakpointResolver.cpp.

References lldb_private::SearchFilter::SearchInModuleList().

Referenced by lldb_private::BreakpointResolverAddress::ResolveBreakpointInModules().

◆ ResolverTyToName()

const char * BreakpointResolver::ResolverTyToName ( enum ResolverTy type)
static

Definition at line 50 of file BreakpointResolver.cpp.

References g_ty_to_name, LastKnownResolverType, and UnknownResolver.

Referenced by GetResolverName().

◆ SerializeToStructuredData()

◆ SetBreakpoint()

void BreakpointResolver::SetBreakpoint ( const lldb::BreakpointSP & bkpt)

This sets the breakpoint for this resolver.

Parameters
[in]bkptThe breakpoint that owns this resolver.

Definition at line 171 of file BreakpointResolver.cpp.

References m_breakpoint, and NotifyBreakpointSet().

◆ SetOffset()

void BreakpointResolver::SetOffset ( lldb::addr_t offset)

This updates the offset for this breakpoint.

All the locations currently set for this breakpoint will have their offset adjusted when this is called.

Parameters
[in]offsetThe offset to add to all locations.

Definition at line 398 of file BreakpointResolver.cpp.

References m_offset.

◆ SetSCMatchesByLine() [1/2]

void lldb_private::BreakpointResolver::SetSCMatchesByLine ( SearchFilter & ,
SymbolContextList & ,
bool ,
const char *  )
protecteddelete

◆ SetSCMatchesByLine() [2/2]

void BreakpointResolver::SetSCMatchesByLine ( SearchFilter & filter,
SymbolContextList & sc_list,
bool skip_prologue,
llvm::StringRef log_ident,
uint32_t line = 0,
std::optional< uint16_t > column = std::nullopt )
protected

Takes a symbol context list of matches which supposedly represent the same file and line number in a CU, and find the nearest actual line number that matches, and then filter down the matching addresses to unique entries, and skip the prologue if asked to do so, and then set breakpoint locations in this breakpoint for all the resultant addresses.

When column is nonzero the line and column args are used to filter the results to find the first breakpoint >= (line, column).

Definition at line 209 of file BreakpointResolver.cpp.

References AddLocation(), lldb_private::SymbolContextList::begin(), lldb_private::SymbolContext::block, lldb_private::SymbolContextList::end(), lldb_private::Language::FindPlugin(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Address::GetFileAddress(), lldb_private::Language::GetGlobalLanguageProperties(), lldb_private::SymbolContextList::IsEmpty(), lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, lldb_private::LineEntry::range, and UINT32_MAX.

Referenced by lldb_private::BreakpointResolverFileLine::SearchCallback(), and lldb_private::BreakpointResolverFileRegex::SearchCallback().

◆ WrapOptionsDict()

◆ Breakpoint

Member Data Documentation

◆ g_option_names

const char * BreakpointResolver::g_option_names
staticprotected
Initial value:
= {
"AddressOffset", "Exact", "FileName", "Inlines", "Language",
"LineNumber", "Column", "ModuleName", "NameMask", "Offset",
"PythonClass", "Regex", "ScriptArgs", "SectionName", "SearchDepth",
"SkipPrologue", "SymbolNames"}

Definition at line 189 of file BreakpointResolver.h.

Referenced by GetKey().

◆ g_ty_to_name

const char * BreakpointResolver::g_ty_to_name
static
Initial value:
= {"FileAndLine", "Address",
"SymbolName", "SourceRegex",
"Python", "Exception",
"Unknown"}

Definition at line 142 of file BreakpointResolver.h.

Referenced by NameToResolverTy(), and ResolverTyToName().

◆ m_breakpoint

lldb::BreakpointWP lldb_private::BreakpointResolver::m_breakpoint
private

Definition at line 221 of file BreakpointResolver.h.

Referenced by BreakpointResolver(), GetBreakpoint(), and SetBreakpoint().

◆ m_offset

lldb::addr_t lldb_private::BreakpointResolver::m_offset
private

◆ m_offset_is_insn_count

bool lldb_private::BreakpointResolver::m_offset_is_insn_count
private

Definition at line 224 of file BreakpointResolver.h.

Referenced by AddLocation(), BreakpointResolver(), and GetOffsetIsInsnCount().

◆ SubclassID

const unsigned char lldb_private::BreakpointResolver::SubclassID
private

Definition at line 228 of file BreakpointResolver.h.

Referenced by BreakpointResolver(), getResolverID(), and GetResolverTy().


The documentation for this class was generated from the following files: