LLDB  mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lldb_private::Address Class Reference

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

#include "lldb/Core/Address.h"

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

Classes

class  ModulePointerAndOffsetLessThanFunctionObject
 

Public Types

enum  DumpStyle {
  DumpStyleInvalid, DumpStyleSectionNameOffset, DumpStyleSectionPointerOffset, DumpStyleFileAddress,
  DumpStyleModuleWithFileAddress, DumpStyleLoadAddress, DumpStyleResolvedDescription, DumpStyleResolvedDescriptionNoModule,
  DumpStyleResolvedDescriptionNoFunctionArguments, DumpStyleNoFunctionName, DumpStyleDetailedSymbolContext, DumpStyleResolvedPointerDescription
}
 Dump styles allow the Address::Dump(Stream *,DumpStyle) const function to display Address contents in a variety of ways. More...
 

Public Member Functions

 Address ()
 Default constructor. More...
 
 Address (const Address &rhs)
 Copy constructor. More...
 
 Address (const lldb::SectionSP &section_sp, lldb::addr_t offset)
 Construct with a section pointer and offset. More...
 
 Address (lldb::addr_t file_addr, const SectionList *section_list)
 Construct with a virtual address and section list. More...
 
 Address (lldb::addr_t abs_addr)
 
const Addressoperator= (const Address &rhs)
 Assignment operator. More...
 
void Clear ()
 Clear the object's state. More...
 
bool Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX) const
 Dump a description of this object to a Stream. More...
 
AddressClass GetAddressClass () const
 
lldb::addr_t GetFileAddress () const
 Get the file address. More...
 
lldb::addr_t GetLoadAddress (Target *target) const
 Get the load address. More...
 
lldb::addr_t GetCallableLoadAddress (Target *target, bool is_indirect=false) const
 Get the load address as a callable code load address. More...
 
lldb::addr_t GetOpcodeLoadAddress (Target *target, AddressClass addr_class=AddressClass::eInvalid) const
 Get the load address as an opcode load address. More...
 
lldb::addr_t GetOffset () const
 Get the section relative offset value. More...
 
bool IsSectionOffset () const
 Check if an address is section offset. More...
 
bool IsValid () const
 Check if the object state is valid. More...
 
size_t MemorySize () const
 Get the memory cost of this object. More...
 
bool ResolveAddressUsingFileSections (lldb::addr_t addr, const SectionList *sections)
 Resolve a file virtual address using a section list. More...
 
bool SetLoadAddress (lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
 Set the address to represent load_addr. More...
 
bool SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target, AddressClass addr_class=AddressClass::eInvalid, bool allow_section_end=false)
 
bool SetCallableLoadAddress (lldb::addr_t load_addr, Target *target)
 
lldb::ModuleSP GetModule () const
 Get accessor for the module for this address. More...
 
lldb::SectionSP GetSection () const
 Get const accessor for the section. More...
 
bool SetOffset (lldb::addr_t offset)
 Set accessor for the offset. More...
 
void SetRawAddress (lldb::addr_t addr)
 
bool Slide (int64_t offset)
 
void SetSection (const lldb::SectionSP &section_sp)
 Set accessor for the section. More...
 
void ClearSection ()
 
uint32_t CalculateSymbolContext (SymbolContext *sc, lldb::SymbolContextItem resolve_scope=lldb::eSymbolContextEverything) const
 Reconstruct a symbol context from an address. More...
 
lldb::ModuleSP CalculateSymbolContextModule () const
 
CompileUnitCalculateSymbolContextCompileUnit () const
 
FunctionCalculateSymbolContextFunction () const
 
BlockCalculateSymbolContextBlock () const
 
SymbolCalculateSymbolContextSymbol () const
 
bool CalculateSymbolContextLineEntry (LineEntry &line_entry) const
 
bool SectionWasDeleted () const
 

Static Public Member Functions

static int CompareFileAddress (const Address &lhs, const Address &rhs)
 Compare two Address objects. More...
 
static int CompareLoadAddress (const Address &lhs, const Address &rhs, Target *target)
 
static int CompareModulePointerAndOffset (const Address &lhs, const Address &rhs)
 

Protected Member Functions

bool SectionWasDeletedPrivate () const
 

Protected Attributes

lldb::SectionWP m_section_wp
 The section for the address, can be NULL. More...
 
lldb::addr_t m_offset
 Offset into section if m_section_wp is valid... More...
 

Detailed Description

A section + offset based address class.

The Address class allows addresses to be relative to a section that can move during runtime due to images (executables, shared libraries, bundles, frameworks) being loaded at different addresses than the addresses found in the object file that represents them on disk. There are currently two types of addresses for a section:

File addresses represent the virtual addresses that are in the "on disk" object files. These virtual addresses are converted to be relative to unique sections scoped to the object file so that when/if the addresses slide when the images are loaded/unloaded in memory, we can easily track these changes without having to update every object (compile unit ranges, line tables, function address ranges, lexical block and inlined subroutine address ranges, global and static variables) each time an image is loaded or unloaded.

Load addresses represent the virtual addresses where each section ends up getting loaded at runtime. Before executing a program, it is common for all of the load addresses to be unresolved. When a DynamicLoader plug-in receives notification that shared libraries have been loaded/unloaded, the load addresses of the main executable and any images (shared libraries) will be resolved/unresolved. When this happens, breakpoints that are in one of these sections can be set/cleared.

Definition at line 80 of file Address.h.

Member Enumeration Documentation

◆ DumpStyle

