wasmtime_environ

Function lookup_file_pos

source
pub fn lookup_file_pos(section: &[u8], offset: usize) -> Option<FilePos>
Expand description

Lookup an offset within an encoded address map section, returning the original FilePos that corresponds to the offset, if found.

This function takes a section as its first argument which must have been created with AddressMapSection above. This is intended to be the raw ELF_WASMTIME_ADDRMAP section from the compilation artifact.

The offset provided is a relative offset from the start of the text section of the pc that is being looked up. If offset is out of range or doesn’t correspond to anything in this file then None is returned.