pub trait Writer {
type Endian: Endianity;
Show 25 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<()>;
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.
Associated Types
Required methods
Return the current section length.
This may be used as an offset for future write_at
calls.
Provided methods
Write an address.
If the writer supports relocations, then it must provide its own implementation of this method.
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.
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.
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.
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.
Write a reference to a symbol.
If the writer supports symbols, then it must provide its own implementation of this method.
Write a u8 at the given offset.
Write a u16 at the given offset.
Write a u32 at the given offset.
Write a u64 at the given offset.
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.
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.
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<()>
fn write_uleb128(&mut self, val: u64) -> Result<()>
Write an unsigned LEB128 encoded integer.
fn write_sleb128(&mut self, val: i64) -> Result<()>
fn write_sleb128(&mut self, val: i64) -> Result<()>
Read an unsigned LEB128 encoded integer.
fn write_initial_length(
&mut self,
format: Format
) -> Result<InitialLengthOffset>
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<()>
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.