Dump styles allow the Address::Dump(Stream *,DumpStyle) const function to display Address contents in a variety of ways.

Enumerator
DumpStyleInvalid 

Invalid dump style.

DumpStyleSectionNameOffset 

Display as the section name + offset.

// address for printf in libSystem.B.dylib as a section name + offset
libSystem.B.dylib.__TEXT.__text + 0x0005cfdf
DumpStyleSectionPointerOffset 

Display as the section pointer + offset (debug output).

// address for printf in libSystem.B.dylib as a section pointer +
offset (lldb::Section *)0x35cc50 + 0x000000000005cfdf
DumpStyleFileAddress 

Display as the file address (if any).

// address for printf in libSystem.B.dylib as a file address
0x000000000005dcff
DumpStyleModuleWithFileAddress 

Display as the file address with the module name prepended (if any).

// address for printf in libSystem.B.dylib as a file address
libSystem.B.dylib[0x000000000005dcff]
DumpStyleLoadAddress 

Display as the load address (if resolved).

// address for printf in libSystem.B.dylib as a load address
0x00007fff8306bcff
DumpStyleResolvedDescription 

Display the details about what an address resolves to.

This can be anything from a symbol context summary (module, function/symbol, and file and line), to information about what the pointer points to if the address is in a section (section of pointers, c strings, etc).

DumpStyleResolvedDescriptionNoModule 
DumpStyleResolvedDescriptionNoFunctionArguments 
DumpStyleNoFunctionName 

Elide the function name; display an offset into the current function.

Used primarily in disassembly symbolication

DumpStyleDetailedSymbolContext 

Detailed symbol context information for an address for all symbol context members.

DumpStyleResolvedPointerDescription 

Dereference a pointer at the current address and then lookup the.

dereferenced address using DumpStyleResolvedDescription

Definition at line 84 of file Address.h.

Constructor & Destructor Documentation

◆ Address() [1/5]

lldb_private::Address::Address ( )
inline

Default constructor.

Initialize with a invalid section (NULL) and an invalid offset (LLDB_INVALID_ADDRESS).

Definition at line 130 of file Address.h.

Referenced by Address(), and MemorySize().

◆ Address() [2/5]

lldb_private::Address::Address ( const Address rhs)
inline

Copy constructor.

Makes a copy of the another Address object rhs.

Parameters
[in]rhsA const Address object reference to copy.

Definition at line 138 of file Address.h.

◆ Address() [3/5]

lldb_private::Address::Address ( const lldb::SectionSP &  section_sp,
lldb::addr_t  offset 
)
inline

Construct with a section pointer and offset.

Initialize the address with the supplied section and offset.

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.

Definition at line 151 of file Address.h.

References Address(), m_section_wp, and operator=().

◆ Address() [4/5]

Address::Address ( lldb::addr_t  file_addr,
const SectionList section_list 
)

Construct with a virtual address and section list.

Initialize and resolve the address with the supplied virtual address file_addr.

Parameters
[in]file_addrA virtual file address.
[in]section_listA list of sections, one of which may contain the file_addr.

Definition at line 234 of file Address.cpp.

References ResolveAddressUsingFileSections().

◆ Address() [5/5]

Address::Address ( lldb::addr_t  abs_addr)

Definition at line 232 of file Address.cpp.

Member Function Documentation

◆ CalculateSymbolContext()

uint32_t Address::CalculateSymbolContext ( SymbolContext sc,
lldb::SymbolContextItem  resolve_scope = lldb::eSymbolContextEverything 
) const

Reconstruct a symbol context from an address.

This class doesn't inherit from SymbolContextScope because many address objects have short lifespans. Address objects that are section offset can reconstruct their symbol context by looking up the address in the module found in the section.

See also
SymbolContextScope::CalculateSymbolContext(SymbolContext*)

Definition at line 782 of file Address.cpp.

References lldb_private::SymbolContext::Clear(), GetSection(), and lldb_private::SymbolContext::module_sp.

Referenced by lldb_private::SearchFilterByModuleListAndCU::AddressPasses(), ClearSection(), lldb::SBThreadPlan::QueueThreadPlanForStepInRange(), lldb::SBThreadPlan::QueueThreadPlanForStepOverRange(), lldb_private::CompileUnit::ResolveSymbolContext(), lldb_private::ThreadPlanStepOverRange::ShouldStop(), and lldb_private::ThreadPlanStepOut::ThreadPlanStepOut().

◆ CalculateSymbolContextBlock()

Block * Address::CalculateSymbolContextBlock ( ) const

◆ CalculateSymbolContextCompileUnit()

CompileUnit * Address::CalculateSymbolContextCompileUnit ( ) const

◆ CalculateSymbolContextFunction()

Function * Address::CalculateSymbolContextFunction ( ) const

◆ CalculateSymbolContextLineEntry()

bool Address::CalculateSymbolContextLineEntry ( LineEntry line_entry) const

◆ CalculateSymbolContextModule()

ModuleSP Address::CalculateSymbolContextModule ( ) const

Definition at line 801 of file Address.cpp.

References GetSection().

Referenced by ClearSection(), and lldb_private::RenderScriptRuntime::ResolveKernelName().

◆ CalculateSymbolContextSymbol()

Symbol * Address::CalculateSymbolContextSymbol ( ) const

◆ Clear()

void lldb_private::Address::Clear ( )
inline

◆ ClearSection()

void lldb_private::Address::ClearSection ( )
inline

◆ CompareFileAddress()

