7 #if !defined(_ELFSourceFile_h_) 8 #define _ELFSourceFile_h_ 10 #include "SourceFile.h" 11 #include "StELFFile.h" 12 #include "smart_ptr.h" 13 #include "DataSource.h" 14 #include "DataTarget.h" 62 static bool isELFFile(std::istream &stream);
75 virtual bool supportsNamedSections()
const {
return true; }
76 virtual bool supportsNamedSymbols()
const {
return true; }
105 virtual bool hasSymbol(
const std::string &name);
162 virtual unsigned getData(
unsigned offset,
unsigned maxBytes, uint8_t *buffer);
225 #endif // _ELFSourceFile_h_ smart_ptr< StELFFile > m_file
Parser for the ELF file.
Definition: apps/elftosb/common/ELFSourceFile.h:124
Represents one named #SHT_NOBITS section within the ELF file.
Definition: apps/elftosb/common/ELFSourceFile.h:179
unsigned m_sectionIndex
The index of the section this segment represents.
Definition: apps/elftosb/common/ELFSourceFile.h:170
StELFFile * getELFFile()
Returns the underlying StELFFile object.
Definition: apps/elftosb/common/ELFSourceFile.h:118
virtual unsigned getLength()
Gets the length of the segment's data.
Definition: apps/elftosb/common/ELFSourceFile.cpp:517
Abstract base class for data sources.
Definition: apps/elftosb/common/DataSource.h:33
elf_toolset_t readToolsetOption()
Parses the toolset option value.
Definition: apps/elftosb/common/ELFSourceFile.cpp:103
virtual DataSource * createDataSource()
Creates a data source from the entire file.
Definition: apps/elftosb/common/ELFSourceFile.cpp:202
virtual bool hasSymbol(const std::string &name)
Returns whether a symbol exists in the source file.
Definition: apps/elftosb/common/ELFSourceFile.cpp:335
virtual DataTarget * createDataTargetForSection(const std::string §ion)
Definition: apps/elftosb/common/ELFSourceFile.cpp:291
ELFSourceFile(const std::string &path)
Default constructor.
Definition: apps/elftosb/common/ELFSourceFile.cpp:34
segment_vector_t m_segments
The segments of this data source.
Definition: apps/elftosb/common/ELFSourceFile.h:219
std::vector< DataSource::Segment * > segment_vector_t
A list of segment instances.
Definition: apps/elftosb/common/ELFSourceFile.h:218
ELFDataSource(StELFFile *elf)
Default constructor.
Definition: apps/elftosb/common/ELFSourceFile.h:196
StELFFile * m_elf
The ELF file parser.
Definition: apps/elftosb/common/ELFSourceFile.h:215
virtual DataTarget * createDataTargetForSymbol(const std::string &symbol)
Definition: apps/elftosb/common/ELFSourceFile.cpp:309
secinfo_clear_t m_secinfoOption
How to deal with the .secinfo section. Ignored if the toolset is not GHS.
Definition: apps/elftosb/common/ELFSourceFile.h:126
virtual bool hasEntryPoint()
Returns true if an entry point was set in the file.
Definition: apps/elftosb/common/ELFSourceFile.cpp:251
virtual uint32_t getBaseAddress()
Returns the address associated with the segment.
Definition: apps/elftosb/common/ELFSourceFile.cpp:523
secinfo_clear_t readSecinfoClearOption()
Reads the secinfoClear option.
Definition: apps/elftosb/common/ELFSourceFile.cpp:151
virtual unsigned getSymbolSize(const std::string &name)
Returns the size of a symbol.
Definition: apps/elftosb/common/ELFSourceFile.cpp:370
ELF symbol table entry.
Definition: apps/elftosb/common/ELF.h:277
virtual uint32_t getEntryPointAddress()
Returns the entry point address.
Definition: apps/elftosb/common/ELFSourceFile.cpp:258
bool lookupSymbol(const std::string &name, Elf32_Sym &info)
Gets information about a symbol in the ELF file.
Definition: apps/elftosb/common/ELFSourceFile.cpp:386
Definition: BootImage.h:13
Abstract base class for a source file containing executable code.
Definition: apps/elftosb/common/SourceFile.h:33
Abstract base class for the target address or range of data.
Definition: apps/elftosb/common/DataTarget.h:34
This is a special type of segment containing a repeating pattern.
Definition: apps/elftosb/common/DataSource.h:87
Represents one named #SHT_PROGBITS section within the ELF file.
Definition: apps/elftosb/common/ELFSourceFile.h:157
virtual ~ELFDataSource()
Destructor.
Definition: apps/elftosb/common/ELFSourceFile.cpp:409
virtual unsigned getSegmentCount()
Returns the number of segments in the source.
Definition: apps/elftosb/common/ELFSourceFile.h:211
A data source with ELF file sections as the contents.
Definition: apps/elftosb/common/ELFSourceFile.h:151
void addSection(unsigned sectionIndex)
Adds the ELF section at position sectionIndex to the data source.
Definition: apps/elftosb/common/ELFSourceFile.cpp:428
static bool isELFFile(std::istream &stream)
Identifies whether the stream contains an ELF file.
Definition: apps/elftosb/common/ELFSourceFile.cpp:45
elf_toolset_t m_toolset
Toolset that produced the ELF file.
Definition: apps/elftosb/common/ELFSourceFile.h:125
Discrete, contiguous part of the source's data.
Definition: apps/elftosb/common/DataSource.h:42
unsigned m_sectionIndex
The index of the section this segment represents.
Definition: apps/elftosb/common/ELFSourceFile.h:191
virtual ~ELFSourceFile()
Destructor.
Definition: apps/elftosb/common/ELFSourceFile.cpp:41
StELFFile * m_elf
The format parser instance for this ELF file.
Definition: apps/elftosb/common/ELFSourceFile.h:190
virtual bool hasNaturalLocation()
Returns whether the segment has an associated address.
Definition: apps/elftosb/common/ELFSourceFile.h:165
Parser for Executable and Linking Format (ELF) files.
Definition: apps/elftosb/common/StELFFile.h:42
Executable and Loading Format (ELF) source file.
Definition: apps/elftosb/common/ELFSourceFile.h:52
virtual uint32_t getSymbolValue(const std::string &name)
Returns the value of a symbol.
Definition: apps/elftosb/common/ELFSourceFile.cpp:341
virtual unsigned getData(unsigned offset, unsigned maxBytes, uint8_t *buffer)
Gets all or a portion of the segment's data.
Definition: apps/elftosb/common/ELFSourceFile.cpp:501
StELFFile * m_elf
The format parser instance for this ELF file.
Definition: apps/elftosb/common/ELFSourceFile.h:169
Abstract interface class used to select strings by name.
Definition: apps/elftosb/common/StringMatcher.h:17
void setSecinfoOption(secinfo_clear_t option)
Set the option to control .secinfo usage.
Definition: apps/elftosb/common/ELFSourceFile.h:206
virtual DataSource::Segment * getSegmentAt(unsigned index)
Returns the segment at position index.
Definition: apps/elftosb/common/ELFSourceFile.h:213
secinfo_clear_t m_secinfoOption
How to deal with the .secinfo section. Ignored if the toolset is not GHS.
Definition: apps/elftosb/common/ELFSourceFile.h:216
virtual bool hasNaturalLocation()
Pattern segments have no natural address.
Definition: apps/elftosb/common/ELFSourceFile.h:186
virtual void close()
Closes the file.
Definition: apps/elftosb/common/ELFSourceFile.cpp:96
virtual void open()
Opens the file.
Definition: apps/elftosb/common/ELFSourceFile.cpp:58