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"

Public Member Functions

 AddressRange ()
 Default constructor.
 
 AddressRange (const lldb::SectionSP &section, lldb::addr_t offset, lldb::addr_t byte_size)
 Construct with a section pointer, offset, and byte_size.
 
 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.
 
 AddressRange (const Address &so_addr, lldb::addr_t byte_size)
 Construct with a Address object address and byte size.
 
 ~AddressRange ()
 Destructor.
 
void Clear ()
 Clear the object's state.
 
bool IsValid () const
 
bool Contains (const Address &so_addr) const
 Check if a section offset address is contained in this range.
 
bool ContainsFileAddress (const Address &so_addr) const
 Check if a section offset address is contained in this range.
 
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.
 
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.
 
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.
 
bool Extend (const AddressRange &rhs_range)
 Extends this range with rhs_range if it overlaps this range on the right side.
 
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.
 
void DumpDebug (Stream *s) const
 Dump a debug description of this object to a Stream.
 
AddressGetBaseAddress ()
 Get accessor for the base address of the range.
 
const AddressGetBaseAddress () const
 Get const accessor for the base address of the range.
 
lldb::addr_t GetByteSize () const
 Get accessor for the byte size of this range.
 
size_t MemorySize () const
 Get the memory cost of this object.
 
void SetByteSize (lldb::addr_t byte_size)
 Set accessor for the byte size of this range.
 
bool GetDescription (Stream *s, Target *target) const
 
bool operator== (const AddressRange &rhs)
 
bool operator!= (const AddressRange &rhs)
 

Protected Attributes

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

Detailed Description

A section + offset based address range class.

Definition at line 25 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 32 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 38 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 34 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 42 of file AddressRange.cpp.

◆ ~AddressRange()

AddressRange::~AddressRange ( )
default

Destructor.

The destructor is virtual in case this class is subclassed.

Member Function Documentation

◆ Clear()

void AddressRange::Clear ( )

◆ Contains()

