Skip to content

Commit

Permalink
Merge pull request #521 from khuey/dwarf5-unit
Browse files Browse the repository at this point in the history
Support skeleton and split compilation units
  • Loading branch information
philipc authored Jul 6, 2020
2 parents 5b15684 + b316033 commit cb795d6
Show file tree
Hide file tree
Showing 5 changed files with 438 additions and 6 deletions.
24 changes: 24 additions & 0 deletions examples/dwarfdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,27 @@ where
header.offset().as_debug_info_offset().unwrap().0,
)?;

match header.type_() {
UnitType::Compilation | UnitType::Partial => (),
UnitType::Type {
type_signature,
type_offset,
}
| UnitType::SplitType {
type_signature,
type_offset,
} => {
write!(buf, " signature = ")?;
dump_type_signature(buf, type_signature)?;
writeln!(buf)?;
writeln!(buf, " typeoffset = 0x{:08x}", type_offset.0,)?;
}
UnitType::Skeleton(dwo_id) | UnitType::SplitCompilation(dwo_id) => {
write!(buf, " dwo_id = ")?;
writeln!(buf, "0x{:016x}", dwo_id.0)?;
}
}

let unit = match dwarf.unit(header) {
Ok(unit) => unit,
Err(err) => {
Expand Down Expand Up @@ -1293,6 +1314,9 @@ fn dump_attr_value<R: Reader, W: Write>(
dump_file_index(w, value, unit, dwarf)?;
writeln!(w)?;
}
gimli::AttributeValue::DwoId(value) => {
writeln!(w, "0x{:016x}", value.0)?;
}
}

Ok(())
Expand Down
5 changes: 5 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,8 @@ impl SectionId {
})
}
}

/// An optionally-provided implementation-defined compilation unit ID to enable
/// split DWARF and linking a split compilation unit back together.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DwoId(pub u64);
Loading

0 comments on commit cb795d6

Please sign in to comment.