Trait gimli::write::Writer

source ·
pub trait Writer {
    type Endian: Endianity;

Show 25 methods // Required methods 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<()>; // Provided methods 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_reference(&mut self, _symbol: usize, _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<()> { ... }
}
Expand description

A trait for writing the data to a DWARF section.

All write operations append to the section unless otherwise specified.

Required Associated Types§

source

type Endian: Endianity

The endianity of bytes that are written.

Required Methods§

source

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

Return the endianity of bytes that are written.

source

fn len(&self) -> usize

Return the current section length.

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

source

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

Write a slice.

source

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.

Provided Methods§

source

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.

source

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.

source

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.

source

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.

source

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.

source

fn write_reference(&mut self, _symbol: usize, _size: u8) -> Result<()>

Write a reference to a symbol.

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

source

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

Write a u8.

source

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

Write a u16.

source

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

Write a u32.

source

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

Write a u64.

source

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

Write a u8 at the given offset.

source

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

Write a u16 at the given offset.

source

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

Write a u32 at the given offset.

source

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

Write a u64 at the given offset.

source

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.

source

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.

source

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.

source

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

Write an unsigned LEB128 encoded integer.

source

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

Read an unsigned LEB128 encoded integer.

source

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.

source

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.

Implementors§

source§

impl<Endian> Writer for EndianVec<Endian>
where Endian: Endianity,

§

type Endian = Endian

source§

impl<T: RelocateWriter> Writer for T