From 78bb1d393f9729e4c25c31ab84c4d796c9cd5f73 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Tue, 7 Jul 2020 11:23:36 -0700 Subject: [PATCH 1/2] Add debug_loc to dwo_names. --- src/common.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common.rs b/src/common.rs index baee92353..4bff76738 100644 --- a/src/common.rs +++ b/src/common.rs @@ -306,6 +306,9 @@ impl SectionId { SectionId::DebugAbbrev => ".debug_abbrev.dwo", SectionId::DebugInfo => ".debug_info.dwo", SectionId::DebugLine => ".debug_line.dwo", + // The debug_loc section can be present in the dwo when using the + // GNU split-dwarf extension to DWARF4. + SectionId::DebugLoc => ".debug_loc.dwo", SectionId::DebugLocLists => ".debug_loclists.dwo", SectionId::DebugMacro => ".debug_macro.dwo", SectionId::DebugStr => ".debug_str.dwo", From 7196e09478d9b3d103b83d7fe2b469da8f786a9c Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Mon, 6 Jul 2020 13:24:45 -0700 Subject: [PATCH 2/2] Add a function for copying attributes from a skeleton Unit to a split-compilation Unit. The attributes copied are all present on the skeleton unit and necessary for correctly parsing DIEs in the split-compilation unit. Other attributes that aren't necessary for parsing DIEs ((such as the line number program) are not copied, despite being present only on the skeleton unit. --- src/read/dwarf.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/read/dwarf.rs b/src/read/dwarf.rs index 34048a104..dfc3b56b9 100644 --- a/src/read/dwarf.rs +++ b/src/read/dwarf.rs @@ -639,6 +639,15 @@ impl Unit { pub fn entries_raw(&self, offset: Option>) -> Result> { self.header.entries_raw(&self.abbreviations, offset) } + + /// Copy attributes that are subject to relocation from another unit. This is intended + /// to be used to copy attributes from a skeleton compilation unit to the corresponding + /// split compilation unit. + pub fn copy_relocated_attributes(&mut self, other: &Unit) { + self.low_pc = other.low_pc; + self.addr_base = other.addr_base; + self.rnglists_base = other.rnglists_base; + } } impl UnitSectionOffset {