bool AddressRange::Contains ( 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.

Definition at line 47 of file AddressRange.cpp.

References ContainsFileAddress(), GetBaseAddress(), and lldb_private::Address::GetSection().

Referenced by CalculateSymbolContext().

◆ 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_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 63 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::Process::AdvanceAddressToNextBranchInstruction(), Contains(), lldb_private::FuncUnwinders::ContainsAddress(), lldb_private::Symbol::ContainsFileAddress(), lldb_private::ThreadPlanShouldStopHere::DefaultStepFromHereCallback(), Extend(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::UnwindPlan::PlanValidAtAddress(), 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]file_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 80 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 94 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.

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 112 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 153 of file AddressRange.cpp.

References lldb_private::Stream::AsRawOstream(), lldb_private::Address::Dump(), Dump(), lldb_private::DumpAddress(), lldb_private::DumpAddressRange(), 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::CommandObjectDisassemble::CheckRangeSize(), lldb_private::UnwindPlan::Dump(), lldb_private::SymbolContext::Dump(), Dump(), lldb_private::LineEntry::Dump(), lldb_private::LineEntry::GetDescription(), lldb_private::Function::GetDescription(), and lldb_private::Symbol::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 204 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 126 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 211 of file AddressRange.h.

References m_base_addr.

Referenced by lldb_private::BreakpointResolver::AddLocation(), lldb_private::ClangExpressionDeclMap::AddOneFunction(), lldb_private::Block::AddRange(), lldb_private::DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo(), DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo(), AppendInstructionToFunctionCallForest(), UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(), lldb_private::x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(), SystemRuntimeMacOSX::BacktraceRecordingHeadersInitialized(), lldb_private::Function::CalculateSymbolContextModule(), lldb_private::LineEntry::Compare(), Contains(), ContainsFileAddress(), ContainsLoadAddress(), lldb_private::LineTable::ConvertEntryAtIndexToLineEntry(), lldb_private::npdb::SymbolFileNativePDB::CreateBlock(), lldb_private::npdb::SymbolFileNativePDB::CreateFunction(), lldb_private::npdb::SymbolFileNativePDB::CreateLocalVariable(), lldb_private::Symbol::Decode(), lldb_private::Disassembler::Disassemble(), lldb_private::Disassembler::DisassembleRange(), CommandObjectTargetModulesShowUnwind::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), lldb_private::UnwindPlan::Dump(), lldb_private::Function::Dump(), Dump(), lldb_private::LineEntry::Dump(), lldb_private::Symbol::Dump(), DumpAddressOffsetFromFunction(), CommandObjectSourceInfo::DumpLinesInFunctions(), lldb_private::Variable::DumpLocations(), lldb_private::SymbolContext::DumpStopContext(), DumpSymbolContextList(), lldb_private::Symbol::Encode(), Extend(), lldb_private::Module::FindAddressesForLine(), lldb_private::Module::FindFunctions(), lldb_private::Process::FindInMemory(), lldb_private::Process::FindRangesInMemory(), PECallFrameInfo::FindRuntimeFunctionIntersectsWithRange(), UnwindAssembly_x86::FirstNonPrologueInsn(), lldb_private::FormatEntity::Format(), lldb_private::StringSummaryFormat::FormatObject(), lldb_private::SearchFilter::FunctionPasses(), lldb_private::Symbol::GetAddress(), lldb_private::UnwindTable::GetAddressRange(), PECallFrameInfo::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::SBBlock::GetDescription(), lldb_private::Block::GetDescription(), lldb_private::LineEntry::GetDescription(), lldb_private::Symbol::GetDescription(), lldb_private::FuncUnwinders::GetEHFrameUnwindPlan(), lldb::SBFunction::GetEndAddress(), UnwindAssembly_x86::GetFastUnwindPlan(), lldb_private::DWARFCallFrameInfo::GetFirstFDEEntryInRange(), lldb_private::StackFrame::GetFrameBaseValue(), lldb_private::FuncUnwinders::GetFunctionStartAddress(), lldb_private::SymbolContext::GetFunctionStartLineEntry(), lldb_private::Symbol::GetInstructions(), lldb::SBFunction::GetInstructions(), lldb_private::Symbol::GetIntegerValue(), lldb_private::CallEdge::GetLoadAddress(), UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::FuncUnwinders::GetObjectFileUnwindPlan(), lldb_private::SymbolContext::GetParentOfInlinedScope(), lldb_private::Function::GetPrologueByteSize(), lldb_private::Symbol::GetPrologueByteSize(), lldb_private::Block::GetRangeAtIndex(), lldb_private::Block::GetRangeContainingAddress(), lldb::SBBlock::GetRangeEndAddress(), lldb_private::Block::GetRangeIndexContainingAddress(), lldb_private::Block::GetRanges(), lldb::SBBlock::GetRangeStartAddress(), lldb_private::Symbol::GetRawValue(), lldb_private::Symbol::GetReExportedSymbolName(), lldb_private::LineEntry::GetSameLineContiguousAddressRange(), lldb::SBLineEntry::GetSameLineContiguousAddressRangeEnd(), lldb::SBFunction::GetStartAddress(), lldb_private::Block::GetStartAddress(), DynamicLoaderHexagonDYLD::GetStepThroughTrampolinePlan(), lldb_private::DynamicLoaderDarwin::GetStepThroughTrampolinePlan(), DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(), lldb_private::FuncUnwinders::GetSymbolFileUnwindPlan(), lldb_private::DWARFCallFrameInfo::GetUnwindPlan(), lldb_private::StackFrame::GuessValueForAddress(), lldb_private::StackFrame::GuessValueForRegisterAndOffset(), lldb_private::InferiorCallMmap(), lldb_private::InferiorCallMunmap(), lldb_private::RegisterContextUnwind::InitializeNonZerothFrame(), lldb_private::RegisterContextUnwind::InitializeZerothFrame(), lldb_private::ThreadPlanStepRange::InRange(), lldb_private::LineEntry::IsValid(), line_entry_helper(), lldb_private::Variable::LocationIsValidForAddress(), lldb_private::Variable::LocationIsValidForFrame(), lldb_private::DWARFExpressionList::MatchesOperand(), operator==(), lldb_private::Symbol::operator==(), lldb_private::breakpad::SymbolFileBreakpad::ParseBlocksRecursive(), SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseFunction(), DWARFASTParserClang::ParseFunctionFromDWARF(), SymbolFileSymtab::ParseFunctions(), lldb_private::npdb::SymbolFileNativePDB::ParseLineTable(), SymbolFilePDB::ParseVariableForPDBData(), lldb_private::UnwindPlan::PlanValidAtAddress(), lldb_private::RegisterContextUnwind::PropagateTrapHandlerFlagFromUnwindPlan(), RemoveFunctionsWithModuleNotEqualTo(), lldb_private::StackFrameList::ResetCurrentInlinedDepth(), lldb_private::plugin::dwarf::SymbolFileDWARF::ResolveFunction(), lldb_private::CompileUnit::ResolveSymbolContext(), lldb_private::Module::ResolveSymbolContextForAddress(), lldb_private::UnwindPlan::SetPlanValidAddressRange(), lldb_private::Symbol::SetReExportedSymbolName(), lldb_private::BreakpointResolver::SetSCMatchesByLine(), lldb_private::ThreadPlanStepInRange::ShouldStop(), lldb_private::ThreadPlanStepOverRange::ShouldStop(), DisassemblerLLVMC::SymbolLookup(), lldb_private::ValueObjectVariable::UpdateValue(), and lldb_private::Symbol::ValueIsAddress().

