LLDB  mainline
Public Member Functions | Protected Attributes | List of all members
lldb_private::AddressRange Class Reference

A section + offset based address range class. More...

#include "lldb/Core/AddressRange.h"

Collaboration diagram for lldb_private::AddressRange:
Collaboration graph
[legend]

Public Member Functions

 AddressRange ()
 Default constructor. More...
 
 AddressRange (const lldb::SectionSP &section, lldb::addr_t offset, lldb::addr_t byte_size)
 Construct with a section pointer, offset, and byte_size. More...
 
 AddressRange (lldb::addr_t file_addr, lldb::addr_t byte_size, const SectionList *section_list=nullptr)
 Construct with a virtual address, section list and byte size. More...
 
 AddressRange (const Address &so_addr, lldb::addr_t byte_size)
 Construct with a Address object address and byte size. More...
 
 ~AddressRange ()
 Destructor. More...
 
void Clear ()
 Clear the object's state. More...
 
bool ContainsFileAddress (const Address &so_addr) const
 Check if a section offset address is contained in this range. More...
 
bool ContainsFileAddress (lldb::addr_t file_addr) const
 Check if the resolved file address file_addr is contained within this object's file address range. More...
 
bool ContainsLoadAddress (const Address &so_addr, Target *target) const
 Check if a section offset so_addr when represented as a load address is contained within this object's load address range. More...
 
bool ContainsLoadAddress (lldb::addr_t load_addr, Target *target) const
 Check if the resolved load address load_addr is contained within this object's load address range. More...
 
bool Extend (const AddressRange &rhs_range)
 Extends this range with rhs_range if it overlaps this range on the right side. More...
 
bool Dump (Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style=Address::DumpStyleInvalid) const
 Dump a description of this object to a Stream. More...
 
void DumpDebug (Stream *s) const
 Dump a debug description of this object to a Stream. More...
 
AddressGetBaseAddress ()
 Get accessor for the base address of the range. More...
 
const AddressGetBaseAddress () const
 Get const accessor for the base address of the range. More...
 
lldb::addr_t GetByteSize () const
 Get accessor for the byte size of this range. More...
 
size_t MemorySize () const
 Get the memory cost of this object. More...
 
void SetByteSize (lldb::addr_t byte_size)
 Set accessor for the byte size of this range. More...
 

Protected Attributes

Address m_base_addr
 The section offset base address of this range. More...
 
lldb::addr_t m_byte_size
 The size in bytes of this address range. More...
 

Detailed Description

A section + offset based address range class.

Definition at line 32 of file AddressRange.h.

Constructor & Destructor Documentation

◆ AddressRange() [1/4]

AddressRange::AddressRange ( )

Default constructor.

Initialize with a invalid section (NULL), an invalid offset (LLDB_INVALID_ADDRESS), and zero byte size.

Definition at line 30 of file AddressRange.cpp.

Referenced by MemorySize().

◆ AddressRange() [2/4]

AddressRange::AddressRange ( const lldb::SectionSP &  section,
lldb::addr_t  offset,
lldb::addr_t  byte_size 
)

Construct with a section pointer, offset, and byte_size.

Initialize the address with the supplied section, offset and byte_size.

Parameters
[in]sectionA section pointer to a valid lldb::Section, or NULL if the address doesn't have a section or will get resolved later.
[in]offsetThe offset in bytes into section.
[in]byte_sizeThe size in bytes of the address range.

Definition at line 36 of file AddressRange.cpp.

◆ AddressRange() [3/4]

AddressRange::AddressRange ( lldb::addr_t  file_addr,
lldb::addr_t  byte_size,
const SectionList section_list = nullptr 
)

Construct with a virtual address, section list and byte size.

Initialize and resolve the address with the supplied virtual address file_addr, and byte size byte_size.

Parameters
[in]file_addrA virtual address.
[in]byte_sizeThe size in bytes of the address range.
[in]section_listA list of sections, one of which may contain the vaddr.

Definition at line 32 of file AddressRange.cpp.

◆ AddressRange() [4/4]

AddressRange::AddressRange ( const Address so_addr,
lldb::addr_t  byte_size 
)

