(
translation: ModuleTranslation<'data>,
buffer: &'data [u8],
)
| 41 | } |
| 42 | |
| 43 | fn load_dwp<'data>( |
| 44 | translation: ModuleTranslation<'data>, |
| 45 | buffer: &'data [u8], |
| 46 | ) -> Result<DwarfPackage<gimli::EndianSlice<'data, gimli::LittleEndian>>> { |
| 47 | let endian_slice = gimli::EndianSlice::new(buffer, LittleEndian); |
| 48 | |
| 49 | let dwarf_package = DwarfPackage::load( |
| 50 | |id| -> Result<_> { |
| 51 | let slice = match id { |
| 52 | gimli::SectionId::DebugAbbrev => { |
| 53 | translation.debuginfo.dwarf.debug_abbrev.reader().slice() |
| 54 | } |
| 55 | gimli::SectionId::DebugInfo => { |
| 56 | translation.debuginfo.dwarf.debug_info.reader().slice() |
| 57 | } |
| 58 | gimli::SectionId::DebugLine => { |
| 59 | translation.debuginfo.dwarf.debug_line.reader().slice() |
| 60 | } |
| 61 | gimli::SectionId::DebugStr => { |
| 62 | translation.debuginfo.dwarf.debug_str.reader().slice() |
| 63 | } |
| 64 | gimli::SectionId::DebugStrOffsets => translation |
| 65 | .debuginfo |
| 66 | .dwarf |
| 67 | .debug_str_offsets |
| 68 | .reader() |
| 69 | .slice(), |
| 70 | gimli::SectionId::DebugLoc => translation.debuginfo.debug_loc.reader().slice(), |
| 71 | gimli::SectionId::DebugLocLists => { |
| 72 | translation.debuginfo.debug_loclists.reader().slice() |
| 73 | } |
| 74 | gimli::SectionId::DebugRngLists => { |
| 75 | translation.debuginfo.debug_rnglists.reader().slice() |
| 76 | } |
| 77 | gimli::SectionId::DebugTypes => { |
| 78 | translation.debuginfo.dwarf.debug_types.reader().slice() |
| 79 | } |
| 80 | gimli::SectionId::DebugCuIndex => { |
| 81 | translation.debuginfo.debug_cu_index.reader().slice() |
| 82 | } |
| 83 | gimli::SectionId::DebugTuIndex => { |
| 84 | translation.debuginfo.debug_tu_index.reader().slice() |
| 85 | } |
| 86 | _ => &buffer, |
| 87 | }; |
| 88 | |
| 89 | Ok(gimli::EndianSlice::new(slice, gimli::LittleEndian)) |
| 90 | }, |
| 91 | endian_slice, |
| 92 | )?; |
| 93 | |
| 94 | Ok(dwarf_package) |
| 95 | } |
| 96 | |
| 97 | /// Attempts to load a DWARF package using the passed bytes. |
| 98 | fn read_dwarf_package_from_bytes<'data>( |
no test coverage detected