◆ 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 217 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 223 of file AddressRange.h.

References m_byte_size.

Referenced by UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(), lldb_private::CommandObjectDisassemble::CheckRangeSize(), lldb_private::LineEntry::Compare(), ContainsFileAddress(), ContainsLoadAddress(), lldb_private::Disassembler::Disassemble(), lldb_private::Disassembler::DisassembleRange(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), lldb_private::UnwindPlan::Dump(), Dump(), lldb_private::Symbol::Dump(), DumpDebug(), CommandObjectSourceInfo::DumpLinesInFunctions(), lldb_private::Symbol::Encode(), Extend(), lldb_private::Process::FindInMemory(), lldb_private::Process::FindRangesInMemory(), PECallFrameInfo::FindRuntimeFunctionIntersectsWithRange(), UnwindAssembly_x86::FirstNonPrologueInsn(), lldb_private::FormatEntity::Format(), lldb::SBAddressRange::GetByteSize(), lldb_private::Symbol::GetByteSize(), GetDescription(), lldb::SBFunction::GetEndAddress(), lldb_private::DWARFCallFrameInfo::GetFirstFDEEntryInRange(), UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::Function::GetPrologueByteSize(), lldb_private::Symbol::GetPrologueByteSize(), lldb_private::Block::GetRangeContainingAddress(), lldb::SBBlock::GetRangeEndAddress(), lldb_private::Block::GetRangeIndexContainingAddress(), lldb_private::Symbol::GetReExportedSymbolSharedLibrary(), lldb_private::LineEntry::GetSameLineContiguousAddressRange(), lldb::SBLineEntry::GetSameLineContiguousAddressRangeEnd(), lldb_private::Symbol::GetSiblingIndex(), lldb_private::StackFrame::GuessValueForRegisterAndOffset(), lldb_private::x86AssemblyInspectionEngine::local_branch_p(), operator==(), lldb_private::Symbol::operator==(), lldb_private::breakpad::SymbolFileBreakpad::ParseBlocksRecursive(), SymbolFilePDB::ParseVariableForPDBData(), lldb_private::UnwindPlan::PlanValidAtAddress(), lldb_private::Module::ResolveSymbolContextForAddress(), lldb_private::UnwindPlan::SetPlanValidAddressRange(), and lldb_private::ThreadPlanStepOut::ThreadPlanStepOut().

◆ GetDescription()

bool AddressRange::GetDescription ( Stream s,
Target target 
) const

◆ IsValid()

bool AddressRange::IsValid ( ) const

◆ 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 229 of file AddressRange.h.

References AddressRange().

◆ operator!=()

bool AddressRange::operator!= ( const AddressRange rhs)

Definition at line 246 of file AddressRange.cpp.

◆ operator==()

bool AddressRange::operator== ( const AddressRange rhs)

Definition at line 239 of file AddressRange.cpp.

References GetBaseAddress(), GetByteSize(), IsValid(), m_base_addr, and m_byte_size.

◆ 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 249 of file AddressRange.h.

Referenced by Clear(), ContainsFileAddress(), ContainsLoadAddress(), Dump(), DumpDebug(), GetBaseAddress(), GetDescription(), IsValid(), and operator==().

◆ m_byte_size

lldb::addr_t lldb_private::AddressRange::m_byte_size = 0
protected

The size in bytes of this address range.

Definition at line 250 of file AddressRange.h.

Referenced by Clear(), Extend(), GetByteSize(), IsValid(), operator==(), and SetByteSize().


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