Construct with a Address object address and byte size.

Initialize by copying the section offset address in so_addr, and setting the byte size to byte_size.

Parameters
[in]so_addrA section offset address object.
[in]byte_sizeThe size in bytes of the address range.

Definition at line 40 of file AddressRange.cpp.

◆ ~AddressRange()

AddressRange::~AddressRange ( )

Destructor.

The destructor is virtual in case this class is subclassed.

Definition at line 43 of file AddressRange.cpp.

Member Function Documentation

◆ Clear()

void AddressRange::Clear ( )

Clear the object's state.

Sets the section to an invalid value (NULL), an invalid offset (LLDB_INVALID_ADDRESS) and a zero byte size.

Definition at line 143 of file AddressRange.cpp.

References lldb_private::Address::Clear(), m_base_addr, and m_byte_size.

Referenced by lldb_private::LineEntry::Clear(), lldb_private::Symbol::Clear(), lldb_private::SymbolContext::GetAddressRange(), and lldb_private::Block::GetRangeContainingAddress().

◆ ContainsFileAddress() [1/2]

bool AddressRange::ContainsFileAddress ( const Address so_addr) const

Check if a section offset address is contained in this range.

Parameters
[in]so_addrA section offset address object reference.
Returns
Returns true if so_addr is contained in this range, false otherwise. Check if a section offset address is contained in this range.
Parameters
[in]so_addr_ptrA section offset address object pointer.
Returns
Returns true if so_addr is contained in this range, false otherwise. Check if a section offset so_addr when represented as a file address is contained within this object's file address range.
Parameters
[in]so_addrA section offset address object reference.
Returns
Returns true if both this and so_addr have resolvable file address values and so_addr is contained in the address range, false otherwise.

Definition at line 62 of file AddressRange.cpp.

References GetBaseAddress(), GetByteSize(), lldb_private::Address::GetFileAddress(), lldb_private::Address::GetOffset(), lldb_private::Address::GetSection(), LLDB_INVALID_ADDRESS, and m_base_addr.

