LLDB mainline
lldb_private::Section Class Reference

#include <Section.h>

Inheritance diagram for lldb_private::Section:
[legend]

Public Member Functions

 Section (const lldb::ModuleSP &module_sp, ObjectFile *obj_file, lldb::user_id_t sect_id, ConstString name, lldb::SectionType sect_type, lldb::addr_t file_vm_addr, lldb::addr_t vm_size, lldb::offset_t file_offset, lldb::offset_t file_size, uint32_t log2align, uint32_t flags, uint32_t target_byte_size=1)
 Section (const lldb::SectionSP &parent_section_sp, const lldb::ModuleSP &module_sp, ObjectFile *obj_file, lldb::user_id_t sect_id, ConstString name, lldb::SectionType sect_type, lldb::addr_t file_vm_addr, lldb::addr_t vm_size, lldb::offset_t file_offset, lldb::offset_t file_size, uint32_t log2align, uint32_t flags, uint32_t target_byte_size=1)
 ~Section ()
bool ContainsFileAddress (lldb::addr_t vm_addr) const
SectionListGetChildren ()
const SectionListGetChildren () const
void Dump (llvm::raw_ostream &s, unsigned indent, Target *target, uint32_t depth) const
void DumpName (llvm::raw_ostream &s) const
lldb::addr_t GetLoadBaseAddress (Target *target) const
bool ResolveContainedAddress (lldb::addr_t offset, Address &so_addr, bool allow_section_end=false) const
lldb::offset_t GetFileOffset () const
void SetFileOffset (lldb::offset_t file_offset)
lldb::offset_t GetFileSize () const
void SetFileSize (lldb::offset_t file_size)
lldb::addr_t GetFileAddress () const
bool SetFileAddress (lldb::addr_t file_addr)
lldb::addr_t GetOffset () const
lldb::addr_t GetByteSize () const
void SetByteSize (lldb::addr_t byte_size)
bool IsFake () const
void SetIsFake (bool fake)
bool IsEncrypted () const
void SetIsEncrypted (bool b)
bool IsDescendant (const Section *section)
ConstString GetName () const
bool Slide (lldb::addr_t slide_amount, bool slide_children)
lldb::SectionType GetType () const
const char * GetTypeAsCString () const
lldb::SectionSP GetParent () const
bool IsThreadSpecific () const
void SetIsThreadSpecific (bool b)
uint32_t GetPermissions () const
 Get the permissions as OR'ed bits from lldb::Permissions.
void SetPermissions (uint32_t permissions)
 Set the permissions using bits OR'ed from lldb::Permissions.
ObjectFileGetObjectFile ()
const ObjectFileGetObjectFile () const
lldb::offset_t GetSectionData (void *dst, lldb::offset_t dst_len, lldb::offset_t offset=0)
 Read the section data from the object file that the section resides in.
lldb::offset_t GetSectionData (DataExtractor &data)
 Get the shared reference to the section data from the object file that the section resides in.
uint32_t GetLog2Align ()
void SetLog2Align (uint32_t align)
uint32_t GetTargetByteSize () const
bool IsRelocated () const
void SetIsRelocated (bool b)
bool ContainsOnlyDebugInfo () const
 Returns true if this section contains debug information.
Public Member Functions inherited from lldb_private::ModuleChild
 ModuleChild (const lldb::ModuleSP &module_sp)
 Construct with owning module.
 ~ModuleChild ()
 Destructor.
const ModuleChildoperator= (const ModuleChild &rhs)
 Assignment operator.
lldb::ModuleSP GetModule () const
 Get const accessor for the module pointer.
void SetModule (const lldb::ModuleSP &module_sp)
 Set accessor for the module pointer.
Public Member Functions inherited from lldb_private::UserID
 UserID (lldb::user_id_t uid=LLDB_INVALID_UID)
 Construct with optional user ID.
 ~UserID ()=default
 Destructor.
void Clear ()
 Clears the object state.
lldb::user_id_t GetID () const
 Get accessor for the user ID.
void SetID (lldb::user_id_t uid)
 Set accessor for the user ID.
Public Member Functions inherited from lldb_private::Flags
 Flags (ValueType flags=0)
 Construct with initial flag bit values.
