pub(crate) trait ReaderAddress: Sized {
// Required methods
fn add_sized(self, length: u64, size: u8) -> Result<Self>;
fn wrapping_add_sized(self, length: u64, size: u8) -> Self;
fn zeros() -> Self;
fn ones_sized(size: u8) -> Self;
// Provided method
fn min_tombstone(size: u8) -> Self { ... }
}
Expand description
A trait for addresses within a DWARF section.
Currently this is a simple extension trait for u64
, but it may be expanded
in the future to support user-defined address types.
Required Methods§
Sourcefn add_sized(self, length: u64, size: u8) -> Result<Self>
fn add_sized(self, length: u64, size: u8) -> Result<Self>
Add a length to an address of the given size.
Returns an error for overflow.
Sourcefn wrapping_add_sized(self, length: u64, size: u8) -> Self
fn wrapping_add_sized(self, length: u64, size: u8) -> Self
Add a length to an address of the given size.
Wraps the result to the size of the address to allow for the possibility that the length is a negative value.
Sourcefn ones_sized(size: u8) -> Self
fn ones_sized(size: u8) -> Self
The all-ones value of an address of the given size.
Provided Methods§
Sourcefn min_tombstone(size: u8) -> Self
fn min_tombstone(size: u8) -> Self
Return the minimum value for a tombstone address.
A variety of values may be used as tombstones in DWARF data. DWARF 6 specifies a tombstone value of -1, and this is compatible with most sections in earlier DWARF versions. However, for .debug_loc and .debug_ranges in DWARF 4 and earlier, the tombstone value is -2, because -1 already has a special meaning. -2 has also been seen in .debug_line, possibly from a proprietary fork of lld.
So this function returns -2 (cast to an unsigned value), and callers can consider addresses greater than or equal to this value to be tombstones.
Prior to the use of -1 or -2 for tombstones, it was common to use 0 or 1. Additionally, gold may leave the relocation addend in place. These values are not handled by this function, so callers will need to handle them separately if they want to.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.