int Address::CompareFileAddress ( const Address lhs,
const Address rhs 
)
static

Compare two Address objects.

Parameters
[in]lhsThe Left Hand Side const Address object reference.
[in]rhsThe Right Hand Side const Address object reference.
Returns
  • -1 if lhs < rhs
  • 0 if lhs == rhs
  • 1 if lhs > rhs

Definition at line 882 of file Address.cpp.

References GetFileAddress().

Referenced by Clear(), and lldb_private::LineEntry::Compare().

◆ CompareLoadAddress()

int Address::CompareLoadAddress ( const Address lhs,
const Address rhs,
Target target 
)
static

Definition at line 892 of file Address.cpp.

References GetLoadAddress().

Referenced by Clear(), and lldb_private::UserExpression::LockAndCheckContext().

◆ CompareModulePointerAndOffset()

int Address::CompareModulePointerAndOffset ( const Address lhs,
const Address rhs 
)
static

◆ Dump()

bool Address::Dump ( Stream s,
ExecutionContextScope exe_scope,
DumpStyle  style,
DumpStyle  fallback_style = DumpStyleInvalid,
uint32_t  addr_byte_size = UINT32_MAX 
) 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, and style lets the user choose.

Parameters
[in]sThe stream to which to dump the object description.
[in]styleThe display style for the address.
[in]fallback_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 374 of file Address.cpp.

