Skip to content

Commit 1b6c502

Browse files
nagisaDavid Wood
authored andcommitted
Access section data if the section is of interest
Accessing here may mean decompression, which can have a non-trivial cost. We're only interested in very specific sections, no need to try accessing all of them.
1 parent b4dece0 commit 1b6c502

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

thorin/src/package.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ impl<'file> InProgressDwarfPackage<'file> {
579579
let mut seen_debug_types = false;
580580

581581
for section in input.sections() {
582-
let data = section.compressed_data()?.decompress()?;
582+
let data;
583583
let (is_debug_types, mut iter) = match section.name() {
584584
Ok(".debug_info.dwo" | ".zdebug_info.dwo")
585585
// Report an error if a input DWARF package has multiple `.debug_info`
@@ -589,6 +589,7 @@ impl<'file> InProgressDwarfPackage<'file> {
589589
return Err(Error::MultipleDebugInfoSection);
590590
}
591591
Ok(".debug_info.dwo" | ".zdebug_info.dwo") => {
592+
data = section.compressed_data()?.decompress()?;
592593
seen_debug_info = true;
593594
(
594595
false,
@@ -605,6 +606,7 @@ impl<'file> InProgressDwarfPackage<'file> {
605606
return Err(Error::MultipleDebugTypesSection);
606607
}
607608
Ok(".debug_types.dwo" | ".zdebug_types.dwo") => {
609+
data = section.compressed_data()?.decompress()?;
608610
seen_debug_types = true;
609611
(
610612
true,

0 commit comments

Comments
 (0)