ValueType Get () const
 Get accessor for all flags.
size_t GetBitSize () const
 Return the number of flags that can be represented in this object.
void Reset (ValueType flags)
 Set accessor for all flags.
ValueType Clear (ValueType mask=~static_cast< ValueType >(0))
 Clear one or more flags.
ValueType Set (ValueType mask)
 Set one or more flags by logical OR'ing mask with the current flags.
bool AllSet (ValueType mask) const
 Test if all bits in mask are 1 in the current flags.
bool AnySet (ValueType mask) const
 Test one or more flags.
bool Test (ValueType bit) const
 Test a single flag bit.
bool AllClear (ValueType mask) const
 Test if all bits in mask are clear.
bool AnyClear (ValueType mask) const
bool IsClear (ValueType bit) const
 Test a single flag bit to see if it is clear (zero).

Static Public Member Functions

static int Compare (const Section &a, const Section &b)

Protected Attributes

ObjectFilem_obj_file
lldb::SectionType m_type
lldb::SectionWP m_parent_wp
ConstString m_name
lldb::addr_t m_file_addr
lldb::addr_t m_byte_size
lldb::offset_t m_file_offset
lldb::offset_t m_file_size
uint32_t m_log2align
SectionList m_children
bool m_fake: 1
bool m_encrypted: 1
bool m_thread_specific: 1
bool m_readable: 1
bool m_writable: 1
bool m_executable: 1
bool m_relocated: 1
uint32_t m_target_byte_size
Protected Attributes inherited from lldb_private::ModuleChild
lldb::ModuleWP m_module_wp
 The Module that owns the object that inherits from this class.
Protected Attributes inherited from lldb_private::UserID
lldb::user_id_t m_uid
 The user ID that uniquely identifies an object.
Protected Attributes inherited from lldb_private::Flags
ValueType m_flags
 The flags.

Private Member Functions

 Section (const Section &)=delete
const Sectionoperator= (const Section &)=delete

Additional Inherited Members

Public Types inherited from lldb_private::Flags
typedef uint32_t ValueType
 The value type for flags is a 32 bit unsigned integer type.

Detailed Description

Definition at line 126 of file Section.h.

Constructor & Destructor Documentation

◆ Section() [1/3]

◆ Section() [2/3]

Section::Section ( const lldb::SectionSP & parent_section_sp,
const lldb::ModuleSP & module_sp,
ObjectFile * obj_file,
lldb::user_id_t sect_id,
ConstString name,
lldb::SectionType sect_type,
lldb::addr_t file_vm_addr,
lldb::addr_t vm_size,
lldb::offset_t file_offset,
lldb::offset_t file_size,
uint32_t log2align,
uint32_t flags,
uint32_t target_byte_size = 1 )

◆ ~Section()

Section::~Section ( )
default

◆ Section() [3/3]

lldb_private::Section::Section ( const Section & )
privatedelete

References Section().

Member Function Documentation

◆ Compare()

int lldb_private::Section::Compare ( const Section & a,
const Section & b )
static

References Section().

◆ ContainsFileAddress()

bool Section::ContainsFileAddress ( lldb::addr_t vm_addr) const

◆ ContainsOnlyDebugInfo()

bool Section::ContainsOnlyDebugInfo ( ) const

Returns true if this section contains debug information.

Symbol tables are not considered debug information since some symbols might contain debug information (STABS, COFF) but not all symbols do, so to keep this fast and simple only sections that contains only debug information should return true.

Definition at line 394 of file Section.cpp.

