summaryrefslogtreecommitdiff
path: root/rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs')
-rw-r--r--rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs18
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) {