References lldb_private::Stream::Address(), lldb_private::Block::AppendVariables(), lldb_private::ConstString::AsCString(), lldb_private::SymbolContext::block, Dump(), lldb_private::Variable::DumpLocationForAddress(), lldb_private::Declaration::DumpStopContext(), lldb_private::SymbolContext::DumpStopContext(), DumpStyleDetailedSymbolContext, DumpStyleFileAddress, DumpStyleInvalid, DumpStyleLoadAddress, DumpStyleModuleWithFileAddress, DumpStyleNoFunctionName, DumpStyleResolvedDescription, DumpStyleResolvedDescriptionNoFunctionArguments, DumpStyleResolvedDescriptionNoModule, DumpStyleResolvedPointerDescription, DumpStyleSectionNameOffset, DumpStyleSectionPointerOffset, DumpUInt(), lldb::eDescriptionLevelBrief, lldb_private::Stream::EOL(), lldb::eSectionTypeData, lldb::eSectionTypeData16, lldb::eSectionTypeData4, lldb::eSectionTypeData8, lldb::eSectionTypeDataCString, lldb::eSectionTypeDataCStringPointers, lldb::eSectionTypeDataObjCCFStrings, lldb::eSectionTypeDataObjCMessageRefs, lldb::eSectionTypeDataPointers, lldb_private::Symtab::FindSymbolContainingFileAddress(), lldb_private::SymbolContext::function, lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::Symbol::GetAddressRef(), lldb_private::Target::GetArchitecture(), GetCallableLoadAddress(), lldb_private::ConstString::GetCString(), lldb_private::Variable::GetDeclaration(), lldb_private::SymbolContext::GetDescription(), GetFileAddress(), lldb_private::UserID::GetID(), lldb_private::Target::GetImages(), GetLoadAddress(), lldb_private::ArchSpec::GetMachine(), GetModule(), lldb_private::Variable::GetName(), lldb_private::Symbol::GetName(), lldb_private::Type::GetName(), GetOffset(), lldb_private::ExecutionContext::GetProcessPtr(), GetSection(), lldb_private::StreamString::GetSize(), lldb_private::VariableList::GetSize(), lldb_private::StreamString::GetString(), lldb_private::SymbolVendor::GetSymtab(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::Variable::GetType(), lldb_private::VariableList::GetVariableAtIndex(), lldb_private::Stream::Indent(), IsSectionOffset(), LLDB_INVALID_ADDRESS, lldb_private::Variable::LocationIsValidForAddress(), m_offset, lldb_private::Stream::Printf(), lldb_private::Stream::PutChar(), lldb_private::Stream::PutCString(), ReadAddress(), ReadCStringFromMemory(), lldb_private::Process::ReadPointerFromMemory(), lldb_private::ModuleList::ResolveSymbolContextForAddress(), SetLoadAddress(), SetOffset(), lldb_private::SymbolContext::symbol, UINT32_MAX, lldb_private::Symbol::ValueIsAddress(), and lldb_private::Stream::Write().

Referenced by lldb::SBBreakpoint::AddLocation(), CommandObjectSourceList::DoExecute(), lldb_private::Symbol::Dump(), lldb_private::LineEntry::Dump(), lldb_private::AddressRange::Dump(), Dump(), DumpAddress(), CommandObjectRegisterRead::DumpRegister(), lldb_private::SymbolContext::DumpStopContext(), lldb_private::ThreadPlanStepOut::GetDescription(), lldb_private::BreakpointResolverAddress::GetDescription(), lldb_private::LineEntry::GetDescription(), lldb_private::Symbol::GetDescription(), CommandObjectSourceInfo::GetSymbolContextsForAddress(), lldb_private::CompactUnwindInfo::GetUnwindPlan(), lldb_private::ThreadPlanAssemblyTracer::Log(), lldb_private::Address::ModulePointerAndOffsetLessThanFunctionObject::operator()(), lldb_private::UnwindPlan::PlanValidAtAddress(), lldb_private::ClangExpressionDeclMap::ResolveUnknownTypes(), and DisassemblerLLVMC::SymbolLookup().

◆ GetAddressClass()

AddressClass Address::GetAddressClass ( ) const

◆ GetCallableLoadAddress()

addr_t Address::GetCallableLoadAddress ( Target target,
bool  is_indirect = false 
) const

Get the load address as a callable code load address.

This function will first resolve its address to a load address. Then, if the address turns out to be in code address, return the load address that would be required to call or return to. The address might have extra bits set (bit zero will be set to Thumb functions for an ARM target) that are required when changing the program counter to setting a return address.

Returns
The valid load virtual address, or LLDB_INVALID_ADDRESS if the address is currently not loaded.

Definition at line 317 of file Address.cpp.

References GetAddressClass(), lldb_private::Target::GetCallableLoadAddress(), GetLoadAddress(), lldb_private::Target::GetProcessSP(), LLDB_INVALID_ADDRESS, and lldb_private::Status::Success().

Referenced by CommandObjectThreadJump::DoExecute(), Dump(), lldb_private::CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo(), lldb_private::ClangExpressionDeclMap::GetSymbolAddress(), lldb_private::Address::ModulePointerAndOffsetLessThanFunctionObject::operator()(), lldb_private::Symbol::ResolveCallableAddress(), lldb_private::ClangExpressionDeclMap::ResolveUnknownTypes(), lldb_private::RegisterContext::SetPC(), and lldb_private::FunctionCaller::WriteFunctionArguments().

◆ GetFileAddress()

addr_t Address::GetFileAddress ( ) const

Get the file address.

If an address comes from a file on disk that has section relative addresses, then it has a virtual address that is relative to unique section in the object file.

Returns
The valid file virtual address, or LLDB_INVALID_ADDRESS if the address doesn't have a file virtual address (image is from memory only with no representation on disk).

Definition at line 272 of file Address.cpp.

References GetSection(), LLDB_INVALID_ADDRESS, m_offset, and SectionWasDeletedPrivate().

Referenced by lldb_private::Block::AddRange(), CompareFileAddress(), CompareModulePointerAndOffset(), SymbolFileDWARFDebugMap::CompleteType(), DynamicLoaderPOSIXDYLD::ComputeLoadOffset(), lldb_private::AddressRange::ContainsFileAddress(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), lldb_private::Variable::Dump(), lldb_private::AddressRange::Dump(), Dump(), lldb_private::Function::Dump(), DumpAddress(), DumpAddressOffsetFromFunction(), CommandObjectSourceInfo::DumpLinesInFunctions(), lldb_private::Variable::DumpLocationForAddress(), lldb_private::AddressRange::Extend(), lldb_private::Module::FindFunctions(), lldb_private::LineTable::FindLineEntryByAddress(), GetAddressClass(), lldb_private::DWARFCallFrameInfo::GetAddressRange(), lldb_private::SymbolContext::GetAddressRangeFromHereToEndLine(), lldb_private::ArchitectureMips::GetBreakableLoadAddress(), lldb_private::ArchitecturePPC64::GetBytesToSkip(), lldb::SBBlock::GetDescription(), DynamicLoaderHexagonDYLD::GetEntryPoint(), lldb_private::Symbol::GetFileAddress(), SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), lldb_private::UnwindTable::GetFuncUnwindersContainingAddress(), SymbolFileDWARF::GetGlobalAranges(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::DWARFExpression::GetOpAndEndOffsets(), lldb_private::SymbolContext::GetParentOfInlinedScope(), SymbolFilePDB::GetPDBSession(), lldb_private::Function::GetPrologueByteSize(), lldb_private::ArmUnwindInfo::GetUnwindPlan(), lldb_private::CompactUnwindInfo::GetUnwindPlan(), lldb_private::StackFrame::GuessValueForRegisterAndOffset(), SymbolFilePDB::InitializeObject(), lldb_private::npdb::SymbolFileNativePDB::InitializeObject(), SymbolFileDWARFDebugMap::InitOSO(), lldb_private::Variable::IsInScope(), lldb_private::CompactUnwindInfo::IsValid(), SymbolFileDWARFDebugMap::LinkOSOAddress(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded(), lldb_private::Variable::LocationIsValidForAddress(), EntitySymbol::Materialize(), NeedsResolvedCompileUnit(), lldb_private::Address::ModulePointerAndOffsetLessThanFunctionObject::operator()(), lldb_private::operator<(), lldb_private::operator>(), SymbolFilePDB::ParseDeclsForContext(), ParsePLTRelocations(), lldb_private::lldb_renderscript::RSModuleDescriptor::ParseRSInfo(), lldb_private::breakpad::SymbolFileBreakpad::ParseSupportFiles(), SymbolFileDWARF::ParseVariableDIE(), DynamicLoaderDarwinKernel::PutToLog(), DynamicLoaderDarwinKernel::ReadKextSummaryHeader(), lldb_private::Target::ReadMemory(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), SymbolFileSymtab::ResolveSymbolContext(), lldb_private::Module::ResolveSymbolContextForAddress(), lldb_private::ClangExpressionDeclMap::ResolveUnknownTypes(), lldb_private::AddressResolverFileLine::SearchCallback(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), lldb_private::IRExecutionUnit::SearchSpec::SearchSpec(), lldb_private::EmulateInstruction::SetInstruction(), lldb_private::BreakpointResolver::SetSCMatchesByLine(), and SourceFileWindowDelegate::WindowDelegateDraw().

◆ GetLoadAddress()

addr_t Address::GetLoadAddress ( Target target) const

Get the load address.

If an address comes from a file on disk that has section relative addresses, then it has a virtual address that is relative to unique section in the object file. Sections get resolved at runtime by DynamicLoader plug-ins as images (executables and shared libraries) get loaded/unloaded. If a section is loaded, then the load address can be resolved.

Returns
The valid load virtual address, or LLDB_INVALID_ADDRESS if the address is currently not loaded.

Definition at line 292 of file Address.cpp.

References GetSection(), LLDB_INVALID_ADDRESS, m_offset, and SectionWasDeletedPrivate().

Referenced by CompareLoadAddress(), lldb_private::AddressRange::ContainsLoadAddress(), lldb_private::Value::ConvertToLoadAddress(), DynamicLoaderPOSIXDYLD::DidAttach(), lldb_private::HistoryUnwind::DoCreateRegisterContextForFrame(), CommandObjectThreadUntil::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), lldb_private::AddressRange::Dump(), Dump(), lldb_private::StackFrame::Dump(), DumpAddress(), DumpAddressOffsetFromFunction(), CommandObjectSourceInfo::DumpLinesInFunctions(), lldb_private::DWARFExpression::Evaluate(), ExtractRuntimeGlobalSymbol(), lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(), HexagonDYLDRendezvous::FindMetadata(), DYLDRendezvous::FindMetadata(), findSymbolAddress(), lldb_private::ArchitectureMips::GetBreakableLoadAddress(), GetCallableLoadAddress(), lldb_private::ThreadPlanCallFunction::GetDescription(), lldb_private::ThreadPlanCallFunctionUsingABI::GetDescription(), SystemRuntimeMacOSX::GetExtendedBacktraceForQueueItem(), lldb_private::StackFrame::GetFrameBaseValue(), lldb_private::ProcessWindows::GetImageInfoAddress(), ProcessElfCore::GetImageInfoAddress(), ProcessFreeBSD::GetImageInfoAddress(), lldb_private::AppleObjCRuntimeV1::GetISAHashTablePointer(), lldb_private::Symbol::GetLoadAddress(), lldb::SBValue::GetLoadAddress(), GetOpcodeLoadAddress(), lldb_private::CallEdge::GetReturnPCAddress(), lldb_private::RegisterContextLLDB::GetStartPC(), DynamicLoaderHexagonDYLD::GetStepThroughTrampolinePlan(), lldb_private::DynamicLoaderDarwin::GetStepThroughTrampolinePlan(), DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(), lldb_private::ClangExpressionDeclMap::GetSymbolAddress(), lldb_private::StackFrame::GetSymbolContext(), lldb_private::MainThreadCheckerRuntime::GetTypeStatic(), lldb_private::Value::GetValueAsData(), DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded(), lldb_private::Variable::LocationIsValidForFrame(), EntitySymbol::Materialize(), lldb_private::Address::ModulePointerAndOffsetLessThanFunctionObject::operator()(), CommandObjectTargetModulesList::PrintModule(), lldb_private::Target::ReadCStringFromMemory(), lldb_private::Target::ReadMemory(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), lldb_private::Process::ResolveIndirectFunction(), ResolveRendezvousAddress(), RetrieveString(), lldb_private::BreakpointResolverAddress::SearchCallback(), lldb_private::IRExecutionUnit::SearchSpec::SearchSpec(), lldb_private::EmulateInstruction::SetInstruction(), lldb_private::ThreadPlanStepRange::SetNextBranchBreakpoint(), lldb_private::ThreadPlanStepOverRange::ShouldStop(), lldb_private::ThreadPlanStepInRange::ShouldStop(), lldb::SBThread::StepOverUntil(), JITLoaderGDB::Terminate(), translate_to_eh_frame_regnum_i386(), translate_to_eh_frame_regnum_x86_64(), lldb_private::ValueObjectVariable::UpdateValue(), and SourceFileWindowDelegate::WindowDelegateDraw().

◆ GetModule()

ModuleSP Address::GetModule ( ) const

Get accessor for the module for this address.

Returns
Returns the Module pointer that this address is an offset in, or NULL if this address doesn't belong in a module, or isn't resolved yet.

Definition at line 264 of file Address.cpp.

References GetSection().

Referenced by lldb_private::DynamicLoaderDarwin::AlwaysRelyOnEHUnwindInfo(), DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo(), lldb_private::Symbol::CalculateSymbolContext(), lldb_private::Symbol::CalculateSymbolContextModule(), CompareModulePointerAndOffset(), lldb_private::CommandObjectDisassemble::DoExecute(), CommandObjectSourceList::DoExecute(), CommandObjectTargetModulesList::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), Dump(), lldb_private::Variable::DumpLocationForAddress(), lldb_private::LineTable::FindLineEntryByAddress(), GetAddressClass(), lldb_private::DWARFCallFrameInfo::GetAddressRange(), lldb_private::ArchitectureMips::GetBreakableLoadAddress(), GetByteOrderAndAddressSize(), lldb::SBInstructionList::GetDescription(), lldb::SBInstruction::GetDescription(), lldb_private::StackFrame::GetFrameCodeAddress(), lldb::SBFunction::GetInstructions(), lldb::SBSymbol::GetInstructions(), lldb_private::Symbol::GetInstructions(), lldb_private::Symbol::GetPrologueByteSize(), CommandObjectSourceInfo::GetSymbolContextsForAddress(), GetSymbolDeclarationFromAddress(), lldb_private::MainThreadCheckerRuntime::GetTypeStatic(), lldb_private::DWARFCallFrameInfo::GetUnwindPlan(), IsValid(), SymbolFileDWARFDebugMap::LinkOSOAddress(), lldb_private::Variable::LocationIsValidForAddress(), LookupAddressInModule(), lldb_private::DynamicLoaderWindowsDYLD::OnUnloadModule(), lldb_private::operator<(), lldb_private::operator>(), lldb::SBInstruction::Print(), lldb_private::Disassembler::PrintInstructions(), ReadAddress(), lldb_private::Target::ReadMemory(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), lldb_private::BreakpointLocationList::RemoveInvalidLocations(), lldb_private::ModuleList::ResolveSymbolContextForAddress(), RetrieveString(), DisassemblerLLVMC::SymbolLookup(), and lldb_private::DynamicLoaderDarwin::UnloadImages().

