LLDB  mainline
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ObjectContainerUniversalMachO Class Reference

#include <ObjectContainerUniversalMachO.h>

Inheritance diagram for ObjectContainerUniversalMachO:
Inheritance graph
[legend]
Collaboration diagram for ObjectContainerUniversalMachO:
Collaboration graph
[legend]

Public Member Functions

 ObjectContainerUniversalMachO (const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
 
 ~ObjectContainerUniversalMachO () override
 
bool ParseHeader () override
 Attempts to parse the object header. More...
 
void Dump (lldb_private::Stream *s) const override
 Dump a description of this object to a Stream. More...
 
size_t GetNumArchitectures () const override
 Get the number of architectures in this object file. More...
 
bool GetArchitectureAtIndex (uint32_t cpu_idx, lldb_private::ArchSpec &arch) const override
 Gets the architecture given an index. More...
 
lldb::ObjectFileSP GetObjectFile (const lldb_private::FileSpec *file) override
 Selects an architecture in an object file. More...
 
lldb_private::ConstString GetPluginName () override
 
uint32_t GetPluginVersion () override
 
- Public Member Functions inherited from lldb_private::ObjectContainer
 ObjectContainer (const lldb::ModuleSP &module_sp, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset)
 Construct with a parent module, offset, and header data. More...
 
 ~ObjectContainer () override=default
 Destructor. More...
 
virtual lldb::addr_t GetOffset () const
 Returns the offset into a file at which this object resides. More...
 
virtual lldb::addr_t GetByteSize () const
 
virtual size_t GetNumObjects () const
 Get the number of objects within this object file (archives). More...
 
virtual bool ObjectAtIndexIsContainer (uint32_t object_idx)
 
virtual ObjectFileGetObjectFileAtIndex (uint32_t object_idx)
 
virtual ObjectContainerGetObjectContainerAtIndex (uint32_t object_idx)
 
virtual const char * GetObjectNameAtIndex (uint32_t object_idx) const
 
- Public Member Functions inherited from lldb_private::PluginInterface
virtual ~PluginInterface ()
 
- Public Member Functions inherited from lldb_private::ModuleChild
 ModuleChild (const lldb::ModuleSP &module_sp)
 Construct with owning module. More...
 
 ModuleChild (const ModuleChild &rhs)
 Copy constructor. More...
 
 ~ModuleChild ()
 Destructor. More...
 
const ModuleChildoperator= (const ModuleChild &rhs)
 Assignment operator. More...
 
lldb::ModuleSP GetModule () const
 Get const accessor for the module pointer. More...
 
void SetModule (const lldb::ModuleSP &module_sp)
 Set accessor for the module pointer. More...
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static lldb_private::ConstString GetPluginNameStatic ()
 
static const char * GetPluginDescriptionStatic ()
 
static lldb_private::ObjectContainerCreateInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
 
static size_t GetModuleSpecifications (const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, lldb_private::ModuleSpecList &specs)
 
static bool MagicBytesMatch (const lldb_private::DataExtractor &data)
 

Static Protected Member Functions

static bool ParseHeader (lldb_private::DataExtractor &data, llvm::MachO::fat_header &header, std::vector< llvm::MachO::fat_arch > &fat_archs)
 

Protected Attributes

llvm::MachO::fat_header m_header
 
std::vector< llvm::MachO::fat_arch > m_fat_archs
 
- Protected Attributes inherited from lldb_private::ObjectContainer
FileSpec m_file
 The file that represents this container objects (which can be different from the module's file). More...
 
lldb::addr_t m_offset
 The offset in bytes into the file, or the address in memory. More...
 
lldb::addr_t m_length
 The size in bytes if known (can be zero). More...
 
DataExtractor m_data
 The data for this object file so things can be parsed lazily. More...
 
- Protected Attributes inherited from lldb_private::ModuleChild
lldb::ModuleWP m_module_wp
 The Module that owns the object that inherits from this class. More...
 

Detailed Description

Definition at line 16 of file ObjectContainerUniversalMachO.h.

Constructor & Destructor Documentation

◆ ObjectContainerUniversalMachO()

ObjectContainerUniversalMachO::ObjectContainerUniversalMachO ( const lldb::ModuleSP &  module_sp,
lldb::DataBufferSP &  data_sp,
lldb::offset_t  data_offset,
const lldb_private::FileSpec file,
lldb::offset_t  offset,
lldb::offset_t  length 
)

Definition at line 69 of file ObjectContainerUniversalMachO.cpp.

References m_header.

◆ ~ObjectContainerUniversalMachO()

ObjectContainerUniversalMachO::~ObjectContainerUniversalMachO ( )
override

Definition at line 79 of file ObjectContainerUniversalMachO.cpp.

Member Function Documentation

◆ CreateInstance()

ObjectContainer * ObjectContainerUniversalMachO::CreateInstance ( const lldb::ModuleSP &  module_sp,
lldb::DataBufferSP &  data_sp,
lldb::offset_t  data_offset,
const lldb_private::FileSpec file,
lldb::offset_t  offset,
lldb::offset_t  length 
)
static

◆ Dump()

void ObjectContainerUniversalMachO::Dump ( lldb_private::Stream s) const
overridevirtual

Dump a description of this object to a Stream.

Dump a description of the current contents of this object to the supplied stream s. The dumping should include the section list if it has been parsed, and the symbol table if it has been parsed.

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

Implements lldb_private::ObjectContainer.

Definition at line 125 of file ObjectContainerUniversalMachO.cpp.

References lldb_private::Stream::EOL(), GetArchitectureAtIndex(), lldb_private::ArchSpec::GetArchitectureName(), GetNumArchitectures(), lldb_private::ObjectContainer::GetNumObjects(), lldb_private::ObjectContainer::GetObjectNameAtIndex(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), and lldb_private::Stream::Printf().

◆ GetArchitectureAtIndex()

bool ObjectContainerUniversalMachO::GetArchitectureAtIndex ( uint32_t  idx,
lldb_private::ArchSpec arch 
) const
overridevirtual

Gets the architecture given an index.

Copies the architecture specification for index idx.

Parameters
[in]idxThe architecture index to extract.
[out]archA architecture object that will be filled in if idx is a architecture valid index.
Returns
Returns true if idx is valid and arch has been filled in, false otherwise.
See also
ObjectContainer::GetNumArchitectures() const

Reimplemented from lldb_private::ObjectContainer.

Definition at line 152 of file ObjectContainerUniversalMachO.cpp.

References lldb_private::eArchTypeMachO, m_fat_archs, m_header, and lldb_private::ArchSpec::SetArchitecture().

Referenced by Dump(), and GetObjectFile().

◆ GetModuleSpecifications()

size_t ObjectContainerUniversalMachO::GetModuleSpecifications ( const lldb_private::FileSpec file,
lldb::DataBufferSP &  data_sp,
lldb::offset_t  data_offset,
lldb::offset_t  file_offset,
lldb::offset_t  length,
lldb_private::ModuleSpecList specs 
)
static

◆ GetNumArchitectures()

size_t ObjectContainerUniversalMachO::GetNumArchitectures ( ) const
overridevirtual

Get the number of architectures in this object file.

The default implementation returns 1 as for object files that contain a single architecture. ObjectContainer instances that contain more than one architecture should override this function and return an appropriate value.

Returns
The number of architectures contained in this object file.

Reimplemented from lldb_private::ObjectContainer.

Definition at line 148 of file ObjectContainerUniversalMachO.cpp.

References m_header.

Referenced by Dump().

◆ GetObjectFile()

ObjectFileSP ObjectContainerUniversalMachO::GetObjectFile ( const lldb_private::FileSpec file)
overridevirtual

Selects an architecture in an object file.

Object files that contain a single architecture should verify that the specified arch matches the architecture in in object file and return true or false accordingly.

Object files that contain more than one architecture should attempt to select that architecture, and if successful, clear out any previous state from any previously selected architecture and prepare to return information for the new architecture.

Returns
Returns a pointer to the object file of the requested arch and optional name. Returns nullptr of no such object file exists in the container.

Implements lldb_private::ObjectContainer.

Definition at line 163 of file ObjectContainerUniversalMachO.cpp.

References GetArchitectureAtIndex(), lldb_private::ModuleChild::GetModule(), lldb_private::ArchSpec::IsCompatibleMatch(), lldb_private::ArchSpec::IsExactMatch(), lldb_private::ArchSpec::IsValid(), LLDB_ARCH_DEFAULT, m_fat_archs, m_header, lldb_private::ObjectContainer::m_offset, and lldb_private::ArchSpec::SetTriple().

◆ GetPluginDescriptionStatic()

const char * ObjectContainerUniversalMachO::GetPluginDescriptionStatic ( )
static

Definition at line 38 of file ObjectContainerUniversalMachO.cpp.

◆ GetPluginName()

lldb_private::ConstString ObjectContainerUniversalMachO::GetPluginName ( )
overridevirtual

◆ GetPluginNameStatic()

lldb_private::ConstString ObjectContainerUniversalMachO::GetPluginNameStatic ( )
static

Definition at line 33 of file ObjectContainerUniversalMachO.cpp.

Referenced by GetPluginName().

◆ GetPluginVersion()

uint32_t ObjectContainerUniversalMachO::GetPluginVersion ( )
overridevirtual

Implements lldb_private::PluginInterface.

Definition at line 210 of file ObjectContainerUniversalMachO.cpp.

◆ Initialize()

void ObjectContainerUniversalMachO::Initialize ( )
static

◆ MagicBytesMatch()

bool ObjectContainerUniversalMachO::MagicBytesMatch ( const lldb_private::DataExtractor data)
static

◆ ParseHeader() [1/2]

bool ObjectContainerUniversalMachO::ParseHeader ( )
overridevirtual

Attempts to parse the object header.

This function is used as a test to see if a given plug-in instance can parse the header data already contained in ObjectContainer::m_data. If an object file parser does not recognize that magic bytes in a header, false should be returned and the next plug-in can attempt to parse an object file.

Returns
Returns true if the header was parsed successfully, false otherwise.

Implements lldb_private::ObjectContainer.

Definition at line 81 of file ObjectContainerUniversalMachO.cpp.

References lldb_private::DataExtractor::Clear(), lldb_private::ObjectContainer::m_data, m_fat_archs, and m_header.

Referenced by GetModuleSpecifications().

◆ ParseHeader() [2/2]

bool ObjectContainerUniversalMachO::ParseHeader ( lldb_private::DataExtractor data,
llvm::MachO::fat_header &  header,
std::vector< llvm::MachO::fat_arch > &  fat_archs 
)
staticprotected

◆ Terminate()

void ObjectContainerUniversalMachO::Terminate ( )
static

Member Data Documentation

◆ m_fat_archs

std::vector<llvm::MachO::fat_arch> ObjectContainerUniversalMachO::m_fat_archs
protected

◆ m_header

llvm::MachO::fat_header ObjectContainerUniversalMachO::m_header
protected

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