LLDB mainline
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
lldb_private::BreakpointResolver Class Referenceabstract

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

#include <BreakpointResolver.h>

Inheritance diagram for lldb_private::BreakpointResolver:
Inheritance graph
[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)
 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
 
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
 
virtual void GetDescription (Stream *s)
 Prints a canonical description for the searcher to the stream s.
 

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
 
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 128 of file BreakpointResolver.h.

Constructor & Destructor Documentation

◆ BreakpointResolver() [1/2]

BreakpointResolver::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.

It can be constructed without a breakpoint, but you have to call SetBreakpoint before ResolveBreakpoint.

Parameters
[in]bkptThe breakpoint that owns this resolver.
[in]resolverTypeThe concrete breakpoint resolver type for this breakpoint.

Definition at line 66 of file BreakpointResolver.cpp.

◆ ~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

Member Function Documentation

◆ AddLocation() [1/2]

BreakpointLocationSP BreakpointResolver::AddLocation ( Address  loc_addr,
bool *  new_location = nullptr 
)
protected

◆ AddLocation() [2/2]

void BreakpointResolver::AddLocation ( SearchFilter filter,
const SymbolContext sc,
bool  skip_prologue,
llvm::StringRef  log_ident 
)
private

◆ CopyForBreakpoint()

virtual lldb::BreakpointResolverSP lldb_private::BreakpointResolver::CopyForBreakpoint ( lldb::BreakpointSP breakpoint)
pure virtual

◆ CreateFromStructuredData()

BreakpointResolverSP BreakpointResolver::CreateFromStructuredData ( const StructuredData::Dictionary resolver_dict,
Status error 
)
static

◆ Dump()

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

◆ GetBreakpoint()

lldb::BreakpointSP lldb_private::BreakpointResolver::GetBreakpoint ( ) const
inline

◆ 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 lldb_private::BreakpointResolverAddress, lldb_private::BreakpointResolverFileLine, lldb_private::BreakpointResolverFileRegex, lldb_private::BreakpointResolverName, lldb_private::BreakpointResolverScripted, and ExceptionBreakpointResolver.

◆ GetKey()

static const char * lldb_private::BreakpointResolver::GetKey ( OptionNames  enum_value)
inlinestatic

◆ GetOffset()

lldb::addr_t lldb_private::BreakpointResolver::GetOffset ( ) 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 146 of file BreakpointResolver.h.

References SubclassID.

Referenced by lldb_private::BreakpointResolverAddress::classof(), lldb_private::BreakpointResolverFileLine::classof(), lldb_private::BreakpointResolverFileRegex::classof(), lldb_private::BreakpointResolverName::classof(), lldb_private::BreakpointResolverScripted::classof(), and ExceptionBreakpointResolver::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 148 of file BreakpointResolver.h.

References LastKnownResolverType, SubclassID, and UnknownResolver.

Referenced by GetResolverName().

◆ GetSerializationKey()

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

◆ GetSerializationSubclassKey()

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

Definition at line 117 of file BreakpointResolver.h.

Referenced by CreateFromStructuredData(), and WrapOptionsDict().

◆ GetSerializationSubclassOptionsKey()

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

Definition at line 119 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

◆ 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 180 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 175 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()

virtual StructuredData::ObjectSP lldb_private::BreakpointResolver::SerializeToStructuredData ( )
inlinevirtual

◆ 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 169 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 372 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 207 of file BreakpointResolver.cpp.

References AddLocation(), lldb_private::SymbolContext::block, lldb_private::Language::FindPlugin(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Address::GetFileAddress(), lldb_private::Language::GetGlobalLanguageProperties(), lldb_private::Language::IgnoreForLineBreakpoints(), 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()

StructuredData::DictionarySP BreakpointResolver::WrapOptionsDict ( StructuredData::DictionarySP  options_dict_sp)

Friends And Related Function Documentation

◆ Breakpoint

friend class Breakpoint
friend

Definition at line 37 of file BreakpointResolver.h.

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 141 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 GetBreakpoint(), and SetBreakpoint().

◆ m_offset

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

Definition at line 222 of file BreakpointResolver.h.

Referenced by AddLocation(), GetOffset(), SetOffset(), and WrapOptionsDict().

◆ SubclassID

const unsigned char lldb_private::BreakpointResolver::SubclassID
private

Definition at line 226 of file BreakpointResolver.h.

Referenced by getResolverID(), and GetResolverTy().


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