◆ GetOffset()

lldb::addr_t lldb_private::Address::GetOffset ( ) const
inline

Get the section relative offset value.

Returns
The current offset, or LLDB_INVALID_ADDRESS if this address doesn't contain a valid offset.

Definition at line 317 of file Address.h.

References m_offset.

Referenced by lldb_private::ArchitecturePPC64::AdjustBreakpointAddress(), lldb_private::AddressRange::ContainsFileAddress(), lldb_private::AddressRange::ContainsLoadAddress(), CommandObjectThreadUntil::DoExecute(), lldb_private::Symbol::Dump(), lldb_private::AddressRange::Dump(), Dump(), lldb_private::AddressRange::DumpDebug(), lldb_private::SymbolContext::DumpStopContext(), lldb_private::BreakpointLocationList::FindByAddress(), lldb_private::Symbol::GetDescription(), lldb_private::Function::GetEndLineSourceInfo(), lldb_private::StackFrame::GetFrameCodeAddress(), SymbolFileDWARF::GetGlobalAranges(), lldb_private::Symbol::GetIntegerValue(), lldb_private::Block::GetRangeContainingAddress(), lldb_private::Block::GetRangeIndexContainingAddress(), lldb_private::Symbol::GetReExportedSymbolName(), lldb_private::StackFrame::GetSymbolContext(), ObjectFilePECOFF::GetSymtab(), lldb_private::operator!=(), lldb_private::operator==(), SymbolFileSymtab::ParseFunctions(), ReadCStringFromMemory(), lldb_private::Target::ReadMemory(), lldb_private::Target::ReadMemoryFromFileCache(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), ResolveAddress(), lldb_private::Module::ResolveSymbolContextForAddress(), lldb_private::BreakpointResolverAddress::SearchCallback(), lldb_private::AddressResolverName::SearchCallback(), lldb_private::BreakpointResolverName::SearchCallback(), lldb_private::BreakpointResolverAddress::SerializeToStructuredData(), lldb_private::ThreadPlanStepOut::ThreadPlanStepOut(), and lldb_private::DynamicLoaderDarwin::UnloadImages().

