[][src]Trait gimli::write::Writer

pub trait Writer {
    type Endian: Endianity;
    fn endian(&self) -> Self::Endian;
fn len(&self) -> usize;
fn write(&mut self, bytes: &[u8]) -> Result<()>;
fn write_at(&mut self, offset: usize, bytes: &[u8]) -> Result<()>; fn write_address(&mut self, address: Address, size: u8) -> Result<()> { ... }
fn write_eh_pointer(
        &mut self,
        address: Address,
        eh_pe: DwEhPe,
        size: u8
    ) -> Result<()> { ... }
fn write_eh_pointer_data(
        &mut self,
        val: u64,
        format: DwEhPe,
        size: u8
    ) -> Result<()> { ... }
fn write_offset(
        &mut self,
        val: usize,
        _section: SectionId,
        size: u8
    ) -> Result<()> { ... }
fn write_offset_at(
        &mut self,
        offset: usize,
        val: usize,
        _section: SectionId,
        size: u8
    ) -> Result<()> { ... }
fn write_u8(&mut self, val: u8) -> Result<()> { ... }
fn write_u16(&mut self, val: u16) -> Result<()> { ... }
fn write_u32(&mut self, val: u32) -> Result<()> { ... }
fn write_u64(&mut self, val: u64) -> Result<()> { ... }
fn write_u8_at(&mut self, offset: usize, val: u8) -> Result<()> { ... }
fn write_u16_at(&mut self, offset: usize, val: u16) -> Result<()> { ... }
fn write_u32_at(&mut self, offset: usize, val: u32) -> Result<()> { ... }
fn write_u64_at(&mut self, offset: usize, val: u64) -> Result<()> { ... }
fn write_udata(&mut self, val: u64, size: u8) -> Result<()> { ... }
fn write_sdata(&mut self, val: i64, size: u8) -> Result<()> { ... }
fn write_udata_at(
        &mut self,
        offset: usize,
        val: u64,
        size: u8
    ) -> Result<()> { ... }
fn write_uleb128(&mut self, val: u64) -> Result<()> { ... }
fn write_sleb128(&mut self, val: i64) -> Result<()> { ... }
fn write_initial_length(
        &mut self,
        format: Format
    ) -> Result<InitialLengthOffset> { ... }
fn write_initial_length_at(
        &mut self,
        offset: InitialLengthOffset,
        length: u64,
        format: Format
    ) -> Result<()> { ... } }

A trait for writing the data to a DWARF section.

All write operations append to the section unless otherwise specified.

Associated Types

type Endian: Endianity

The endianity of bytes that are written.

Loading content...

Required methods

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

Return the endianity of bytes that are written.

fn len(&self) -> usize

Return the current section length.

This may be used as an offset for future write_at calls.

fn write(&mut self, bytes: &[u8]) -> Result<()>

Write a slice.

fn write_at(&mut self, offset: usize, bytes: &[u8]) -> Result<()>

Write a slice at a given offset.

The write must not extend past the current section length.

Loading content...

Provided methods

fn write_address(&mut self, address: Address, size: u8) -> Result<()>

Write an address.

If the writer supports relocations, then it must provide its own implementation of this method.

fn write_eh_pointer(
    &mut self,
    address: Address,
    eh_pe: DwEhPe,
    size: u8
) -> Result<()>

Write an address with a .eh_frame pointer encoding.

The given size is only used for DW_EH_PE_absptr formats.

If the writer supports relocations, then it must provide its own implementation of this method.

fn write_eh_pointer_data(
    &mut self,
    val: u64,
    format: DwEhPe,
    size: u8
) -> Result<()>

Write a value with a .eh_frame pointer format.

The given size is only used for DW_EH_PE_absptr formats.

This must not be used directly for values that may require relocation.

fn write_offset(
    &mut self,
    val: usize,
    _section: SectionId,
    size: u8
) -> Result<()>

Write an offset that is relative to the start of the given section.

If the writer supports relocations, then it must provide its own implementation of this method.

fn write_offset_at(
    &mut self,
    offset: usize,
    val: usize,
    _section: SectionId,
    size: u8
) -> Result<()>

Write an offset that is relative to the start of the given section.

If the writer supports relocations, then it must provide its own implementation of this method.

fn write_u8(&mut self, val: u8) -> Result<()>

Write a u8.

fn write_u16(&mut self, val: u16) -> Result<()>

Write a u16.

fn write_u32(&mut self, val: u32) -> Result<()>

Write a u32.

fn write_u64(&mut self, val: u64) -> Result<()>

Write a u64.

fn write_u8_at(&mut self, offset: usize, val: u8) -> Result<()>

Write a u8 at the given offset.

fn write_u16_at(&mut self, offset: usize, val: u16) -> Result<()>

Write a u16 at the given offset.

fn write_u32_at(&mut self, offset: usize, val: u32) -> Result<()>

Write a u32 at the given offset.

fn write_u64_at(&mut self, offset: usize, val: u64) -> Result<()>

Write a u64 at the given offset.

fn write_udata(&mut self, val: u64, size: u8) -> Result<()>

Write unsigned data of the given size.

Returns an error if the value is too large for the size. This must not be used directly for values that may require relocation.

fn write_sdata(&mut self, val: i64, size: u8) -> Result<()>

Write signed data of the given size.

Returns an error if the value is too large for the size. This must not be used directly for values that may require relocation.

fn write_udata_at(&mut self, offset: usize, val: u64, size: u8) -> Result<()>

Write a word of the given size at the given offset.

Returns an error if the value is too large for the size. This must not be used directly for values that may require relocation.

fn write_uleb128(&mut self, val: u64) -> Result<()>

Write an unsigned LEB128 encoded integer.

fn write_sleb128(&mut self, val: i64) -> Result<()>

Read an unsigned LEB128 encoded integer.

fn write_initial_length(
    &mut self,
    format: Format
) -> Result<InitialLengthOffset>

Write an initial length according to the given DWARF format.

This will only write a length of zero, since the length isn't known yet, and a subsequent call to write_initial_length_at will write the actual length.

fn write_initial_length_at(
    &mut self,
    offset: InitialLengthOffset,
    length: u64,
    format: Format
) -> Result<()>

Write an initial length at the given offset according to the given DWARF format.

write_initial_length must have previously returned the offset.

Loading content...

Implementors

impl<Endian> Writer for EndianVec<Endian> where
    Endian: Endianity
[src]

type Endian = Endian

Loading content...