Referenced by lldb_private::FuncUnwinders::ContainsAddress(), lldb_private::Symbol::ContainsFileAddress(), lldb_private::ThreadPlanShouldStopHere::DefaultStepFromHereCallback(), lldb_private::Variable::DumpLocationForAddress(), Extend(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::Disassembler::PrintInstructions(), and lldb_private::ThreadPlanStepOverRange::ShouldStop().

◆ ContainsFileAddress() [2/2]

bool AddressRange::ContainsFileAddress ( lldb::addr_t  file_addr) const

Check if the resolved file address file_addr is contained within this object's file address range.

Parameters
[in]so_addrA section offset address object reference.
Returns
Returns true if both this has a resolvable file address value and so_addr is contained in the address range, false otherwise.

Definition at line 79 of file AddressRange.cpp.

References GetBaseAddress(), GetByteSize(), lldb_private::Address::GetFileAddress(), and LLDB_INVALID_ADDRESS.

◆ ContainsLoadAddress() [1/2]

bool AddressRange::ContainsLoadAddress ( const Address so_addr,
Target target 
) const

Check if a section offset so_addr when represented as a load address is contained within this object's load address range.

Parameters
[in]so_addrA section offset address object reference.
Returns
Returns true if both this and so_addr have resolvable load address values and so_addr is contained in the address range, false otherwise.

Definition at line 93 of file AddressRange.cpp.

References GetBaseAddress(), GetByteSize(), lldb_private::Address::GetLoadAddress(), lldb_private::Address::GetOffset(), lldb_private::Address::GetSection(), LLDB_INVALID_ADDRESS, and m_base_addr.

Referenced by CommandObjectThreadUntil::DoExecute(), lldb_private::ThreadPlanStepRange::InSymbol(), lldb::SBThread::StepOverUntil(), and DisassemblerLLVMC::SymbolLookup().

◆ ContainsLoadAddress() [2/2]

bool AddressRange::ContainsLoadAddress ( lldb::addr_t  load_addr,
Target target 
) const

Check if the resolved load address load_addr is contained within this object's load address range.

Parameters
[in]so_addrA section offset address object reference.
Returns
Returns true if both this has a resolvable load address value and so_addr is contained in the address range, false otherwise.

Definition at line 111 of file AddressRange.cpp.

References GetBaseAddress(), GetByteSize(), lldb_private::Address::GetLoadAddress(), and LLDB_INVALID_ADDRESS.

◆ Dump()

bool AddressRange::Dump ( Stream s,
Target target,
Address::DumpStyle  style,
Address::DumpStyle  fallback_style = Address::DumpStyleInvalid 
) const

Dump a description of this object to a Stream.

Dump a description of the contents of this object to the supplied stream s. There are many ways to display a section offset based address range, and style lets the user choose how the base address gets displayed.

Parameters
[in]sThe stream to which to dump the object description.
[in]styleThe display style for the address.
Returns
Returns true if the address was able to be displayed. File and load addresses may be unresolved and it may not be possible to display a valid value, false will be returned in such cases.
See also
Address::DumpStyle

Definition at line 148 of file AddressRange.cpp.

References lldb_private::Stream::Address(), lldb_private::Stream::AddressRange(), lldb_private::Address::Dump(), lldb_private::Address::DumpStyleFileAddress, lldb_private::Address::DumpStyleInvalid, lldb_private::Address::DumpStyleLoadAddress, lldb_private::Address::DumpStyleModuleWithFileAddress, lldb_private::Address::DumpStyleSectionNameOffset, lldb_private::Address::DumpStyleSectionPointerOffset, lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::Target::GetArchitecture(), GetBaseAddress(), GetByteSize(), lldb_private::Address::GetFileAddress(), lldb_private::Address::GetLoadAddress(), lldb_private::Address::GetOffset(), LLDB_INVALID_ADDRESS, m_base_addr, lldb_private::Stream::Printf(), and lldb_private::Stream::PutChar().

Referenced by lldb_private::LineEntry::Dump(), lldb_private::LineEntry::GetDescription(), lldb_private::Symbol::GetDescription(), and lldb_private::Function::GetDescription().

◆ DumpDebug()

void AddressRange::DumpDebug ( Stream s) const

Dump a debug description of this object to a Stream.

Dump a debug description of the contents of this object to the supplied stream s.

The debug description contains verbose internal state such and pointer values, reference counts, etc.

Parameters
[in]sThe stream to which to dump the object description.

Definition at line 197 of file AddressRange.cpp.

References GetByteSize(), lldb_private::Address::GetOffset(), lldb_private::Address::GetSection(), m_base_addr, and lldb_private::Stream::Printf().

◆ Extend()

bool AddressRange::Extend ( const AddressRange rhs_range)

Extends this range with rhs_range if it overlaps this range on the right side.

The range overlaps on the right side if the base address of rhs_range lies within this range or if it's contiguous on its right side.

Parameters
[in]rhs_rangeThe range to extend at the right side.
Returns
Returns true if this range was extended, false otherwise.

Definition at line 125 of file AddressRange.cpp.

References ContainsFileAddress(), GetBaseAddress(), GetByteSize(), lldb_private::Address::GetFileAddress(), and m_byte_size.

Referenced by lldb_private::LineEntry::GetSameLineContiguousAddressRange().

◆ GetBaseAddress() [1/2]

Address& lldb_private::AddressRange::GetBaseAddress ( )
inline

Get accessor for the base address of the range.

Returns
A reference to the base address object.

Definition at line 220 of file AddressRange.h.

References m_base_addr.

Referenced by lldb_private::Block::AddRange(), lldb_private::DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo(), DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo(), UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(), lldb_private::x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(), lldb_private::Function::CalculateSymbolContextModule(), lldb_private::LineEntry::Compare(), ContainsFileAddress(), ContainsLoadAddress(), lldb_private::LineTable::ConvertEntryAtIndexToLineEntry(), lldb_private::Disassembler::Disassemble(), lldb_private::Disassembler::DisassembleRange(), UnwindMacOSXFrameBackchain::DoCreateRegisterContextForFrame(), lldb_private::CommandObjectDisassemble::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectSourceList::DoExecute(), CommandObjectThreadUntil::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), lldb_private::Variable::Dump(), lldb_private::Symbol::Dump(), lldb_private::LineEntry::Dump(), Dump(), lldb_private::Function::Dump(), DumpAddressOffsetFromFunction(), CommandObjectSourceInfo::DumpLinesInFunctions(), lldb_private::Variable::DumpLocationForAddress(), lldb_private::SymbolContext::DumpStopContext(), DumpSymbolContextList(), Extend(), lldb_private::Module::FindAddressesForLine(), lldb_private::Module::FindFunctions(), lldb_private::CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo(), UnwindAssembly_x86::FirstNonPrologueInsn(), lldb_private::FormatEntity::Format(), lldb_private::Symbol::GetAddress(), lldb_private::DWARFCallFrameInfo::GetAddressRange(), lldb_private::SymbolContext::GetAddressRange(), lldb_private::SymbolContext::GetAddressRangeFromHereToEndLine(), lldb_private::Symbol::GetAddressRef(), lldb_private::FuncUnwinders::GetArmUnwindUnwindPlan(), lldb_private::ArchitectureMips::GetBreakableLoadAddress(), lldb_private::FuncUnwinders::GetCompactUnwindUnwindPlan(), lldb_private::FuncUnwinders::GetDebugFrameUnwindPlan(), lldb_private::SourceManager::GetDefaultFileAndLine(), lldb_private::LineEntry::GetDescription(), lldb::SBBlock::GetDescription(), lldb_private::Symbol::GetDescription(), lldb_private::FuncUnwinders::GetEHFrameUnwindPlan(), lldb::SBFunction::GetEndAddress(), SystemRuntimeMacOSX::GetExtendedBacktraceForQueueItem(), UnwindAssembly_x86::GetFastUnwindPlan(), lldb_private::StackFrame::GetFrameBaseValue(), lldb_private::FuncUnwinders::GetFunctionStartAddress(), lldb_private::SymbolContext::GetFunctionStartLineEntry(), SymbolFileDWARF::GetGlobalAranges(), lldb::SBFunction::GetInstructions(), lldb_private::Symbol::GetInstructions(), lldb_private::Symbol::GetIntegerValue(), UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::DWARFExpression::GetOpAndEndOffsets(), lldb_private::SymbolContext::GetParentOfInlinedScope(), lldb_private::Symbol::GetPrologueByteSize(), lldb_private::Function::GetPrologueByteSize(), lldb_private::Block::GetRangeAtIndex(), lldb_private::Block::GetRangeContainingAddress(), lldb::SBBlock::GetRangeEndAddress(), lldb_private::Block::GetRangeIndexContainingAddress(), lldb::SBBlock::GetRangeStartAddress(), lldb_private::Symbol::GetReExportedSymbolName(), lldb_private::CallEdge::GetReturnPCAddress(), lldb_private::LineEntry::GetSameLineContiguousAddressRange(), lldb::SBFunction::GetStartAddress(), lldb_private::StackFrame::GetStatus(), DynamicLoaderHexagonDYLD::GetStepThroughTrampolinePlan(), lldb_private::DynamicLoaderDarwin::GetStepThroughTrampolinePlan(), DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(), lldb_private::DWARFCallFrameInfo::GetUnwindPlan(), lldb_private::StackFrame::GuessValueForAddress(), lldb_private::StackFrame::GuessValueForRegisterAndOffset(), lldb_private::InferiorCallMmap(), lldb_private::InferiorCallMunmap(), lldb_private::LineEntry::IsValid(), lldb_private::Variable::LocationIsValidForAddress(), lldb_private::Variable::LocationIsValidForFrame(), SymbolFilePDB::ParseDeclsForContext(), DWARFASTParserClang::ParseFunctionFromDWARF(), lldb_private::Disassembler::ParseInstructions(), SymbolFilePDB::ParseLanguage(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), RemoveFunctionsWithModuleNotEqualTo(), lldb_private::StackFrameList::ResetCurrentInlinedDepth(), SymbolFileDWARF::ResolveFunction(), lldb_private::CompileUnit::ResolveSymbolContext(), lldb_private::Module::ResolveSymbolContextForAddress(), lldb_private::AddressResolverFileLine::SearchCallback(), lldb_private::AddressResolverName::SearchCallback(), lldb_private::BreakpointResolverName::SearchCallback(), lldb_private::IRExecutionUnit::SearchSpec::SearchSpec(), lldb_private::UnwindPlan::SetPlanValidAddressRange(), lldb_private::Symbol::SetReExportedSymbolName(), lldb_private::BreakpointResolver::SetSCMatchesByLine(), lldb_private::ThreadPlanStepOverRange::ShouldStop(), lldb_private::ThreadPlanStepInRange::ShouldStop(), lldb::SBThread::StepOverUntil(), DisassemblerLLVMC::SymbolLookup(), lldb_private::ValueObjectVariable::UpdateValue(), lldb_private::Symbol::ValueIsAddress(), and lldb_private::UnwindTable::~UnwindTable().