◆ GetOpcodeLoadAddress()

addr_t Address::GetOpcodeLoadAddress ( Target target,
AddressClass  addr_class = AddressClass::eInvalid 
) const

Get the load address as an opcode load address.

This function will first resolve its address to a load address. Then, if the address turns out to be in code address, return the load address for an opcode. This address object might have extra bits set (bit zero will be set to Thumb functions for an ARM target) that are required for changing the program counter and this function will remove any bits that are intended for these special purposes. The result of this function can be used to safely write a software breakpoint trap to memory.

Returns
The valid load virtual address with extra callable bits removed, or LLDB_INVALID_ADDRESS if the address is currently not loaded.

Definition at line 349 of file Address.cpp.

References lldb_private::eInvalid, GetAddressClass(), GetLoadAddress(), lldb_private::Target::GetOpcodeLoadAddress(), and LLDB_INVALID_ADDRESS.

Referenced by lldb_private::AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(), lldb_private::Process::CreateBreakpointSite(), DynamicLoaderMacOS::GetDyldLockVariableAddressFromModule(), GetStopReasonDescription(), GetSymbolDeclarationFromAddress(), lldb_private::MainThreadCheckerRuntime::GetTypeStatic(), lldb_private::Address::ModulePointerAndOffsetLessThanFunctionObject::operator()(), DynamicLoaderMacOS::SetNotificationBreakpoint(), lldb_private::ThreadPlanRunToAddress::ThreadPlanRunToAddress(), StatusBarWindowDelegate::WindowDelegateDraw(), and lldb_private::AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler().

◆ GetSection()

lldb::SectionSP lldb_private::Address::GetSection ( ) const
inline

Get const accessor for the section.

Returns
Returns the const lldb::Section pointer that this address is an offset in, or NULL if this address is absolute.

Definition at line 410 of file Address.h.

References m_section_wp.

