Example #1
0
        private DIDerivedType CreateMemberType(BitcodeModule module, DebugMemberInfo memberInfo)
        {
            ulong bitSize;

            if (!(memberInfo.ExplicitLayout is null))
            {
                bitSize = memberInfo.ExplicitLayout.BitSize;
            }
Example #2
0
        private DIDerivedType CreateMemberType(BitcodeModule module, DebugMemberInfo memberInfo)
        {
            if (DIType == null)
            {
                throw new InvalidOperationException(Resources.Type_does_not_have_associated_Debug_type_from_which_to_construct_a_Member);
            }

            UInt64 bitSize;
            UInt32 bitAlign;
            UInt64 bitOffset;

            // if explicit layout info provided, use it;
            // otherwise use module.Layout as the default
            if (memberInfo.ExplicitLayout != null)
            {
                bitSize   = memberInfo.ExplicitLayout.BitSize;
                bitAlign  = memberInfo.ExplicitLayout.BitAlignment;
                bitOffset = memberInfo.ExplicitLayout.BitOffset;
            }
            else
            {
                bitSize   = module.Layout.BitSizeOf(memberInfo.DebugType.NativeType);
                bitAlign  = 0;
                bitOffset = module.Layout.BitOffsetOfElement(NativeType, memberInfo.Index);
            }

            return(module.DIBuilder.CreateMemberType(scope: DIType
                                                     , name: memberInfo.Name
                                                     , file: memberInfo.File
                                                     , line: memberInfo.Line
                                                     , bitSize: bitSize
                                                     , bitAlign: bitAlign
                                                     , bitOffset: bitOffset
                                                     , debugFlags: memberInfo.DebugInfoFlags
                                                     , type: memberInfo.DebugType.DIType
                                                     ));
        }