Struct gimli::read::RelocateReader

source ·
pub struct RelocateReader<R: Reader<Offset = usize>, T: Relocate<R::Offset>> {
    section: R,
    reader: R,
    relocate: T,
}
Expand description

A Reader which applies relocations to addresses and offsets.

This is useful for reading sections which contain relocations, such as those in a relocatable object file. It is generally not used for reading sections in an executable file.

Fields§

§section: R§reader: R§relocate: T

Implementations§

source§

impl<R, T> RelocateReader<R, T>
where R: Reader<Offset = usize>, T: Relocate<R::Offset>,

source

pub fn new(section: R, relocate: T) -> Self

Create a new RelocateReader which applies relocations to the given section reader.

Trait Implementations§

source§

impl<R: Clone + Reader<Offset = usize>, T: Clone + Relocate<R::Offset>> Clone for RelocateReader<R, T>

source§

fn clone(&self) -> RelocateReader<R, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<R: Debug + Reader<Offset = usize>, T: Debug + Relocate<R::Offset>> Debug for RelocateReader<R, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<R, T> Reader for RelocateReader<R, T>
where R: Reader<Offset = usize>, T: Relocate<R::Offset> + Debug + Clone,

§

type Endian = <R as Reader>::Endian

The endianity of bytes that are read.
§

type Offset = <R as Reader>::Offset

The type used for offsets and lengths.
source§

fn read_address(&mut self, address_size: u8) -> Result<u64>

Read an address-sized integer, and return it as a u64.
source§

fn read_offset(&mut self, format: Format) -> Result<R::Offset>

Parse a word-sized section offset according to the DWARF format.
source§

fn read_sized_offset(&mut self, size: u8) -> Result<R::Offset>

Parse a section offset of the given size. Read more
source§

fn split(&mut self, len: Self::Offset) -> Result<Self>

Split a reader in two. Read more
source§

fn endian(&self) -> Self::Endian

Return the endianity of bytes that are read.
source§

fn len(&self) -> Self::Offset

Return the number of bytes remaining.
source§

fn empty(&mut self)

Set the number of bytes remaining to zero.
source§

fn truncate(&mut self, len: Self::Offset) -> Result<()>

Set the number of bytes remaining to the specified length.
source§

fn offset_from(&self, base: &Self) -> Self::Offset

Return the offset of this reader’s data relative to the start of the given base reader’s data. Read more
source§

fn offset_id(&self) -> ReaderOffsetId

Return an identifier for the current reader offset.
source§

fn lookup_offset_id(&self, id: ReaderOffsetId) -> Option<Self::Offset>

Return the offset corresponding to the given id if it is associated with this reader.
source§

fn find(&self, byte: u8) -> Result<Self::Offset>

Find the index of the first occurrence of the given byte. The offset of the reader is not changed.
source§

fn skip(&mut self, len: Self::Offset) -> Result<()>

Discard the specified number of bytes.
source§

fn to_slice(&self) -> Result<Cow<'_, [u8]>>

Return all remaining data as a clone-on-write slice. Read more
source§

fn to_string(&self) -> Result<Cow<'_, str>>

Convert all remaining data to a clone-on-write string. Read more
source§

fn to_string_lossy(&self) -> Result<Cow<'_, str>>

Convert all remaining data to a clone-on-write string, including invalid characters. Read more
source§

fn read_slice(&mut self, buf: &mut [u8]) -> Result<()>

Read exactly buf.len() bytes into buf.
source§

fn read_u8_array<A>(&mut self) -> Result<A>
where A: Sized + Default + AsMut<[u8]>,

Read a u8 array.
source§

fn is_empty(&self) -> bool

Return true if the number of bytes remaining is zero.
source§

fn read_u8(&mut self) -> Result<u8>

Read a u8.
source§

fn read_i8(&mut self) -> Result<i8>

Read an i8.
source§

fn read_u16(&mut self) -> Result<u16>

Read a u16.
source§

fn read_i16(&mut self) -> Result<i16>

Read an i16.
source§

fn read_u32(&mut self) -> Result<u32>

Read a u32.
source§

fn read_i32(&mut self) -> Result<i32>

Read an i32.
source§

fn read_u64(&mut self) -> Result<u64>

Read a u64.
source§

fn read_i64(&mut self) -> Result<i64>

Read an i64.
source§

fn read_f32(&mut self) -> Result<f32>

Read a f32.
source§

fn read_f64(&mut self) -> Result<f64>

Read a f64.
source§

fn read_uint(&mut self, n: usize) -> Result<u64>

Read an unsigned n-bytes integer u64. Read more
source§

fn read_null_terminated_slice(&mut self) -> Result<Self>

Read a null-terminated slice, and return it (excluding the null).
source§

fn skip_leb128(&mut self) -> Result<()>

Skip a LEB128 encoded integer.
source§

fn read_uleb128(&mut self) -> Result<u64>

Read an unsigned LEB128 encoded integer.
source§

fn read_uleb128_u32(&mut self) -> Result<u32>

Read an unsigned LEB128 encoded u32.
source§

fn read_uleb128_u16(&mut self) -> Result<u16>

Read an unsigned LEB128 encoded u16.
source§

fn read_sleb128(&mut self) -> Result<i64>

Read a signed LEB128 encoded integer.
source§

fn read_initial_length(&mut self) -> Result<(Self::Offset, Format)>

Read an initial length field. Read more
source§

fn read_address_size(&mut self) -> Result<u8>

Read a byte and validate it as an address size.
source§

fn read_word(&mut self, format: Format) -> Result<Self::Offset>

Parse a word-sized integer according to the DWARF format. Read more
source§

fn read_length(&mut self, format: Format) -> Result<Self::Offset>

Parse a word-sized section length according to the DWARF format.

Auto Trait Implementations§

§

impl<R, T> Freeze for RelocateReader<R, T>
where R: Freeze, T: Freeze,

§

impl<R, T> RefUnwindSafe for RelocateReader<R, T>

§

impl<R, T> Send for RelocateReader<R, T>
where R: Send, T: Send,

§

impl<R, T> Sync for RelocateReader<R, T>
where R: Sync, T: Sync,

§

impl<R, T> Unpin for RelocateReader<R, T>
where R: Unpin, T: Unpin,

§

impl<R, T> UnwindSafe for RelocateReader<R, T>
where R: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.