Debian Codegraph @

third_party/rust/macho-unwind-info/src/error.rs

raw
1 /// The error type used in this crate.
2 #[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
3 pub enum Error {
4 /// The data slice was not big enough to read the struct, or we
5 /// were trying to follow an invalid offset to somewhere outside
6 /// of the data bounds.
7 #[error("Read error: {0}")]
8 ReadError(#[from] ReadError),
9
10 /// Each page has a first_address which is supposed to match the
11 /// start address of its first function entry. If the two addresses
12 /// don't match, then the lookup will fail for addresses which fall
13 /// in the gap between the page start address and the page's first
14 /// function's start address.
15 #[error("The page entry's first_address didn't match the address of its first function")]
16 InvalidPageEntryFirstAddress,
17
18 /// The page kind was set to an unrecognized value.
19 #[error("Invalid page kind")]
20 InvalidPageKind,
21
22 /// There is only supposed to be one sentinel page, at the very end
23 /// of the pages list - its first_address gives the end address of
24 /// the unwind info address range. If a sentinel page is encountered
25 /// somewhere else, this error is thrown.
26 #[error("Unexpected sentinel page")]
27 UnexpectedSentinelPage,
28 }
29
30 /// This error indicates that the data slice was not large enough to
31 /// read the respective item.
32 #[derive(thiserror::Error, Debug, Clone, Copy, PartialEq, Eq)]
33 pub enum ReadError {
34 #[error("Could not read CompactUnwindInfoHeader")]
35 Header,
36
37 #[error("Could not read global opcodes")]
38 GlobalOpcodes,
39
40 #[error("Could not read pages")]
41 Pages,
42
43 #[error("Could not read RegularPage")]
44 RegularPage,
45
46 #[error("Could not read RegularPage functions")]
47 RegularPageFunctions,
48
49 #[error("Could not read CompressedPage")]
50 CompressedPage,
51
52 #[error("Could not read CompressedPage functions")]
53 CompressedPageFunctions,
54
55 #[error("Could not read local opcodes")]
56 LocalOpcodes,
57
58 #[error("Could not read page kind")]
59 PageKind,
60 }