MCPcopy Create free account
hub / github.com/esphome/esp-stacktrace-decoder / load_file_section

Function load_file_section

src/lib.rs:11–25  ·  view source on GitHub ↗
(
    id: gimli::SectionId,
    file: &object::File<'input>,
    endian: Endian,
    arena_data: &'arena Arena<Cow<'input, [u8]>>,
)

Source from the content-addressed store, hash-verified

9use js_sys::Array;
10
11fn load_file_section<'input, 'arena, Endian: gimli::Endianity>(
12 id: gimli::SectionId,
13 file: &object::File<'input>,
14 endian: Endian,
15 arena_data: &'arena Arena<Cow<'input, [u8]>>,
16) -> Result<gimli::EndianSlice<'arena, Endian>, object::Error> {
17 let name = id.name();
18 match file.section_by_name(name) {
19 Some(section) => match section.uncompressed_data()? {
20 Cow::Borrowed(b) => Ok(gimli::EndianSlice::new(b, endian)),
21 Cow::Owned(b) => Ok(gimli::EndianSlice::new(arena_data.alloc(b.into()), endian)),
22 },
23 None => Ok(gimli::EndianSlice::new(&[][..], endian)),
24 }
25}
26
27#[cfg(not(target_family = "wasm"))]
28pub struct DecodedAddress {

Callers 1

decodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected