diff options
| author | KyleMiles <krm504@nyu.edu> | 2023-08-23 10:12:14 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2023-08-25 11:18:35 -0400 |
| commit | 7849cda3f9be3ba7da2abb0e7f4d9f201b43fa50 (patch) | |
| tree | c302377da1bf86d4354a23ff9cdc0fcca5c9691c /rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs | |
| parent | a245156062be928592aafd5613f597dded3c69bd (diff) | |
DWARF Import : Introduce fastpath for compilation unit handling
Diffstat (limited to 'rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs')
| -rw-r--r-- | rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs | 18 |
1 files changed, 14 insertions, 4 deletions
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<R>, entry: &DebuggingInformationEntry<R>, ) -> Option<CString> { - 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) { |