Referenced by CalculateSymbolContext(), CalculateSymbolContextBlock(), CalculateSymbolContextCompileUnit(), CalculateSymbolContextFunction(), CalculateSymbolContextLineEntry(), lldb_private::Function::CalculateSymbolContextModule(), CalculateSymbolContextModule(), CalculateSymbolContextSymbol(), lldb_private::AddressRange::ContainsFileAddress(), lldb_private::AddressRange::ContainsLoadAddress(), CommandObjectThreadUntil::DoExecute(), CommandObjectMemoryRegion::DoExecute(), Dump(), DumpAddressOffsetFromFunction(), lldb_private::AddressRange::DumpDebug(), ObjectFileMachO::GetAddressClass(), lldb_private::ObjectFile::GetAddressClass(), lldb_private::Symbol::GetDescription(), GetFileAddress(), SymbolFileDWARF::GetGlobalAranges(), GetLoadAddress(), GetModule(), lldb_private::Block::GetRangeContainingAddress(), lldb_private::Block::GetRangeIndexContainingAddress(), ObjectFilePECOFF::GetSymtab(), IsSectionOffset(), lldb_private::operator!=(), lldb_private::operator==(), ObjectFileMachO::ParseSymtab(), lldb_private::Target::ReadMemoryFromFileCache(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), RemoveFunctionsWithModuleNotEqualTo(), lldb_private::BreakpointResolverAddress::ResolveBreakpoint(), lldb_private::BreakpointResolverAddress::ResolveBreakpointInModules(), lldb_private::Module::ResolveSymbolContextForAddress(), SectionWasDeleted(), lldb_private::BreakpointResolverAddress::SerializeToStructuredData(), DisassemblerLLVMC::SymbolLookup(), and lldb_private::Symbol::ValueIsAddress().

◆ IsSectionOffset()

bool lldb_private::Address::IsSectionOffset ( ) const
inline

Check if an address is section offset.

When converting a virtual file or load address into a section offset based address, we often need to know if, given a section list, if the address was able to be converted to section offset. This function returns true if the current value contained in this object is section offset based.

Returns
Returns true if the address has a valid section and offset, false otherwise.

Definition at line 330 of file Address.h.

References GetSection(), and IsValid().

Referenced by Dump(), lldb_private::Variable::DumpLocationForAddress(), lldb_private::BreakpointLocationList::FindByAddress(), lldb_private::StackFrame::GetFrameCodeAddress(), lldb_private::Variable::LocationIsValidForAddress(), lldb_private::Target::ReadMemory(), ResolveAddress(), lldb_private::Module::ResolveSymbolContextForAddress(), and lldb_private::BreakpointResolverAddress::SearchCallback().

◆ IsValid()

bool lldb_private::Address::IsValid ( ) const
inline

Check if the object state is valid.

A valid Address object contains either a section pointer and offset (for section offset based addresses), or just a valid offset (for absolute addresses that have no section).

Returns
Returns true if the offset is valid, false otherwise.

Definition at line 343 of file Address.h.

References lldb_private::eInvalid, GetModule(), LLDB_INVALID_ADDRESS, m_offset, MemorySize(), ResolveAddressUsingFileSections(), SetCallableLoadAddress(), SetLoadAddress(), and SetOpcodeLoadAddress().

Referenced by lldb_private::Process::AdvanceAddressToNextBranchInstruction(), UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(), lldb_private::x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite(), lldb_private::CallEdge::CallEdge(), DynamicLoaderPOSIXDYLD::ComputeLoadOffset(), lldb_private::Target::CreateBreakpoint(), lldb_private::Disassembler::Disassemble(), lldb_private::Disassembler::DisassembleRange(), lldb_private::CommandObjectDisassemble::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), DumpAddressOffsetFromFunction(), lldb_private::SymbolContext::DumpStopContext(), lldb_private::SymbolContext::FindBestGlobalDataSymbol(), lldb_private::BreakpointLocationList::FindByAddress(), UnwindAssembly_x86::FirstNonPrologueInsn(), lldb_private::FormatEntity::Format(), lldb_private::FuncUnwinders::GetArmUnwindUnwindPlan(), lldb_private::FuncUnwinders::GetCompactUnwindUnwindPlan(), lldb_private::FuncUnwinders::GetDebugFrameUnwindPlan(), DynamicLoaderMacOS::GetDyldLockVariableAddressFromModule(), lldb_private::FuncUnwinders::GetEHFrameUnwindPlan(), ObjectFileMachO::GetEntryPointAddress(), lldb_private::FuncUnwinders::GetFirstNonPrologueInsn(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), lldb_private::ProcessWindows::GetImageInfoAddress(), ProcessElfCore::GetImageInfoAddress(), ProcessFreeBSD::GetImageInfoAddress(), UnwindAssembly_x86::GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::DynamicLoaderDarwin::GetPthreadSetSpecificAddress(), lldb_private::RegisterContextLLDB::GetStartPC(), lldb_private::DynamicLoaderDarwin::GetStepThroughTrampolinePlan(), GetStopReasonDescription(), lldb_private::ClangExpressionDeclMap::GetSymbolAddress(), lldb_private::StackFrame::GetSymbolContext(), GetSymbolDeclarationFromAddress(), lldb_private::DynamicLoaderDarwin::GetThreadLocalData(), lldb_private::MainThreadCheckerRuntime::GetTypeStatic(), lldb_private::Value::GetValueAsData(), IsSectionOffset(), lldb_private::LineEntry::IsValid(), DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded(), lldb_private::UserExpression::LockAndCheckContext(), DWARFASTParserClang::ParseFunctionFromDWARF(), lldb_private::Disassembler::ParseInstructions(), SymbolFilePDB::ParseLanguage(), lldb_private::UnwindPlan::PlanValidAtAddress(), DynamicLoaderDarwinKernel::ReadAllKextSummaries(), DynamicLoaderDarwinKernel::ReadKextSummaryHeader(), lldb_private::Target::ReadMemory(), lldb_private::Target::ReadPointerFromMemory(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), ResolveAddress(), lldb_private::Symbol::ResolveCallableAddress(), SymbolFileDWARF::ResolveFunction(), ResolveRendezvousAddress(), lldb_private::AddressResolverFileLine::SearchCallback(), lldb_private::BreakpointResolverName::SearchCallback(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), lldb_private::EmulateInstruction::SetInstruction(), lldb_private::ThreadPlanStepRange::SetNextBranchBreakpoint(), DynamicLoaderMacOS::SetNotificationBreakpoint(), lldb_private::UnwindPlan::SetPlanValidAddressRange(), lldb_private::BreakpointResolver::SetSCMatchesByLine(), DisassemblerLLVMC::SymbolLookup(), JITLoaderGDB::Terminate(), SourceFileWindowDelegate::WindowDelegateDraw(), lldb_private::AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler(), and lldb_private::UnwindTable::~UnwindTable().