References lldb::eSectionTypeAbsoluteAddress, lldb::eSectionTypeARMexidx, lldb::eSectionTypeARMextab, lldb::eSectionTypeCode, lldb::eSectionTypeCompactUnwind, lldb::eSectionTypeContainer, lldb::eSectionTypeCTF, lldb::eSectionTypeData, lldb::eSectionTypeData16, lldb::eSectionTypeData4, lldb::eSectionTypeData8, lldb::eSectionTypeDataCString, lldb::eSectionTypeDataCStringPointers, lldb::eSectionTypeDataObjCCFStrings, lldb::eSectionTypeDataObjCMessageRefs, lldb::eSectionTypeDataPointers, lldb::eSectionTypeDataSymbolAddress, lldb::eSectionTypeDebug, lldb::eSectionTypeDWARFAppleNames, lldb::eSectionTypeDWARFAppleNamespaces, lldb::eSectionTypeDWARFAppleObjC, lldb::eSectionTypeDWARFAppleTypes, lldb::eSectionTypeDWARFDebugAbbrev, lldb::eSectionTypeDWARFDebugAbbrevDwo, lldb::eSectionTypeDWARFDebugAddr, lldb::eSectionTypeDWARFDebugAranges, lldb::eSectionTypeDWARFDebugCuIndex, lldb::eSectionTypeDWARFDebugFrame, lldb::eSectionTypeDWARFDebugInfo, lldb::eSectionTypeDWARFDebugInfoDwo, lldb::eSectionTypeDWARFDebugLine, lldb::eSectionTypeDWARFDebugLineStr, lldb::eSectionTypeDWARFDebugLoc, lldb::eSectionTypeDWARFDebugLocDwo, lldb::eSectionTypeDWARFDebugLocLists, lldb::eSectionTypeDWARFDebugLocListsDwo, lldb::eSectionTypeDWARFDebugMacInfo, lldb::eSectionTypeDWARFDebugMacro, lldb::eSectionTypeDWARFDebugNames, lldb::eSectionTypeDWARFDebugPubNames, lldb::eSectionTypeDWARFDebugPubTypes, lldb::eSectionTypeDWARFDebugRanges, lldb::eSectionTypeDWARFDebugRngLists, lldb::eSectionTypeDWARFDebugRngListsDwo, lldb::eSectionTypeDWARFDebugStr, lldb::eSectionTypeDWARFDebugStrDwo, lldb::eSectionTypeDWARFDebugStrOffsets, lldb::eSectionTypeDWARFDebugStrOffsetsDwo, lldb::eSectionTypeDWARFDebugTuIndex, lldb::eSectionTypeDWARFDebugTypes, lldb::eSectionTypeDWARFDebugTypesDwo, lldb::eSectionTypeDWARFGNUDebugAltLink, lldb::eSectionTypeEHFrame, lldb::eSectionTypeELFDynamicLinkInfo, lldb::eSectionTypeELFDynamicSymbols, lldb::eSectionTypeELFRelocationEntries, lldb::eSectionTypeELFSymbolTable, lldb::eSectionTypeGoSymtab, lldb::eSectionTypeInvalid, lldb::eSectionTypeLLDBFormatters, lldb::eSectionTypeLLDBTypeSummaries, lldb::eSectionTypeOther, lldb::eSectionTypeSwiftModules, lldb::eSectionTypeWasmName, lldb::eSectionTypeZeroFill, and m_type.

◆ Dump()

◆ DumpName()

void Section::DumpName ( llvm::raw_ostream & s) const

◆ GetByteSize()

◆ GetChildren() [1/2]

◆ GetChildren() [2/2]

const SectionList & lldb_private::Section::GetChildren ( ) const
inline

Definition at line 158 of file Section.h.

References m_children.

◆ GetFileAddress()

◆ GetFileOffset()

◆ GetFileSize()

◆ GetLoadBaseAddress()

◆ GetLog2Align()

uint32_t lldb_private::Section::GetLog2Align ( )
inline

Definition at line 258 of file Section.h.

References m_log2align.

◆ GetName()

◆ GetObjectFile() [1/2]

◆ GetObjectFile() [2/2]

const ObjectFile * lldb_private::Section::GetObjectFile ( ) const
inline

Definition at line 221 of file Section.h.

References m_obj_file.

◆ GetOffset()

lldb::addr_t Section::GetOffset ( ) const

Definition at line 223 of file Section.cpp.

References GetParent(), and m_file_addr.

Referenced by GetLoadBaseAddress(), and ResolveContainedAddress().

◆ GetParent()

lldb::SectionSP lldb_private::Section::GetParent ( ) const
inline

Definition at line 208 of file Section.h.

References m_parent_wp.

Referenced by DumpName(), GetFileAddress(), GetLoadBaseAddress(), GetOffset(), IsDescendant(), and SetFileAddress().

