summaryrefslogtreecommitdiff
path: root/rust/examples
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2023-07-26 08:56:25 -0400
committerKyleMiles <krm504@nyu.edu>2023-07-26 08:56:25 -0400
commit8206f95a6a59a21f156abb4e6ec8582797f8620b (patch)
treecc704d51ea3767b8c53c27562352c43343262604 /rust/examples
parentc70927347082ab5e8d1fb958d274c42be9ea3f7b (diff)
Allow for anonymous classes and fix mutability error with respect to #4512
Diffstat (limited to 'rust/examples')
-rw-r--r--rust/examples/dwarf/dwarf_import/src/lib.rs7
-rw-r--r--rust/examples/dwarf/dwarf_import/src/types.rs2
2 files changed, 6 insertions, 3 deletions
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<R: Reader<Offset = usize>>(
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<R: Reader<Offset = usize>>(
// 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)