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]
Collaboration diagram for lldb_private::BreakpointResolver:
Collaboration 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. More...
 
 ~BreakpointResolver () override
 The Destructor is virtual, all significant breakpoint resolvers derive from this class. More...
 
void SetBreakpoint (const lldb::BreakpointSP &bkpt)
 This sets the breakpoint for this resolver. More...
 
lldb::BreakpointSP GetBreakpoint () const
 This gets the breakpoint for this resolver. More...
 
void SetOffset (lldb::addr_t offset)
 This updates the offset for this breakpoint. More...
 
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. More...
 
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. More...
 
void GetDescription (Stream *s) override=0
 Prints a canonical description for the breakpoint to the stream s. More...
 
virtual void Dump (Stream *s) const =0
 Standard "Dump" method. At present it does nothing. More...
 
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. More...
 
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. More...
 
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  OptionNames : uint32_t {
  OptionNames::AddressOffset = 0, OptionNames::ExactMatch, OptionNames::FileName, OptionNames::Inlines,
  OptionNames::LanguageName, OptionNames::LineNumber, OptionNames::Column, OptionNames::ModuleName,
  OptionNames::NameMaskArray, OptionNames::Offset, OptionNames::PythonClassName, OptionNames::RegexString,
  OptionNames::ScriptArgs, OptionNames::SectionName, OptionNames::SearchDepth, OptionNames::SkipPrologue,
  OptionNames::SymbolNameArray, OptionNames::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, uint32_t column=0)
 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. More...
 
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. More...
 
 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 35 of file BreakpointResolver.h.

Member Enumeration Documentation

◆ OptionNames

Enumerator
AddressOffset 
ExactMatch 
FileName 
Inlines 
LanguageName 
LineNumber 
Column 
ModuleName 
NameMaskArray 
Offset 
PythonClassName 
RegexString 
ScriptArgs 
SectionName 
SearchDepth 
SkipPrologue 
SymbolNameArray 
LastOptionName 

Definition at line 167 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 127 of file BreakpointResolver.h.

Constructor & Destructor Documentation

◆ BreakpointResolver() [1/2]

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

Referenced by NameToResolverTy().

◆ ~BreakpointResolver()

BreakpointResolver::~BreakpointResolver ( )
override

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

Definition at line 68 of file BreakpointResolver.cpp.

◆ 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

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

References SubclassID.

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

◆ GetResolverName()

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

◆ GetResolverTy()

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

Definition at line 147 of file BreakpointResolver.h.

References SubclassID.

Referenced by GetResolverName().

◆ GetSerializationKey()

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

◆ GetSerializationSubclassKey()

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

Definition at line 116 of file BreakpointResolver.h.

◆ GetSerializationSubclassOptionsKey()

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

Definition at line 118 of file BreakpointResolver.h.

References WrapOptionsDict().

◆ NameToResolverTy()

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

Definition at line 55 of file BreakpointResolver.cpp.

References BreakpointResolver().

Referenced by GetResolverName().

◆ NotifyBreakpointSet()

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

Reimplemented in lldb_private::BreakpointResolverScripted.

Definition at line 190 of file BreakpointResolver.h.

◆ 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 177 of file BreakpointResolver.cpp.

References lldb_private::LineEntry::column, lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, lldb_private::operator<(), lldb_private::SearchFilter::Search(), and UINT32_MAX.

Referenced by GetOffset(), and 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 172 of file BreakpointResolver.cpp.

References lldb_private::SearchFilter::SearchInModuleList().

Referenced by GetOffset(), and lldb_private::BreakpointResolverAddress::ResolveBreakpointInModules().

◆ ResolverTyToName()

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

Definition at line 47 of file BreakpointResolver.cpp.

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 166 of file BreakpointResolver.cpp.

◆ 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 345 of file BreakpointResolver.cpp.

Referenced by CreateFromStructuredData(), and GetBreakpoint().

◆ SetSCMatchesByLine() [1/2]

void BreakpointResolver::SetSCMatchesByLine ( SearchFilter filter,
SymbolContextList sc_list,
bool  skip_prologue,
llvm::StringRef  log_ident,
uint32_t  line = 0,
uint32_t  column = 0 
)
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 202 of file BreakpointResolver.cpp.

References lldb_private::SymbolContext::block, lldb_private::AddressRange::GetBaseAddress(), lldb_private::Address::GetFileAddress(), lldb_private::SymbolContextList::GetSize(), lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, lldb_private::LineEntry::range, and UINT32_MAX.

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

◆ SetSCMatchesByLine() [2/2]

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

◆ WrapOptionsDict()

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

Friends And Related Function Documentation

◆ Breakpoint

friend class Breakpoint
friend

Definition at line 36 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 188 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 140 of file BreakpointResolver.h.

◆ m_breakpoint

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

Definition at line 219 of file BreakpointResolver.h.

Referenced by GetBreakpoint().

◆ m_offset

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

Definition at line 220 of file BreakpointResolver.h.

Referenced by GetOffset().

◆ SubclassID

const unsigned char lldb_private::BreakpointResolver::SubclassID
private

Definition at line 224 of file BreakpointResolver.h.

Referenced by getResolverID(), and GetResolverTy().


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