From 8206f95a6a59a21f156abb4e6ec8582797f8620b Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Wed, 26 Jul 2023 08:56:25 -0400 Subject: Allow for anonymous classes and fix mutability error with respect to #4512 --- rust/examples/dwarf/dwarf_import/src/lib.rs | 7 +++++-- rust/examples/dwarf/dwarf_import/src/types.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'rust/examples') diff --git a/rust/examples/dwarf/dwarf_import/src/lib.rs b/rust/examples/dwarf/dwarf_import/src/lib.rs index 60239cb7..e568753e 100644 --- a/rust/examples/dwarf/dwarf_import/src/lib.rs +++ b/rust/examples/dwarf/dwarf_import/src/lib.rs @@ -97,8 +97,11 @@ fn recover_names>( resolve_namespace_name(dwarf, &unit, entry, &mut namespace_qualifiers, depth); } constants::DW_TAG_class_type => { - let class_name = get_name(dwarf, &unit, entry).unwrap(); - namespace_qualifiers.push((depth, class_name)); + if let Some(name) = get_name(dwarf, &unit, entry) { + namespace_qualifiers.push((depth, name)) + } else { + namespace_qualifiers.push((depth, CString::new("anonymous_class").unwrap())) + } debug_info_builder.set_name( get_uid(&unit, entry), diff --git a/rust/examples/dwarf/dwarf_import/src/types.rs b/rust/examples/dwarf/dwarf_import/src/types.rs index 2d61d64e..61a856a8 100644 --- a/rust/examples/dwarf/dwarf_import/src/types.rs +++ b/rust/examples/dwarf/dwarf_import/src/types.rs @@ -99,7 +99,7 @@ fn do_structure_parse>( // Create structure with proper size let size = get_size_as_u64(entry).unwrap_or(0); - let mut structure_builder: StructureBuilder = StructureBuilder::new(); + let structure_builder: StructureBuilder = StructureBuilder::new(); structure_builder .set_packed(true) .set_width(size) -- cgit v1.3.1