◆ GetBaseAddress() [2/2]

const Address& lldb_private::AddressRange::GetBaseAddress ( ) const
inline

Get const accessor for the base address of the range.

Returns
A const reference to the base address object.

Definition at line 226 of file AddressRange.h.

References m_base_addr.

◆ GetByteSize()

lldb::addr_t lldb_private::AddressRange::GetByteSize ( ) const
inline

Get accessor for the byte size of this range.

Returns
The size in bytes of this address range.

Definition at line 232 of file AddressRange.h.

References m_byte_size.

Referenced by UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(), lldb_private::LineEntry::Compare(), ContainsFileAddress(), ContainsLoadAddress(), lldb_private::Disassembler::Disassemble(), lldb_private::Disassembler::DisassembleRange(), lldb_private::CommandObjectDisassemble::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), lldb_private::Symbol::Dump(), Dump(), DumpDebug(), CommandObjectSourceInfo::DumpLinesInFunctions(), Extend(), UnwindAssembly_x86::FirstNonPrologueInsn(), lldb_private::FormatEntity::Format(), lldb_private::DWARFCallFrameInfo::GetAddressRange(), lldb_private::Symbol::GetByteSize(), lldb::SBFunction::GetEndAddress(), lldb_private::Function::GetEndLineSourceInfo(), UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::Symbol::GetPrologueByteSize(), lldb_private::Function::GetPrologueByteSize(), lldb_private::Block::GetRangeContainingAddress(), lldb::SBBlock::GetRangeEndAddress(), lldb_private::Block::GetRangeIndexContainingAddress(), lldb_private::Symbol::GetReExportedSymbolSharedLibrary(), lldb_private::LineEntry::GetSameLineContiguousAddressRange(), lldb_private::Symbol::GetSiblingIndex(), lldb_private::StackFrame::GuessValueForRegisterAndOffset(), SymbolFilePDB::ParseDeclsForContext(), lldb_private::Disassembler::ParseInstructions(), lldb_private::Module::ResolveSymbolContextForAddress(), lldb_private::AddressResolverFileLine::SearchCallback(), lldb_private::AddressResolverName::SearchCallback(), lldb_private::UnwindPlan::SetPlanValidAddressRange(), and lldb_private::ThreadPlanStepOut::ThreadPlanStepOut().

◆ MemorySize()

size_t lldb_private::AddressRange::MemorySize ( ) const
inline

Get the memory cost of this object.

Returns
The number of bytes that this object occupies in memory.

Definition at line 238 of file AddressRange.h.

References AddressRange().

◆ SetByteSize()

void lldb_private::AddressRange::SetByteSize ( lldb::addr_t  byte_size)
inline

Member Data Documentation

◆ m_base_addr

Address lldb_private::AddressRange::m_base_addr
protected

The section offset base address of this range.

Definition at line 252 of file AddressRange.h.

Referenced by Clear(), ContainsFileAddress(), ContainsLoadAddress(), Dump(), DumpDebug(), and GetBaseAddress().

◆ m_byte_size

lldb::addr_t lldb_private::AddressRange::m_byte_size
protected

The size in bytes of this address range.

Definition at line 253 of file AddressRange.h.

Referenced by Clear(), Extend(), GetByteSize(), and SetByteSize().


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