Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/util/dwarf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ pub struct StructureType {
pub byte_size: Option<u32>,
pub members: Vec<StructureMember>,
pub bases: Vec<StructureBase>,
pub inner_types: Vec<UserDefinedType>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down Expand Up @@ -1687,6 +1688,9 @@ pub fn struct_def_string(
if let Some(byte_size) = t.byte_size {
writeln!(out, " // total size: {byte_size:#X}")?;
}
for inner_type in &t.inner_types {
writeln!(out, "{};", &indent_all_by(4, &ud_type_def(info, typedefs, inner_type, false)?))?;
}
let mut vis = match t.kind {
StructureKind::Struct => Visibility::Public,
StructureKind::Class => Visibility::Private,
Expand Down Expand Up @@ -1999,6 +2003,7 @@ fn process_structure_tag(info: &DwarfInfo, tag: &Tag) -> Result<StructureType> {

let mut members = Vec::new();
let mut bases = Vec::new();
let mut inner_types = Vec::new();
for child in tag.children(&info.tags) {
match child.kind {
TagKind::Inheritance => bases.push(process_inheritance_tag(info, child)?),
Expand All @@ -2013,13 +2018,15 @@ fn process_structure_tag(info: &DwarfInfo, tag: &Tag) -> Result<StructureType> {
TagKind::GlobalVariable => {
// TODO
}
TagKind::StructureType
| TagKind::ArrayType
| TagKind::EnumerationType
| TagKind::UnionType
| TagKind::ClassType
| TagKind::SubroutineType
| TagKind::PtrToMemberType => {
TagKind::StructureType | TagKind::ClassType => {
inner_types.push(UserDefinedType::Structure(process_structure_tag(info, child)?))
}
TagKind::EnumerationType => inner_types
.push(UserDefinedType::Enumeration(process_enumeration_tag(info, child)?)),
TagKind::UnionType => {
inner_types.push(UserDefinedType::Union(process_union_tag(info, child)?))
}
TagKind::ArrayType | TagKind::SubroutineType | TagKind::PtrToMemberType => {
// Variable type, ignore
}
kind => bail!("Unhandled StructureType child {:?}", kind),
Expand All @@ -2036,6 +2043,7 @@ fn process_structure_tag(info: &DwarfInfo, tag: &Tag) -> Result<StructureType> {
byte_size,
members,
bases,
inner_types,
})
}

Expand Down
Loading