Pigweed
 
Loading...
Searching...
No Matches
pw::elf::ElfReader Class Reference

A basic reader for ELF files. More...

#include <reader.h>

Public Member Functions

stream::SeekableReaderstream () const
 Gets the associated stream.
 
StatusWithSize SeekToSection (std::string_view name)
 
Result< std::vector< std::byte > > ReadSection (std::string_view name)
 

Static Public Member Functions

static Result< ElfReaderFromStream (stream::SeekableReader &stream)
 

Detailed Description

A basic reader for ELF files.

Member Function Documentation

◆ FromStream()

static Result< ElfReader > pw::elf::ElfReader::FromStream ( stream::SeekableReader stream)
static

Creates an ElfReader from a stream.

Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: The reader was initialized successfully.
* 
*     DATA_LOSS: The input file was invalid.
* 
*     OUT_OF_RANGE: Input stream exhausted (EOF).
* 
*     UNIMPLEMENTED: Some aspect of the ELF file is not (yet) supported by
*     this class, e.g., non-native endianness, or 64-bit ELF on a 32-bit
*     host.
* 
*  May return other error codes from the underlying stream.
* 
*  

◆ ReadSection()

Result< std::vector< std::byte > > pw::elf::ElfReader::ReadSection ( std::string_view  name)

Reads a section with the given name.

Parameters
[in]nameThe name of the desired section.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Successfully read the desired section.
*     The result value is a vector of the section data.
* 
*     NOT_FOUND: No section was found with the desired name.
* 
*  May return other error codes from the underlying stream.
* 
*  

◆ SeekToSection()

StatusWithSize pw::elf::ElfReader::SeekToSection ( std::string_view  name)
inline

Seeks the associated stream to the beginning of the data of the section with the given name.

Parameters
[in]nameThe name of the desired section.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: Successfully found the desired section and seeked the stream to
*     it. The associated size is the size of the associated section.
* 
*     NOT_FOUND: No section was found with the desired name.
* 
*  May return other error codes from the underlying stream.
* 
*  

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