summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-06-17 15:41:56 -0400
committerJosh Ferrell <josh@vector35.com>2024-06-17 15:48:06 -0400
commit7fe90070052c19d174585e7152ba66f3057328e7 (patch)
tree33c4e3131742efb297f8018041776dac9a804130
parenta29b3227ded18cf7f8e0e31968d410eeb99dd8e3 (diff)
Load all types from DWARF even if they are unused
-rw-r--r--rust/examples/dwarf/dwarf_import/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/lib.rs b/rust/examples/dwarf/dwarf_import/src/lib.rs
index 62b8c18a..1b6420a2 100644
--- a/rust/examples/dwarf/dwarf_import/src/lib.rs
+++ b/rust/examples/dwarf/dwarf_import/src/lib.rs
@@ -227,11 +227,19 @@ fn parse_unit<R: Reader<Offset = usize>>(
constants::DW_TAG_subprogram => {
let fn_idx = parse_function_entry(unit, entry, debug_info_builder_context, debug_info_builder);
functions_by_depth.push((fn_idx, current_depth));
- }
+ },
constants::DW_TAG_variable => {
let current_fn_idx = functions_by_depth.last().and_then(|x| x.0);
parse_variable(unit, entry, debug_info_builder_context, debug_info_builder, current_fn_idx)
- }
+ },
+ constants::DW_TAG_class_type |
+ constants::DW_TAG_enumeration_type |
+ constants::DW_TAG_structure_type |
+ constants::DW_TAG_union_type |
+ constants::DW_TAG_typedef => {
+ // Ensure types are loaded even if they're unused
+ types::get_type(unit, entry, debug_info_builder_context, debug_info_builder);
+ },
_ => (),
}
}