◆ GetPermissions()

uint32_t Section::GetPermissions ( ) const

Get the permissions as OR'ed bits from lldb::Permissions.

Definition at line 363 of file Section.cpp.

References m_executable, m_readable, and m_writable.

Referenced by ProcessMachCore::CreateMemoryRegions().

◆ GetSectionData() [1/2]

lldb::offset_t Section::GetSectionData ( DataExtractor & data)

Get the shared reference to the section data from the object file that the section resides in.

No copies of the data will be make unless the object file has been read from memory. If the object file is on disk, it will shared the mmap data for the entire object file.

Parameters
[in]dataWhere to place the data, address byte size, and byte order
Returns
The number of bytes read from the section, or zero if the section has no data or offset is not a valid offset in this section.

Definition at line 388 of file Section.cpp.

References m_obj_file.

◆ GetSectionData() [2/2]

lldb::offset_t Section::GetSectionData ( void * dst,
lldb::offset_t dst_len,
lldb::offset_t offset = 0 )

Read the section data from the object file that the section resides in.

Parameters
[in]dstWhere to place the data
[in]dst_lenHow many bytes of section data to read
[in]offsetThe offset in bytes within this section's data at which to start copying data from.
Returns
The number of bytes read from the section, or zero if the section has no data or offset is not a valid offset in this section.

Definition at line 381 of file Section.cpp.

References m_obj_file.

◆ GetTargetByteSize()

uint32_t lldb_private::Section::GetTargetByteSize ( ) const
inline

Definition at line 263 of file Section.h.

References m_target_byte_size.

Referenced by lldb_private::ObjectFile::ReadSectionData().

◆ GetType()

lldb::SectionType lldb_private::Section::GetType ( ) const
inline

Definition at line 204 of file Section.h.

References m_type.

Referenced by lldb_private::ObjectFile::ReadSectionData().

◆ GetTypeAsCString()

const char * Section::GetTypeAsCString ( ) const

Definition at line 28 of file Section.cpp.

References lldb::eSectionTypeAbsoluteAddress, lldb::eSectionTypeARMexidx, lldb::eSectionTypeARMextab, lldb::eSectionTypeCode, lldb::eSectionTypeCompactUnwind, lldb::eSectionTypeContainer, lldb::eSectionTypeCTF, lldb::eSectionTypeData, lldb::eSectionTypeData16, lldb::eSectionTypeData4, lldb::eSectionTypeData8, lldb::eSectionTypeDataCString, lldb::eSectionTypeDataCStringPointers, lldb::eSectionTypeDataObjCCFStrings, lldb::eSectionTypeDataObjCMessageRefs, lldb::eSectionTypeDataPointers, lldb::eSectionTypeDataSymbolAddress, lldb::eSectionTypeDebug, lldb::eSectionTypeDWARFAppleNames, lldb::eSectionTypeDWARFAppleNamespaces, lldb::eSectionTypeDWARFAppleObjC, lldb::eSectionTypeDWARFAppleTypes, lldb::eSectionTypeDWARFDebugAbbrev, lldb::eSectionTypeDWARFDebugAbbrevDwo, lldb::eSectionTypeDWARFDebugAddr, lldb::eSectionTypeDWARFDebugAranges, lldb::eSectionTypeDWARFDebugCuIndex, lldb::eSectionTypeDWARFDebugFrame, lldb::eSectionTypeDWARFDebugInfo, lldb::eSectionTypeDWARFDebugInfoDwo, lldb::eSectionTypeDWARFDebugLine, lldb::eSectionTypeDWARFDebugLineStr, lldb::eSectionTypeDWARFDebugLoc, lldb::eSectionTypeDWARFDebugLocDwo, lldb::eSectionTypeDWARFDebugLocLists, lldb::eSectionTypeDWARFDebugLocListsDwo, lldb::eSectionTypeDWARFDebugMacInfo, lldb::eSectionTypeDWARFDebugMacro, lldb::eSectionTypeDWARFDebugNames, lldb::eSectionTypeDWARFDebugPubNames, lldb::eSectionTypeDWARFDebugPubTypes, lldb::eSectionTypeDWARFDebugRanges, lldb::eSectionTypeDWARFDebugRngLists, lldb::eSectionTypeDWARFDebugRngListsDwo, lldb::eSectionTypeDWARFDebugStr, lldb::eSectionTypeDWARFDebugStrDwo, lldb::eSectionTypeDWARFDebugStrOffsets, lldb::eSectionTypeDWARFDebugStrOffsetsDwo, lldb::eSectionTypeDWARFDebugTuIndex, lldb::eSectionTypeDWARFDebugTypes, lldb::eSectionTypeDWARFDebugTypesDwo, lldb::eSectionTypeDWARFGNUDebugAltLink, lldb::eSectionTypeEHFrame, lldb::eSectionTypeELFDynamicLinkInfo, lldb::eSectionTypeELFDynamicSymbols, lldb::eSectionTypeELFRelocationEntries, lldb::eSectionTypeELFSymbolTable, lldb::eSectionTypeGoSymtab, lldb::eSectionTypeInvalid, lldb::eSectionTypeLLDBFormatters, lldb::eSectionTypeLLDBTypeSummaries, lldb::eSectionTypeOther, lldb::eSectionTypeSwiftModules, lldb::eSectionTypeWasmName, lldb::eSectionTypeZeroFill, and m_type.

