From a35d0001124ff68bcec058ad20baf34229c852fd Mon Sep 17 00:00:00 2001 From: TrinityDevelopers Date: Tue, 21 Jun 2022 15:39:50 -0500 Subject: [PATCH 1/2] Implement AliasType --- src/tpi/data.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/tpi/data.rs b/src/tpi/data.rs index ed7d987..c6d32ec 100644 --- a/src/tpi/data.rs +++ b/src/tpi/data.rs @@ -33,6 +33,7 @@ pub enum TypeData<'t> { Enumerate(EnumerateType<'t>), Array(ArrayType), Union(UnionType<'t>), + Alias(AliasType<'t>), Bitfield(BitfieldType), FieldList(FieldList<'t>), ArgumentList(ArgumentList), @@ -336,6 +337,12 @@ pub(crate) fn parse_type_data<'t>(buf: &mut ParseBuffer<'t>) -> Result Ok(TypeData::Alias(AliasType { + underlying_type: buf.parse()?, + name: parse_string(leaf, &mut buf)?, + })), + // https://github.com/Microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/include/cvinfo.h#L2164-L2170 LF_BITFIELD => Ok(TypeData::Bitfield(BitfieldType { underlying_type: buf.parse()?, @@ -1023,6 +1030,13 @@ pub struct UnionType<'t> { pub unique_name: Option>, } +/// The information parsed from a type record with kind `LF_ALIAS` or `LF_ALIAS_ST`. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct AliasType<'t> { + pub underlying_type: TypeIndex, + pub name: RawString<'t>, +} + /// The information parsed from a type record with kind `LF_BITFIELD`. #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct BitfieldType { From a331c23c1e195ba87740a825a122b40b1866abce Mon Sep 17 00:00:00 2001 From: TrinityDevelopers Date: Thu, 23 Jun 2022 09:25:03 -0500 Subject: [PATCH 2/2] Add Alias to TypeData::name + fix typo --- src/tpi/data.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tpi/data.rs b/src/tpi/data.rs index c6d32ec..f4e92ab 100644 --- a/src/tpi/data.rs +++ b/src/tpi/data.rs @@ -51,7 +51,8 @@ impl<'t> TypeData<'t> { | Self::Nested(NestedType { ref name, .. }) | Self::Enumeration(EnumerationType { ref name, .. }) | Self::Enumerate(EnumerateType { ref name, .. }) - | Self::Union(UnionType { ref name, .. }) => name, + | Self::Union(UnionType { ref name, .. }) + | Self::Alias(AliasType { ref name, .. }) => name, _ => return None, }; @@ -340,7 +341,7 @@ pub(crate) fn parse_type_data<'t>(buf: &mut ParseBuffer<'t>) -> Result Ok(TypeData::Alias(AliasType { underlying_type: buf.parse()?, - name: parse_string(leaf, &mut buf)?, + name: parse_string(leaf, buf)?, })), // https://github.com/Microsoft/microsoft-pdb/blob/082c5290e5aff028ae84e43affa8be717aa7af73/include/cvinfo.h#L2164-L2170