diff --git a/humility-core/src/hubris.rs b/humility-core/src/hubris.rs index c78d73fc2..d2a4ce6c2 100644 --- a/humility-core/src/hubris.rs +++ b/humility-core/src/hubris.rs @@ -1452,7 +1452,12 @@ impl HubrisArchive { while let Some(attr) = attrs.next()? { match attr.name() { gimli::constants::DW_AT_name => { - name = dwarf_name(dwarf, attr.value()); + let value = attr.value(); + if let gimli::AttributeValue::String(s) = value { + name = s.to_string().ok(); + } else { + name = dwarf_name(dwarf, value); + } } gimli::constants::DW_AT_type => { @@ -1469,6 +1474,8 @@ impl HubrisArchive { } } + let name = name.or(Some("")); + if let (Some(name), Some(dgoff), Some(size)) = (name, dgoff, size) { self.enums.insert( goff, @@ -1682,7 +1689,12 @@ impl HubrisArchive { while let Some(attr) = attrs.next()? { match attr.name() { gimli::constants::DW_AT_name => { - name = dwarf_name(dwarf, attr.value()); + let value = attr.value(); + if let gimli::AttributeValue::String(s) = value { + name = s.to_string().ok(); + } else { + name = dwarf_name(dwarf, value); + } } gimli::constants::DW_AT_data_member_location => { @@ -1699,6 +1711,8 @@ impl HubrisArchive { } } + name = name.or(Some("")); + if let Some(pstruct) = self.structs.get_mut(&parent) { if let (Some(n), Some(offs), Some(g)) = (name, offset, goff) { pstruct.members.push(HubrisStructMember { @@ -5664,6 +5678,11 @@ fn dwarf_name<'a>( let ddstring = str::from_utf8(dstring.slice()).ok()?; Some(ddstring) } + gimli::AttributeValue::DebugStrRefSup(strref) => { + let dstring = dwarf.debug_str.get_str(strref).ok()?; + let ddstring = str::from_utf8(dstring.slice()).ok()?; + Some(ddstring) + } _ => None, } }