#[non_exhaustive]pub enum Error {
Show 31 variants
UnexpectedEof {
offset: usize,
needed: usize,
remaining: usize,
},
Overflow(&'static str),
OutOfRange {
field: &'static str,
value: u64,
max: u64,
},
FunctionIndexOutOfBounds {
index: usize,
count: usize,
},
InvalidMagic(u32),
UnsupportedVersion(u16),
InvalidAddressOffsetSize {
version: u16,
size: u8,
},
UnsupportedStringTableEncoding(u8),
InvalidUuidSize(usize),
V1BuildIdTooLong {
size: usize,
},
MissingSection(u32),
DuplicateSection(u32),
ZeroSizedSection {
section_type: u32,
},
SectionOutOfBounds {
section_type: u32,
offset: u64,
size: u64,
input_len: usize,
},
InvalidOffset {
offset: u64,
input_len: usize,
},
InvalidAlignment(usize),
MalformedUleb {
offset: usize,
reason: &'static str,
},
MalformedSleb {
offset: usize,
reason: &'static str,
},
UnsupportedInfoType(u32),
ZeroNameOffset,
InvalidFormat(&'static str),
InvalidModel(&'static str),
Limit {
context: &'static str,
value: u64,
limit: u64,
},
Malformed {
context: &'static str,
detail: Box<str>,
},
ElfParse {
input: ElfInputKind,
source: ParserError,
},
Dwarf {
source: ParserError,
},
NotElf {
input: ElfInputKind,
},
CompanionMismatch {
input: ElfInputKind,
mismatch: CompanionMismatch,
},
IoAtPath {
operation: &'static str,
path: PathBuf,
source: Error,
},
V1LimitExceeded {
field: &'static str,
value: u64,
},
Io(Error),
}Expand description
Errors produced while parsing, building, or writing GSYM data.
Variants fall into a few groups. Format errors report malformed input
(InvalidMagic,
UnexpectedEof,
InvalidFormat and friends). Model errors report an
invalid value handed to the builder or writer
(InvalidModel,
V1LimitExceeded). The rest cover I/O and, with
the convert feature, ELF and DWARF diagnostics.
Matching on it needs a fallback arm.
use gsym::{Error, Gsym};
match Gsym::parse(&[0_u8; 48][..]) {
Ok(_) => unreachable!("not a GSYM file"),
// "Not GSYM at all" is often worth treating as a normal answer.
Err(Error::InvalidMagic(_)) => {}
Err(other) => return Err(other),
}Display renders the full context, so {error} is enough for a log line.
Wrapped causes are available through
std::error::Error::source.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEof
A read required bytes beyond the end of the input.
Fields
Overflow(&'static str)
Integer arithmetic overflowed while computing the named value.
OutOfRange
A numeric field exceeded its format-defined maximum.
Fields
FunctionIndexOutOfBounds
A requested address-table function index does not exist.
InvalidMagic(u32)
The input does not begin with the GSYM magic in either byte order.
UnsupportedVersion(u16)
The input uses a GSYM version this crate does not implement.
InvalidAddressOffsetSize
The address-offset width is illegal for the selected format version.
UnsupportedStringTableEncoding(u8)
GSYM v2 requested an unsupported string-table encoding.
InvalidUuidSize(usize)
A GSYM v1 build identifier exceeds its fixed 20-byte field.
V1BuildIdTooLong
A requested GSYM v1 build identifier exceeds its fixed 20-byte field.
MissingSection(u32)
A required GSYM v2 global-data section is absent.
DuplicateSection(u32)
A GSYM v2 global-data section type appears more than once.
ZeroSizedSection
A required GSYM v2 section has an empty byte range.
SectionOutOfBounds
A GSYM v2 section extends outside the input.
Fields
InvalidOffset
A referenced absolute file offset is outside the input.
InvalidAlignment(usize)
A requested binary alignment is zero or unsupported.
MalformedUleb
An unsigned LEB128 value is truncated, overlong, or too wide.
Fields
MalformedSleb
A signed LEB128 value is truncated, overlong, or too wide.
Fields
UnsupportedInfoType(u32)
Full decoding encountered a FunctionInfo record type it cannot preserve.
ZeroNameOffset
A function or inline record references string-table offset zero as its name.
InvalidFormat(&'static str)
The input violates a GSYM format rule.
InvalidModel(&'static str)
A value handed to the builder or writer is not valid.
Limit
A count, size, or nesting depth exceeds an implementation or wire limit.
Fields
Malformed
Contextual malformed-data diagnostic requiring a dynamic explanation.
Fields
ElfParse
convert only.An ELF input could not be parsed.
Fields
input: ElfInputKindRole of the rejected ELF input.
source: ParserErrorUnderlying parser error.
Dwarf
convert only.Gimli rejected malformed DWARF data.
Fields
source: ParserErrorUnderlying DWARF parser error.
NotElf
convert only.A conversion input is a supported object format other than ELF.
Fields
input: ElfInputKindRole of the non-ELF input.
CompanionMismatch
convert only.A separate debug, symbol, or package file does not match the image.
Fields
input: ElfInputKindRole of the mismatching companion.
mismatch: CompanionMismatchIdentity property that differs.
IoAtPath
A filesystem operation failed at a known path.
Fields
V1LimitExceeded
A 64-bit semantic model cannot be narrowed into GSYM v1 fields.
Fields
Io(Error)
An unscoped I/O operation failed.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()