Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
elftosb::ELFSourceFile Class Reference

Executable and Loading Format (ELF) source file. More...

#include <ELFSourceFile.h>

+ Inheritance diagram for elftosb::ELFSourceFile:
+ Collaboration diagram for elftosb::ELFSourceFile:

Classes

class  ELFDataSource
 A data source with ELF file sections as the contents. More...
 

Public Member Functions

 ELFSourceFile (const std::string &path)
 Default constructor.
 
virtual ~ELFSourceFile ()
 Destructor.
 
Opening and closing
virtual void open ()
 Opens the file.
 
virtual void close ()
 Closes the file.
 
Format capabilities
virtual bool supportsNamedSections () const
 
virtual bool supportsNamedSymbols () const
 
Data source
virtual DataSourcecreateDataSource ()
 Creates a data source from the entire file. More...
 
virtual DataSourcecreateDataSource (StringMatcher &matcher)
 Creates a data source from one or more sections of the file.
 
Entry point
virtual bool hasEntryPoint ()
 Returns true if an entry point was set in the file. More...
 
virtual uint32_t getEntryPointAddress ()
 Returns the entry point address. More...
 
Data target
virtual DataTargetcreateDataTargetForSection (const std::string &section)
 
virtual DataTargetcreateDataTargetForSymbol (const std::string &symbol)
 
Symbols
virtual bool hasSymbol (const std::string &name)
 Returns whether a symbol exists in the source file.
 
virtual uint32_t getSymbolValue (const std::string &name)
 Returns the value of a symbol.
 
virtual unsigned getSymbolSize (const std::string &name)
 Returns the size of a symbol.
 
Direct ELF format access
StELFFilegetELFFile ()
 Returns the underlying StELFFile object.
 
bool lookupSymbol (const std::string &name, Elf32_Sym &info)
 Gets information about a symbol in the ELF file. More...
 
- Public Member Functions inherited from elftosb::SourceFile
 SourceFile (const std::string &path)
 Default constructor.
 
virtual ~SourceFile ()
 Destructor. More...
 
void setOptions (OptionContext *context)
 Set the option context. More...
 
const OptionContextgetOptions () const
 Return the option context.
 
const std::string & getPath () const
 Returns the path to the file.
 
unsigned getSize ()
 Get the size in bytes of the file.
 
virtual bool isOpen () const
 Returns whether the file is already open.
 
virtual DataSourcecreateDataSource (const std::string &section)
 Creates a data source out of one section of the file. More...
 
virtual DataTargetcreateDataTargetForEntryPoint ()
 

Static Public Member Functions

static bool isELFFile (std::istream &stream)
 Identifies whether the stream contains an ELF file.
 
- Static Public Member Functions inherited from elftosb::SourceFile
static SourceFileopenFile (const std::string &path)
 

Protected Member Functions

elf_toolset_t readToolsetOption ()
 Parses the toolset option value.
 
secinfo_clear_t readSecinfoClearOption ()
 Reads the secinfoClear option. More...
 
- Protected Member Functions inherited from elftosb::SourceFile
std::ifstream * getStream ()
 Internal access to the input stream object.
 

Protected Attributes

smart_ptr< StELFFilem_file
 Parser for the ELF file.
 
elf_toolset_t m_toolset
 Toolset that produced the ELF file.
 
secinfo_clear_t m_secinfoOption
 How to deal with the .secinfo section. Ignored if the toolset is not GHS.
 
- Protected Attributes inherited from elftosb::SourceFile
std::string m_path
 Path to the file.
 
smart_ptr< std::ifstream > m_stream
 File stream, or NULL if file is closed.
 
smart_ptr< OptionContextm_options
 Table of option values.
 

Detailed Description

Executable and Loading Format (ELF) source file.

Member Function Documentation

DataSource * ELFSourceFile::createDataSource ( )
virtual

Creates a data source from the entire file.

To create a data source for all sections of the ELF file, a WildcardMatcher is instantiated and passed to createDataSource(StringMatcher&).

Implements elftosb::SourceFile.

DataTarget * ELFSourceFile::createDataTargetForSection ( const std::string &  section)
virtual
Returns
A DataTarget that describes the named section.
Return values
NULLThere was no section with the requested name.

Reimplemented from elftosb::SourceFile.

DataTarget * ELFSourceFile::createDataTargetForSymbol ( const std::string &  symbol)
virtual
Returns
A DataTarget instance pointing at the requested symbol.
Return values
NULLNo symbol matching the requested name was found.

Reimplemented from elftosb::SourceFile.

uint32_t ELFSourceFile::getEntryPointAddress ( )
virtual

Returns the entry point address.

The StELFFile::getTypeOfSymbolAtIndex() method uses different methods of determining ARM/Thumb mode depending on the toolset.

Reimplemented from elftosb::SourceFile.

bool ELFSourceFile::hasEntryPoint ( )
virtual

Returns true if an entry point was set in the file.

It is assumed that all ELF files have an entry point.

Implements elftosb::SourceFile.

bool ELFSourceFile::lookupSymbol ( const std::string &  name,
Elf32_Sym info 
)

Gets information about a symbol in the ELF file.

Parameters
nameThe name of the symbol on which info is wanted.
[out]infoUpon succssful return this is filled in with the symbol's information.
Return values
trueThe symbol was found and info is valid.
falseNo symbol with name was found in the file.
secinfo_clear_t ELFSourceFile::readSecinfoClearOption ( )
protected

Reads the secinfoClear option.

It is up to the caller to convert from kSecinfoDefault to the actual default value.


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