Skip to content

Commit 25efa5c

Browse files
authored
Don't hold a reference to the UnitHeader during DIE parsing (#839)
* Delete unit lifetime from `read::DebuggingInformationEntry` * Delete unit lifetime from `read::EntriesRaw` * Delete unit lifetime from `read::EntriesCursor` * Delete unit lifetime from `read::EntriesTree`
1 parent ed66fc8 commit 25efa5c

File tree

4 files changed

+237
-219
lines changed

4 files changed

+237
-219
lines changed

src/read/dwarf.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ impl<R: Reader> Dwarf<R> {
586586
pub fn die_ranges(
587587
&self,
588588
unit: &Unit<R>,
589-
entry: &DebuggingInformationEntry<'_, '_, R>,
589+
entry: &DebuggingInformationEntry<'_, R>,
590590
) -> Result<RangeIter<R>> {
591591
let mut low_pc = None;
592592
let mut high_pc = None;
@@ -1343,26 +1343,20 @@ impl<R: Reader> Unit<R> {
13431343
}
13441344

13451345
/// Read the `DebuggingInformationEntry` at the given offset.
1346-
pub fn entry(
1347-
&self,
1348-
offset: UnitOffset<R::Offset>,
1349-
) -> Result<DebuggingInformationEntry<'_, '_, R>> {
1346+
pub fn entry(&self, offset: UnitOffset<R::Offset>) -> Result<DebuggingInformationEntry<'_, R>> {
13501347
self.header.entry(&self.abbreviations, offset)
13511348
}
13521349

13531350
/// Navigate this unit's `DebuggingInformationEntry`s.
13541351
#[inline]
1355-
pub fn entries(&self) -> EntriesCursor<'_, '_, R> {
1352+
pub fn entries(&self) -> EntriesCursor<'_, R> {
13561353
self.header.entries(&self.abbreviations)
13571354
}
13581355

13591356
/// Navigate this unit's `DebuggingInformationEntry`s
13601357
/// starting at the given offset.
13611358
#[inline]
1362-
pub fn entries_at_offset(
1363-
&self,
1364-
offset: UnitOffset<R::Offset>,
1365-
) -> Result<EntriesCursor<'_, '_, R>> {
1359+
pub fn entries_at_offset(&self, offset: UnitOffset<R::Offset>) -> Result<EntriesCursor<'_, R>> {
13661360
self.header.entries_at_offset(&self.abbreviations, offset)
13671361
}
13681362

@@ -1372,16 +1366,13 @@ impl<R: Reader> Unit<R> {
13721366
pub fn entries_tree(
13731367
&self,
13741368
offset: Option<UnitOffset<R::Offset>>,
1375-
) -> Result<EntriesTree<'_, '_, R>> {
1369+
) -> Result<EntriesTree<'_, R>> {
13761370
self.header.entries_tree(&self.abbreviations, offset)
13771371
}
13781372

13791373
/// Read the raw data that defines the Debugging Information Entries.
13801374
#[inline]
1381-
pub fn entries_raw(
1382-
&self,
1383-
offset: Option<UnitOffset<R::Offset>>,
1384-
) -> Result<EntriesRaw<'_, '_, R>> {
1375+
pub fn entries_raw(&self, offset: Option<UnitOffset<R::Offset>>) -> Result<EntriesRaw<'_, R>> {
13851376
self.header.entries_raw(&self.abbreviations, offset)
13861377
}
13871378

@@ -1545,7 +1536,7 @@ impl<'a, R: Reader> UnitRef<'a, R> {
15451536
/// Return an iterator for the address ranges of a `DebuggingInformationEntry`.
15461537
///
15471538
/// This uses `DW_AT_low_pc`, `DW_AT_high_pc` and `DW_AT_ranges`.
1548-
pub fn die_ranges(&self, entry: &DebuggingInformationEntry<'_, '_, R>) -> Result<RangeIter<R>> {
1539+
pub fn die_ranges(&self, entry: &DebuggingInformationEntry<'_, R>) -> Result<RangeIter<R>> {
15491540
self.dwarf.die_ranges(self.unit, entry)
15501541
}
15511542

0 commit comments

Comments
 (0)