Referenced by Dump().

◆ IsDescendant()

bool Section::IsDescendant ( const Section * section)

Definition at line 338 of file Section.cpp.

References GetParent(), and Section().

◆ IsEncrypted()

bool lldb_private::Section::IsEncrypted ( ) const
inline

Definition at line 194 of file Section.h.

References m_encrypted.

◆ IsFake()

bool lldb_private::Section::IsFake ( ) const
inline

Definition at line 190 of file Section.h.

References m_fake.

Referenced by lldb_private::SectionList::FindSectionContainingFileAddress().

◆ IsRelocated()

bool lldb_private::Section::IsRelocated ( ) const
inline

◆ IsThreadSpecific()

bool lldb_private::Section::IsThreadSpecific ( ) const
inline

Definition at line 210 of file Section.h.

References m_thread_specific.

Referenced by ContainsFileAddress(), and ObjectFileMachO::SectionIsLoadable().

◆ operator=()

const Section & lldb_private::Section::operator= ( const Section & )
privatedelete

References Section().

◆ ResolveContainedAddress()

bool Section::ResolveContainedAddress ( lldb::addr_t offset,
Address & so_addr,
bool allow_section_end = false ) const

◆ SetByteSize()

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

Definition at line 188 of file Section.h.

References m_byte_size.

Referenced by ObjectFileMachO::ProcessSegmentCommand().

◆ SetFileAddress()

bool Section::SetFileAddress ( lldb::addr_t file_addr)

Definition at line 210 of file Section.cpp.

References GetParent(), and m_file_addr.

◆ SetFileOffset()

void lldb_private::Section::SetFileOffset ( lldb::offset_t file_offset)
inline

Definition at line 172 of file Section.h.

References m_file_offset.

Referenced by ObjectFileMachO::ProcessSegmentCommand().

◆ SetFileSize()

void lldb_private::Section::SetFileSize ( lldb::offset_t file_size)
inline

Definition at line 178 of file Section.h.

References m_file_size.

Referenced by ObjectFileMachO::ProcessSegmentCommand().

◆ SetIsEncrypted()

void lldb_private::Section::SetIsEncrypted ( bool b)
inline

Definition at line 196 of file Section.h.

References m_encrypted.

◆ SetIsFake()

void lldb_private::Section::SetIsFake ( bool fake)
inline

Definition at line 192 of file Section.h.

References m_fake.

◆ SetIsRelocated()

void lldb_private::Section::SetIsRelocated ( bool b)
inline

Definition at line 267 of file Section.h.

References m_relocated.

Referenced by ObjectFileELF::RelocateSection().

◆ SetIsThreadSpecific()

void lldb_private::Section::SetIsThreadSpecific ( bool b)
inline

Definition at line 212 of file Section.h.

References m_thread_specific.

◆ SetLog2Align()

void lldb_private::Section::SetLog2Align ( uint32_t align)
inline

Definition at line 260 of file Section.h.

References m_log2align.

◆ SetPermissions()

