Skip to content

Commit

Permalink
Merge pull request #468 from hanna-kruppe/read-zstd-dwarf
Browse files Browse the repository at this point in the history
Use object's support for zstd compressed DWARF
  • Loading branch information
mstange authored Jan 19, 2025
2 parents ec0a6a1 + 6838376 commit 03ed258
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions samply-symbols/src/dwarf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,11 @@ where
size: file_range.uncompressed_size,
_phantom: PhantomData,
}),
CompressionFormat::Zlib => {
let compressed_bytes = data
.read_bytes_at(file_range.offset, file_range.compressed_size)
.ok()?;

let mut decompressed = Vec::with_capacity(file_range.uncompressed_size as usize);
let mut decompress = flate2::Decompress::new(true);
decompress
.decompress_vec(
compressed_bytes,
&mut decompressed,
flate2::FlushDecompress::Finish,
)
.ok()?;

Some(SingleSectionData::Owned(decompressed))
_ => {
let compressed = file_range.data(data).ok()?;
let decompressed = compressed.decompress().ok()?;
Some(SingleSectionData::Owned(decompressed.into_owned()))
}
_ => None,
}
}

Expand Down

0 comments on commit 03ed258

Please sign in to comment.