LLDB mainline
|
A section + offset based address range class. More...
#include "lldb/Core/AddressRange.h"
Public Member Functions | |
AddressRange () | |
Default constructor. | |
AddressRange (const lldb::SectionSP §ion, 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. | |
Address & | GetBaseAddress () |
Get accessor for the base address of the range. | |
const Address & | GetBaseAddress () 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. |
A section + offset based address range class.
Definition at line 25 of file AddressRange.h.
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.
References m_base_addr.
Referenced by Extend(), MemorySize(), operator!=(), operator==(), and ~AddressRange().
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.
[in] | section | A section pointer to a valid lldb::Section, or NULL if the address doesn't have a section or will get resolved later. |
[in] | offset | The offset in bytes into section. |
[in] | byte_size | The size in bytes of the address range. |
Definition at line 38 of file AddressRange.cpp.
References m_base_addr, and m_byte_size.
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.
[in] | file_addr | A virtual address. |
[in] | byte_size | The size in bytes of the address range. |
[in] | section_list | A list of sections, one of which may contain the vaddr. |
Definition at line 34 of file AddressRange.cpp.
References m_base_addr, and m_byte_size.
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.
[in] | so_addr | A section offset address object. |
[in] | byte_size | The size in bytes of the address range. |
Definition at line 42 of file AddressRange.cpp.
References m_base_addr, and m_byte_size.
|
default |
Destructor.
The destructor is virtual in case this class is subclassed.
References AddressRange(), and lldb_private::Address::DumpStyleInvalid.
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 144 of file AddressRange.cpp.
References m_base_addr, and m_byte_size.
Referenced by lldb::SBAddressRange::Clear(), lldb_private::SymbolContext::GetAddressRange(), PECallFrameInfo::GetAddressRange(), and lldb_private::Block::GetRangeContainingAddress().
Check if a section offset address is contained in this range.
[in] | so_addr | A section offset address object reference. |
Definition at line 47 of file AddressRange.cpp.
References ContainsFileAddress(), GetBaseAddress(), and lldb_private::Address::GetSection().
Referenced by CalculateSymbolContext().
Check if a section offset address is contained in this range.
[in] | so_addr_ptr | A section offset address object pointer. |
[in] | so_addr | A section offset address object reference. |
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::ThreadPlanShouldStopHere::DefaultStepFromHereCallback(), Extend(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::UnwindPlan::PlanValidAtAddress(), lldb_private::Disassembler::PrintInstructions(), and lldb_private::ThreadPlanStepOverRange::ShouldStop().
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.
[in] | file_addr | A section offset address object reference. |
Definition at line 80 of file AddressRange.cpp.
References GetBaseAddress(), GetByteSize(), lldb_private::Address::GetFileAddress(), and LLDB_INVALID_ADDRESS.
Check if a section offset so_addr when represented as a load address is contained within this object's load address range.
[in] | so_addr | A section offset address object reference. |
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 lldb_private::ThreadPlanStepRange::InSymbol(), and DisassemblerLLVMC::SymbolLookup().
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.
Definition at line 112 of file AddressRange.cpp.
References GetBaseAddress(), GetByteSize(), lldb_private::Address::GetLoadAddress(), and LLDB_INVALID_ADDRESS.
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.
[in] | s | The stream to which to dump the object description. |
[in] | style | The display style for the address. |
Definition at line 153 of file AddressRange.cpp.
References lldb_private::Stream::AsRawOstream(), 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::Stream::Format(), lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::Target::GetArchitecture(), GetBaseAddress(), GetByteSize(), LLDB_INVALID_ADDRESS, m_base_addr, lldb_private::Stream::Printf(), and lldb_private::Stream::PutChar().
Referenced by Dump(), and lldb_private::Function::GetDescription().
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.
[in] | s | The stream to which to dump the object description. |
Definition at line 207 of file AddressRange.cpp.
References GetByteSize(), m_base_addr, and lldb_private::Stream::Printf().
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.
[in] | rhs_range | The range to extend at the right side. |
Definition at line 126 of file AddressRange.cpp.
References AddressRange(), ContainsFileAddress(), GetBaseAddress(), GetByteSize(), lldb_private::Address::GetFileAddress(), and m_byte_size.
Referenced by lldb_private::LineEntry::GetSameLineContiguousAddressRange().
|
inline |
Get accessor for the base address of the range.
Definition at line 211 of file AddressRange.h.
References m_base_addr.
Referenced by lldb_private::BreakpointResolver::AddLocation(), AppendInstructionToFunctionCallForest(), lldb_private::x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(), UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(), lldb_private::LineEntry::Compare(), Contains(), ContainsFileAddress(), ContainsFileAddress(), ContainsLoadAddress(), ContainsLoadAddress(), lldb_private::LineTable::ConvertEntryAtIndexToLineEntry(), lldb_private::Disassembler::Disassemble(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectThreadUntil::DoExecute(), Dump(), DumpAddressOffsetFromFunction(), CommandObjectSourceInfo::DumpLinesInFunctions(), lldb_private::SymbolContext::DumpStopContext(), Extend(), lldb_private::Module::FindAddressesForLine(), lldb_private::Process::FindInMemory(), lldb_private::Process::FindRangesInMemory(), PECallFrameInfo::FindRuntimeFunctionIntersectsWithRange(), UnwindAssembly_x86::FirstNonPrologueInsn(), lldb_private::FormatEntity::Format(), lldb_private::StringSummaryFormat::FormatObject(), lldb_private::SymbolContext::GetAddressRange(), PECallFrameInfo::GetAddressRange(), lldb_private::SymbolContext::GetAddressRangeFromHereToEndLine(), lldb_private::UnwindTable::GetAddressRanges(), UnwindAssembly_x86::GetFastUnwindPlan(), lldb_private::DWARFCallFrameInfo::GetFirstFDEEntryInRange(), lldb_private::LineTable::GetLineEntryIndexRange(), UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::SymbolContext::GetParentOfInlinedScope(), lldb_private::Function::GetPrologueByteSize(), lldb_private::Block::GetRangeContainingAddress(), lldb::SBBlock::GetRangeEndAddress(), lldb::SBBlock::GetRangeStartAddress(), lldb_private::LineEntry::GetSameLineContiguousAddressRange(), lldb::SBLineEntry::GetSameLineContiguousAddressRangeEnd(), lldb_private::Block::GetStartAddress(), lldb_private::StopInfoTrace::GetSuggestedStackFrameIndex(), lldb_private::StackFrame::GuessValueForAddress(), lldb_private::ThreadPlanStepRange::InRange(), operator==(), lldb_private::Symbol::operator==(), SymbolFileSymtab::ParseFunctions(), SymbolFilePDB::ParseVariableForPDBData(), lldb_private::CompileUnit::ResolveSymbolContext(), lldb_private::Module::ResolveSymbolContextForAddress(), lldb_private::ThreadPlanStepRange::SetNextBranchBreakpoint(), lldb_private::BreakpointLocation::SetPreferredLineEntry(), lldb_private::BreakpointResolver::SetSCMatchesByLine(), and lldb_private::ThreadPlanStepOverRange::ShouldStop().
|
inline |
Get const accessor for the base address of the range.
Definition at line 217 of file AddressRange.h.
References m_base_addr.
|
inline |
Get accessor for the byte size of this range.
Definition at line 223 of file AddressRange.h.
References m_byte_size.
Referenced by UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(), lldb_private::LineEntry::Compare(), ContainsFileAddress(), ContainsFileAddress(), ContainsLoadAddress(), ContainsLoadAddress(), lldb_private::Disassembler::Disassemble(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), Dump(), DumpDebug(), CommandObjectSourceInfo::DumpLinesInFunctions(), Extend(), lldb_private::Process::FindInMemory(), lldb_private::Process::FindRangesInMemory(), PECallFrameInfo::FindRuntimeFunctionIntersectsWithRange(), UnwindAssembly_x86::FirstNonPrologueInsn(), lldb_private::FormatEntity::Format(), lldb_private::FuncUnwinders::GetAssemblyUnwindPlan(), lldb::SBAddressRange::GetByteSize(), GetDescription(), lldb_private::DWARFCallFrameInfo::GetFirstFDEEntryInRange(), lldb_private::LineTable::GetLineEntryIndexRange(), UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::Function::GetPrologueByteSize(), lldb_private::Symbol::GetPrologueByteSize(), lldb::SBBlock::GetRangeEndAddress(), lldb_private::LineEntry::GetSameLineContiguousAddressRange(), lldb::SBLineEntry::GetSameLineContiguousAddressRangeEnd(), lldb_private::x86AssemblyInspectionEngine::local_branch_p(), operator==(), lldb_private::Symbol::operator==(), SymbolFilePDB::ParseVariableForPDBData(), lldb_private::Module::ResolveSymbolContextForAddress(), and lldb_private::ThreadPlanStepOut::SetupReturnAddress().
Definition at line 215 of file AddressRange.cpp.
References GetByteSize(), LLDB_INVALID_ADDRESS, m_base_addr, and lldb_private::Stream::Printf().
Referenced by lldb::SBAddressRange::GetDescription().
bool AddressRange::IsValid | ( | ) | const |
Definition at line 149 of file AddressRange.cpp.
References m_base_addr, and m_byte_size.
Referenced by lldb_private::Process::FindInMemory(), lldb_private::Process::FindRangesInMemory(), lldb::SBAddressRange::IsValid(), and operator==().
|
inline |
Get the memory cost of this object.
Definition at line 229 of file AddressRange.h.
References AddressRange().
bool AddressRange::operator!= | ( | const AddressRange & | rhs | ) |
Definition at line 249 of file AddressRange.cpp.
References AddressRange().
bool AddressRange::operator== | ( | const AddressRange & | rhs | ) |
Definition at line 242 of file AddressRange.cpp.
References AddressRange(), GetBaseAddress(), GetByteSize(), IsValid(), m_base_addr, and m_byte_size.
|
inline |
Set accessor for the byte size of this range.
[in] | byte_size | The new size in bytes of this address range. |
Definition at line 239 of file AddressRange.h.
References m_byte_size.
Referenced by lldb_private::LineTable::ConvertEntryAtIndexToLineEntry(), lldb_private::Disassembler::Disassemble(), lldb_private::SymbolContext::GetAddressRange(), PECallFrameInfo::GetAddressRange(), lldb_private::SymbolContext::GetAddressRangeFromHereToEndLine(), lldb_private::FuncUnwinders::GetAssemblyUnwindPlan(), lldb_private::Block::GetRangeContainingAddress(), lldb_private::StackFrame::GuessValueForAddress(), lldb_private::DWARFCallFrameInfo::ParseFDE(), and SymbolFileSymtab::ParseFunctions().
|
protected |
The section offset base address of this range.
Definition at line 249 of file AddressRange.h.
Referenced by AddressRange(), AddressRange(), AddressRange(), AddressRange(), Clear(), ContainsFileAddress(), ContainsLoadAddress(), Dump(), DumpDebug(), GetBaseAddress(), GetBaseAddress(), GetDescription(), IsValid(), and operator==().
|
protected |
The size in bytes of this address range.
Definition at line 250 of file AddressRange.h.
Referenced by AddressRange(), AddressRange(), AddressRange(), Clear(), Extend(), GetByteSize(), IsValid(), operator==(), and SetByteSize().