void Section::SetPermissions ( uint32_t permissions)

Set the permissions using bits OR'ed from lldb::Permissions.

Definition at line 375 of file Section.cpp.

References m_executable, m_readable, and m_writable.

◆ Slide()

bool Section::Slide ( lldb::addr_t slide_amount,
bool slide_children )

Definition at line 347 of file Section.cpp.

References LLDB_INVALID_ADDRESS, m_children, and m_file_addr.

Referenced by ObjectFileMachO::ProcessSegmentCommand().

Member Data Documentation

◆ m_byte_size

lldb::addr_t lldb_private::Section::m_byte_size
protected

Definition at line 285 of file Section.h.

Referenced by Dump(), GetByteSize(), Section(), Section(), and SetByteSize().

◆ m_children

SectionList lldb_private::Section::m_children
protected

Definition at line 292 of file Section.h.

Referenced by Dump(), GetChildren(), GetChildren(), ResolveContainedAddress(), Section(), Section(), and Slide().

◆ m_encrypted

bool lldb_private::Section::m_encrypted
protected

Definition at line 298 of file Section.h.

Referenced by IsEncrypted(), Section(), Section(), and SetIsEncrypted().

◆ m_executable

bool lldb_private::Section::m_executable
protected

Definition at line 302 of file Section.h.

Referenced by Dump(), GetPermissions(), Section(), Section(), and SetPermissions().

◆ m_fake

bool lldb_private::Section::m_fake
protected

Definition at line 293 of file Section.h.

Referenced by IsFake(), Section(), Section(), and SetIsFake().

◆ m_file_addr

lldb::addr_t lldb_private::Section::m_file_addr
protected

Definition at line 282 of file Section.h.

Referenced by GetFileAddress(), GetOffset(), Section(), Section(), SetFileAddress(), and Slide().

◆ m_file_offset

lldb::offset_t lldb_private::Section::m_file_offset
protected

Definition at line 287 of file Section.h.

Referenced by Dump(), GetFileOffset(), Section(), Section(), and SetFileOffset().

◆ m_file_size

lldb::offset_t lldb_private::Section::m_file_size
protected

Definition at line 288 of file Section.h.

Referenced by Dump(), GetFileSize(), Section(), Section(), and SetFileSize().

◆ m_log2align

uint32_t lldb_private::Section::m_log2align
protected

Definition at line 290 of file Section.h.

Referenced by GetLog2Align(), Section(), Section(), and SetLog2Align().

◆ m_name

ConstString lldb_private::Section::m_name
protected

Definition at line 281 of file Section.h.

Referenced by DumpName(), GetName(), Section(), and Section().

◆ m_obj_file

ObjectFile* lldb_private::Section::m_obj_file
protected

◆ m_parent_wp

lldb::SectionWP lldb_private::Section::m_parent_wp
protected

Definition at line 280 of file Section.h.

Referenced by GetParent(), Section(), and Section().

◆ m_readable

bool lldb_private::Section::m_readable
protected

Definition at line 300 of file Section.h.

Referenced by Dump(), GetPermissions(), Section(), Section(), and SetPermissions().

◆ m_relocated

bool lldb_private::Section::m_relocated
protected

Definition at line 303 of file Section.h.

Referenced by IsRelocated(), Section(), Section(), and SetIsRelocated().

◆ m_target_byte_size

uint32_t lldb_private::Section::m_target_byte_size
protected

Definition at line 304 of file Section.h.

Referenced by ContainsFileAddress(), GetTargetByteSize(), Section(), and Section().

◆ m_thread_specific

bool lldb_private::Section::m_thread_specific
protected

Definition at line 299 of file Section.h.

Referenced by IsThreadSpecific(), Section(), Section(), and SetIsThreadSpecific().

◆ m_type

lldb::SectionType lldb_private::Section::m_type
protected

Definition at line 279 of file Section.h.

Referenced by ContainsOnlyDebugInfo(), GetType(), GetTypeAsCString(), Section(), and Section().

◆ m_writable

bool lldb_private::Section::m_writable
protected

Definition at line 301 of file Section.h.

Referenced by Dump(), GetPermissions(), Section(), Section(), and SetPermissions().


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