◆ MemorySize()

size_t Address::MemorySize ( ) const

Get the memory cost of this object.

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

Definition at line 924 of file Address.cpp.

References Address().

Referenced by IsValid().

◆ operator=()

const Address & Address::operator= ( const Address rhs)

Assignment operator.

Copies the address value from another Address object rhs into this object.

Parameters
[in]rhsA const Address object reference to copy.
Returns
A const Address object reference to this.

Definition at line 239 of file Address.cpp.

References m_offset, and m_section_wp.

Referenced by Address().

◆ ResolveAddressUsingFileSections()

bool Address::ResolveAddressUsingFileSections ( lldb::addr_t  addr,
const SectionList sections 
)

Resolve a file virtual address using a section list.

Given a list of sections, attempt to resolve addr as an offset into one of the file sections.

Returns
Returns true if addr was able to be resolved, false otherwise.

Definition at line 247 of file Address.cpp.

References lldb_private::SectionList::FindSectionContainingFileAddress(), m_offset, and m_section_wp.

Referenced by Address(), ObjectFileMachO::GetEntryPointAddress(), IsValid(), DWARFASTParserClang::ParseFunctionFromDWARF(), and lldb_private::Module::ResolveFileAddress().

◆ SectionWasDeleted()

bool Address::SectionWasDeleted ( ) const

◆ SectionWasDeletedPrivate()

bool Address::SectionWasDeletedPrivate ( ) const
protected

Definition at line 768 of file Address.cpp.

References m_section_wp.

Referenced by GetFileAddress(), GetLoadAddress(), and SectionWasDeleted().

◆ SetCallableLoadAddress()

bool Address::SetCallableLoadAddress ( lldb::addr_t  load_addr,
Target target 
)

◆ SetLoadAddress()

bool Address::SetLoadAddress ( lldb::addr_t  load_addr,
Target target,
bool  allow_section_end = false 
)

Set the address to represent load_addr.

The address will attempt to find a loaded section within target that contains load_addr. If successful, this address object will have a valid section and offset. Else this address object will have no section (NULL) and the offset will be load_addr.

Parameters
[in]load_addrA load address from a current process.
[in]targetThe target to use when trying resolve the address into a section + offset. The Target's SectionLoadList object is used to resolve the address.
[in]allow_section_endIf true, treat an address pointing to the end of the module as belonging to that module.
Returns
Returns true if the load address was resolved to be section/offset, false otherwise. It is often ok for an address to not resolve to a section in a module, this often happens for JIT'ed code, or any load addresses on the stack or heap.

Definition at line 998 of file Address.cpp.

References lldb_private::Target::GetSectionLoadList(), m_offset, m_section_wp, and lldb_private::SectionLoadList::ResolveLoadAddress().

Referenced by CommandObjectTargetModulesList::DoExecute(), Dump(), lldb_private::FormatEntity::Format(), lldb::SBValue::GetAddress(), lldb_private::ThreadPlanStepOut::GetDescription(), lldb_private::BreakpointLocation::GetDescription(), lldb_private::InstructionList::GetIndexOfInstructionAtLoadAddress(), lldb_private::Block::GetRangeContainingLoadAddress(), lldb_private::StackFrame::GetSymbolContext(), IsValid(), ABIMacOSX_arm::PrepareTrivialCall(), ABISysV_arm::PrepareTrivialCall(), lldb_private::RegisterContextLLDB::RegisterContextLLDB(), lldb_private::StackFrameList::ResetCurrentInlinedDepth(), SetCallableLoadAddress(), SetOpcodeLoadAddress(), and lldb_private::DynamicLoaderDarwin::UnloadImages().

◆ SetOffset()

bool lldb_private::Address::SetOffset ( lldb::addr_t  offset)
inline

◆ SetOpcodeLoadAddress()

bool Address::SetOpcodeLoadAddress ( lldb::addr_t  load_addr,
Target target,
AddressClass  addr_class = AddressClass::eInvalid,
bool  allow_section_end = false 
)

◆ SetRawAddress()

void lldb_private::Address::SetRawAddress ( lldb::addr_t  addr)
inline

◆ SetSection()

void lldb_private::Address::SetSection ( const lldb::SectionSP &  section_sp)
inline

Set accessor for the section.

Parameters
[in]sectionA new lldb::Section pointer to use as the section base. Can be NULL for absolute addresses that are not relative to any section.

Definition at line 444 of file Address.h.

References m_section_wp.

Referenced by ObjectFileMachO::GetBaseAddress(), ObjectFileMachO::ParseSymtab(), lldb_private::Section::ResolveContainedAddress(), and lldb::SBAddress::SetAddress().

◆ Slide()

bool lldb_private::Address::Slide ( int64_t  offset)
inline

Member Data Documentation

◆ m_offset

lldb::addr_t lldb_private::Address::m_offset
protected

◆ m_section_wp

lldb::SectionWP lldb_private::Address::m_section_wp
protected

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