From 7849cda3f9be3ba7da2abb0e7f4d9f201b43fa50 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Wed, 23 Aug 2023 10:12:14 -0400 Subject: DWARF Import : Introduce fastpath for compilation unit handling --- rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs') diff --git a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs index 7872d8e2..d4a2794d 100644 --- a/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs +++ b/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::helpers::{get_uid, resolve_specification}; +use crate::helpers::{get_uid, resolve_specification, DieReference}; use binaryninja::{ binaryview::{BinaryView, BinaryViewBase}, @@ -214,9 +214,19 @@ impl DebugInfoBuilder { unit: &Unit, entry: &DebuggingInformationEntry, ) -> Option { - let (entry_unit, entry_offset) = resolve_specification(dwarf, unit, entry); - let entry = entry_unit.entry(entry_offset).unwrap(); - self.names.get(&get_uid(&entry_unit, &entry)).cloned() + match resolve_specification(dwarf, unit, entry) { + DieReference::Offset(entry_offset) => self + .names + .get(&get_uid(unit, &unit.entry(entry_offset).unwrap())) + .cloned(), + DieReference::UnitAndOffset((entry_unit, entry_offset)) => self + .names + .get(&get_uid( + &entry_unit, + &entry_unit.entry(entry_offset).unwrap(), + )) + .cloned(), + } } fn commit_types(&self, debug_info: &mut DebugInfo) { -- cgit v1.3.1