Пример #1
0
 public DebugFunctionType CreateFunctionType(DebugInfoBuilder diBuilder
                                             , IDebugType <ITypeRef, DIType> retType
                                             , params IDebugType <ITypeRef, DIType>[] argTypes
                                             )
 {
     return(CreateFunctionType(diBuilder, false, retType, argTypes));
 }
Пример #2
0
 public DebugFunctionType CreateFunctionType(DebugInfoBuilder diBuilder
                                             , IDebugType <ITypeRef, DIType> retType
                                             , IEnumerable <IDebugType <ITypeRef, DIType> > argTypes
                                             )
 {
     return(CreateFunctionType(diBuilder, false, retType, argTypes));
 }
Пример #3
0
        private static DICompositeType BuildDebugType([ValidatedNotNull] IArrayType llvmType
                                                      , [ValidatedNotNull] IDebugType <ITypeRef, DIType> elementType
                                                      , [ValidatedNotNull] BitcodeModule module
                                                      , uint count
                                                      , uint lowerBound
                                                      , uint alignment
                                                      )
        {
            llvmType.ValidateNotNull(nameof(llvmType));
            elementType.ValidateNotNull(nameof(elementType));
            module.ValidateNotNull(nameof(module));

            if (llvmType.ElementType.GetTypeRef( ) != elementType.GetTypeRef( ))
            {
                throw new ArgumentException(Resources.ElementType_doesn_t_match_array_element_type);
            }

            if (llvmType.IsSized)
            {
                return(module.DIBuilder.CreateArrayType(module.Layout.BitSizeOf(llvmType)
                                                        , alignment
                                                        , elementType.DIType ! // validated not null in constructor
                                                        , module.DIBuilder.CreateSubRange(lowerBound, count)
                                                        ));
            }

            return(module.DIBuilder.CreateReplaceableCompositeType(Tag.ArrayType
                                                                   , string.Empty
                                                                   , module.DICompileUnit ?? default
                                                                   , default
Пример #4
0
        /// <summary>Creates a new <see cref="DebugArrayType"/></summary>
        /// <param name="llvmType">Underlying LLVM array type to bind debug info to</param>
        /// <param name="elementType">Array element type with debug information</param>
        /// <param name="module">module to use for creating debug information</param>
        /// <param name="count">Number of elements in the array</param>
        /// <param name="lowerBound">Lower bound of the array [default = 0]</param>
        /// <param name="alignment">Alignment for the type</param>
        public DebugArrayType(IArrayType llvmType
                              , IDebugType <ITypeRef, DIType> elementType
                              , NativeModule module
                              , uint count
                              , uint lowerBound = 0
                              , uint alignment  = 0
                              )
            : base(llvmType)
        {
            if (llvmType == null)
            {
                throw new ArgumentNullException(nameof(llvmType));
            }

            if (elementType == null)
            {
                throw new ArgumentNullException(nameof(elementType));
            }

            if (llvmType.ElementType.TypeHandle != elementType.TypeHandle)
            {
                throw new ArgumentException("elementType doesn't match array element type");
            }

            DIType           = CreateDebugInfoForArray(llvmType, elementType, module, count, lowerBound, alignment);
            DebugElementType = elementType;
        }
Пример #5
0
        public override IEnumDebugProperty EnumChildren(EnumerationKind kind, int radix, int timeout, bool allowFuncEval)
        {
            if (this.value == null || this.value.IsNullReference())
            {
                return(null);
            }
            IDebugType       typ        = this.value.RuntimeType();
            IDebugClassType  classType  = null;
            IDebugStreamType streamType = null;

            if ((classType = typ as IDebugClassType) != null)
            {
                //IEnumSymbol enumSymbol = new CEnumClosureClassSymbols(this.value, this.context);
                IEnumSymbol enumSymbol = classType.GetClosureClassMembers(this.value);
                //IEnumSymbol enumSymbol = classType.GetMembers(null, true, SymbolKind.Field|SymbolKind.Property, SymbolModifiers.All);
                return(new EnumDebugPropertySymbols(enumSymbol, this, this.value, this.evaluator));
            }
            else if ((streamType = typ as IDebugStreamType) != null)
            {
                //IDebugStreamType classType = (IDebugStreamType)this.value.RuntimeType();
                IEnumSymbol enumSymbol = streamType.GetMembers(null, true, SymbolKind.Field | SymbolKind.Property, SymbolModifiers.All);
                return(new EnumDebugPropertySymbols(enumSymbol, this, this.value, this.evaluator));
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
 public DebugClassNode(DebugEnvironment envr, IDebugType symbolType, IDebugValue value)
 {
     this.debugEnv   = envr;
     this.SymbolType = symbolType;
     this.Value      = value;
     this.Name       = Identifier.For(this.GetDebugType.Name);
 }
Пример #7
0
 public TypeProperty(IDebugType type, IDebugProperty parent, IDebugValue containerValue, CommonExpressionEvaluator evaluator)
 {
     this.type           = type;
     this.parent         = parent;
     this.name           = this.type.FullName;
     this.containerValue = containerValue;
     this.evaluator      = evaluator;
 }
Пример #8
0
 public BaseProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent, CommonExpressionEvaluator evaluator)
 {
     this.name       = name;
     this.staticType = staticType;
     this.parent     = parent;
     this.value      = value;
     this.evaluator  = evaluator;
 }
Пример #9
0
 /// <summary>Creates a function</summary>
 /// <param name="name">Name of the function</param>
 /// <param name="isVarArg">Flag indicating if the function supports a variadic argument list</param>
 /// <param name="returnType">Return type of the function</param>
 /// <param name="argumentTypes">Arguments for the function</param>
 /// <returns>
 /// Function, matching the signature specified. This may be a previously declared or defined
 /// function or a new function if none matching the name and signature is already present.
 /// </returns>
 public Function CreateFunction(string name
                                , bool isVarArg
                                , IDebugType <ITypeRef, DIType> returnType
                                , params IDebugType <ITypeRef, DIType>[] argumentTypes
                                )
 {
     return(CreateFunction(name, isVarArg, returnType, (IEnumerable <IDebugType <ITypeRef, DIType> >)argumentTypes));
 }
Пример #10
0
 public DebugFunctionType CreateFunctionType(DebugInfoBuilder diBuilder
                                             , bool isVarArg
                                             , IDebugType <ITypeRef, DIType> retType
                                             , params IDebugType <ITypeRef, DIType>[] argTypes
                                             )
 {
     return(CreateFunctionType(diBuilder, isVarArg, retType, (IEnumerable <IDebugType <ITypeRef, DIType> >)argTypes));
 }
Пример #11
0
 public EnumProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent, CommonExpressionEvaluator evaluator)
     : base(name, staticType, value, parent, evaluator)
 {
     this.enumType = value.RuntimeType() as IDebugEnumType;
     if (this.enumType == null)
     {
         this.enumType = staticType as IDebugEnumType;
     }
 }
Пример #12
0
 internal EnumArrayIndices(IEnumDebugValues enumValues, IDebugType elementType, IDebugProperty parent, IDebugValue containerValue, CommonExpressionEvaluator evaluator)
 {
     this.enumValues     = enumValues;
     this.elementType    = elementType;
     this.parent         = parent;
     this.containerValue = containerValue;
     this.index          = 0;
     this.evaluator      = evaluator;
 }
Пример #13
0
 /// <summary>Initializes a new instance of the <see cref="DebugArrayType"/> class.</summary>
 /// <param name="elementType">Type of elements in the array</param>
 /// <param name="module"><see cref="BitcodeModule"/> to use for the context of the debug information</param>
 /// <param name="count">Number of elements in the array</param>
 /// <param name="lowerBound"><see cref="LowerBound"/> value for the array indices [Default: 0]</param>
 public DebugArrayType(IDebugType <ITypeRef, DIType> elementType, BitcodeModule module, uint count, uint lowerBound = 0)
     : this(elementType.ValidateNotNull(nameof(elementType)).CreateArrayType(count)
            , elementType
            , module
            , count
            , lowerBound
            )
 {
 }
Пример #14
0
 /// <summary>Constructs a new <see cref="DebugArrayType"/></summary>
 /// <param name="elementType">Type of elements in the array</param>
 /// <param name="module"><see cref="NativeModule"/> to use for the context of the debug information</param>
 /// <param name="count">Number of elements in the array</param>
 /// <param name="lowerBound"><see cref="LowerBound"/> value for the array indices [Default: 0]</param>
 public DebugArrayType(IDebugType <ITypeRef, DIType> elementType, NativeModule module, uint count, uint lowerBound = 0)
     : this(elementType.VerifyArgNotNull(nameof(elementType)).CreateArrayType(count)
            , elementType
            , module
            , count
            , lowerBound
            )
 {
 }
Пример #15
0
        /// <summary>Creates a FunctionType with Debug information</summary>
        /// <param name="diBuilder"><see cref="DebugInfoBuilder"/>to use to create the debug information</param>
        /// <param name="isVarArg">Flag to indicate if this function is variadic</param>
        /// <param name="retType">Return type of the function</param>
        /// <param name="argTypes">Argument types of the function</param>
        /// <returns>Function signature</returns>
        public DebugFunctionType CreateFunctionType(DebugInfoBuilder diBuilder
                                                    , bool isVarArg
                                                    , IDebugType <ITypeRef, DIType> retType
                                                    , IEnumerable <IDebugType <ITypeRef, DIType> > argTypes
                                                    )
        {
            if (diBuilder == null)
            {
                throw new ArgumentNullException(nameof(diBuilder));
            }

            if (!retType.HasDebugInfo( ))
            {
                throw new ArgumentNullException(nameof(retType), "Return type does not have debug information");
            }

            var  nativeArgTypes = new List <ITypeRef>( );
            var  debugArgTypes  = new List <DIType>( );
            var  msg            = new StringBuilder("One or more parameter types ar not valid:\n");
            bool hasParamErrors = false;

            foreach (var indexedPair in argTypes.Select((t, i) => new { Type = t, Index = i }))
            {
                if (indexedPair.Type == null)
                {
                    msg.AppendFormat("\tArgument {0} is null", indexedPair.Index);
                    hasParamErrors = true;
                }
                else
                {
                    nativeArgTypes.Add(indexedPair.Type.NativeType);
                    debugArgTypes.Add(indexedPair.Type.DIType);
                    if (indexedPair.Type.HasDebugInfo( ))
                    {
                        continue;
                    }

                    msg.AppendFormat("\tArgument {0} does not contain debug type information", indexedPair.Index);
                    hasParamErrors = true;
                }
            }

            // if any parameters don't have errors, then provide a hopefully helpful message indicating which one(s)
            if (hasParamErrors)
            {
                throw new ArgumentException(msg.ToString( ), nameof(argTypes));
            }

            var llvmType = GetFunctionType(retType.NativeType, nativeArgTypes, isVarArg);

            var diType = diBuilder.CreateSubroutineType(0, retType.DIType, debugArgTypes);

            Debug.Assert(diType != null && !diType.IsTemporary);

            return(new DebugFunctionType(llvmType, diType));
        }
Пример #16
0
 /// <summary>Constructs a new <see cref="DebugPointerType"/></summary>
 /// <param name="debugElementType">Debug type of the pointee</param>
 /// <param name="module"><see cref="NativeModule"/> used for creating the pointer type and debug information</param>
 /// <param name="addressSpace">Target address space for the pointer [Default: 0]</param>
 /// <param name="name">Name of the type [Default: null]</param>
 /// <param name="alignment">Alignment on pointer</param>
 public DebugPointerType(IDebugType <ITypeRef, DIType> debugElementType, NativeModule module, uint addressSpace = 0, string name = null, uint alignment = 0)
     : this(debugElementType.VerifyArgNotNull(nameof(debugElementType)).NativeType
            , module
            , debugElementType.VerifyArgNotNull(nameof(debugElementType)).DIType
            , addressSpace
            , name
            , alignment
            )
 {
 }
Пример #17
0
        /// <summary>Creates a FunctionType with Debug information</summary>
        /// <param name="diBuilder"><see cref="DebugInfoBuilder"/>to use to create the debug information</param>
        /// <param name="isVarArg">Flag to indicate if this function is variadic</param>
        /// <param name="retType">Return type of the function</param>
        /// <param name="argTypes">Argument types of the function</param>
        /// <returns>Function signature</returns>
        public DebugFunctionType CreateFunctionType(DebugInfoBuilder diBuilder
                                                    , bool isVarArg
                                                    , [ValidatedNotNull] IDebugType <ITypeRef, DIType> retType
                                                    , [ValidatedNotNull] IEnumerable <IDebugType <ITypeRef, DIType> > argTypes
                                                    )
        {
            diBuilder.ValidateNotNull(nameof(diBuilder));
            retType.ValidateNotNull(nameof(retType));
            argTypes.ValidateNotNull(nameof(retType));

            if (!retType.HasDebugInfo( ))
            {
                throw new ArgumentNullException(nameof(retType), Resources.Return_type_does_not_have_debug_information);
            }

            var  nativeArgTypes = new List <ITypeRef>( );
            var  debugArgTypes  = new List <DIType>( );
            var  msg            = new StringBuilder(Resources.One_or_more_parameter_types_are_not_valid);
            bool hasParamErrors = false;

            foreach (var indexedPair in argTypes.Select((t, i) => new { Type = t, Index = i }))
            {
                if (indexedPair.Type == null)
                {
                    msg.AppendFormat(CultureInfo.CurrentCulture, Resources.Argument_0_is_null, indexedPair.Index);
                    hasParamErrors = true;
                }
                else
                {
                    nativeArgTypes.Add(indexedPair.Type.NativeType);
                    debugArgTypes.Add(indexedPair.Type.DIType);
                    if (indexedPair.Type.HasDebugInfo( ))
                    {
                        continue;
                    }

                    msg.AppendFormat(CultureInfo.CurrentCulture, Resources.Argument_0_does_not_contain_debug_type_information, indexedPair.Index);
                    hasParamErrors = true;
                }
            }

            // if any parameters have errors, then provide a hopefully helpful message indicating which one(s)
            if (hasParamErrors)
            {
                throw new ArgumentException(msg.ToString( ), nameof(argTypes));
            }

            var llvmType = GetFunctionType(retType.NativeType, nativeArgTypes, isVarArg);

            var diType = diBuilder.CreateSubroutineType(0, retType.DIType, debugArgTypes);

            Debug.Assert(diType != null && !diType.IsTemporary, Resources.Assert_Should_have_a_valid_non_temp_type_by_now);

            return(new DebugFunctionType(llvmType, diType));
        }
Пример #18
0
        public virtual BaseProperty MakeProperty(IDebugFieldSymbol symbol, IDebugProperty parent, IDebugValue containerValue)
        {
            IDebugType  staticType = symbol.Type;
            IDebugValue value      = symbol.GetValue(containerValue);

            if (symbol.Name == "this value: ")
            {
                return(this.MakeProperty("this", symbol.Type, value, parent));
            }
            return(this.MakeProperty(symbol.Name, symbol.Type, value, parent));
        }
Пример #19
0
        /// <summary>Creates a function</summary>
        /// <param name="name">Name of the function</param>
        /// <param name="isVarArg">Flag indicating if the function supports a variadic argument list</param>
        /// <param name="returnType">Return type of the function</param>
        /// <param name="argumentTypes">Arguments for the function</param>
        /// <returns>
        /// Function, matching the signature specified. This may be a previously declared or defined
        /// function or a new function if none matching the name and signature is already present.
        /// </returns>
        public Function CreateFunction(string name
                                       , bool isVarArg
                                       , IDebugType <ITypeRef, DIType> returnType
                                       , IEnumerable <IDebugType <ITypeRef, DIType> > argumentTypes
                                       )
        {
            ValidateHandle( );
            IFunctionType signature = Context.CreateFunctionType(DIBuilder, isVarArg, returnType, argumentTypes);

            return(AddFunction(name, signature));
        }
Пример #20
0
 public StructuralProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent, CommonExpressionEvaluator evaluator)
     : base(name, staticType, value, parent, evaluator)
 {
     if (this.value != null)
     {
         this.structuralType = this.value.RuntimeType() as IDebugStructuralType;
     }
     else
     {
         this.structuralType = staticType as IDebugStructuralType;
     }
 }
Пример #21
0
 /// <summary>Initializes a new instance of the <see cref="DebugArrayType"/> class</summary>
 /// <param name="llvmType">Underlying LLVM array type to bind debug info to</param>
 /// <param name="elementType">Array element type with debug information</param>
 /// <param name="module">module to use for creating debug information</param>
 /// <param name="count">Number of elements in the array</param>
 /// <param name="lowerBound">Lower bound of the array [default = 0]</param>
 /// <param name="alignment">Alignment for the type</param>
 public DebugArrayType(IArrayType llvmType
                       , IDebugType <ITypeRef, DIType> elementType
                       , BitcodeModule module
                       , uint count
                       , uint lowerBound = 0
                       , uint alignment  = 0
                       )
     : base(llvmType, BuildDebugType(llvmType, elementType, module, count, lowerBound, alignment))
 {
     elementType.ValidateNotNull(nameof(elementType));
     elementType.DIType.ValidateNotNull($"{nameof( elementType )}.{nameof( elementType.DIType )}");
     DebugElementType = elementType;
 }
Пример #22
0
        // Implementation on IDebugValue
        public IDebugType RuntimeType()
        {
            IDebugType   pRetVal = null;
            IDebugBinder binder  = this.m_Context.Binder;

            if (null == this.m_RuntimeType)
            {
                binder.ResolveRuntimeType(this.m_Object, out this.m_RuntimeType);
            }
            if (null != this.m_RuntimeType)
            {
                pRetVal = SymbolHelper.DebugTypeFromField(this.m_RuntimeType, this.m_Context);
            }
            return(pRetVal);
        }
Пример #23
0
 /// <summary>Initializes a new instance of the <see cref="DebugFunctionType"/> class.</summary>
 /// <param name="llvmType">Native LLVM function signature</param>
 /// <param name="module"><see cref="BitcodeModule"/> to use when construction debug information</param>
 /// <param name="debugFlags"><see cref="DebugInfoFlags"/> for this signature</param>
 /// <param name="retType">Return type for the function</param>
 /// <param name="argTypes">Potentially empty set of argument types for the signature</param>
 public DebugFunctionType(IFunctionType llvmType
                          , BitcodeModule module
                          , DebugInfoFlags debugFlags
                          , IDebugType <ITypeRef, DIType> retType
                          , params IDebugType <ITypeRef, DIType>[] argTypes
                          )
     : base(llvmType.ValidateNotNull(nameof(llvmType))
            , module.ValidateNotNull(nameof(module))
            .DIBuilder.CreateSubroutineType(debugFlags
                                            , retType.ValidateNotNull(nameof(retType)).DIType
                                            , argTypes.Select(t => t.DIType)
                                            )
            )
 {
 }
Пример #24
0
 /// <summary>Initializes a new instance of the <see cref="DebugMemberInfo"/> class.</summary>
 /// <param name="index">Member index</param>
 /// <param name="name">Member name</param>
 /// <param name="file">File containing the declaration of the member</param>
 /// <param name="line">Line number containing the member</param>
 /// <param name="debugType">Debug type for the member</param>
 /// <param name="debugInfoFlags">Flags for the member</param>
 /// <param name="explicitLayout">Explicit layout information for this member, if any</param>
 public DebugMemberInfo(uint index
                        , string name
                        , DIFile?file
                        , uint line
                        , IDebugType <ITypeRef, DIType> debugType
                        , DebugInfoFlags debugInfoFlags    = DebugInfoFlags.None
                        , DebugMemberLayout?explicitLayout = null
                        )
 {
     Index          = index;
     Name           = name;
     File           = file;
     Line           = line;
     DebugType      = debugType;
     DebugInfoFlags = debugInfoFlags;
     ExplicitLayout = explicitLayout;
 }
Пример #25
0
        private static DICompositeType CreateDebugInfoForArray(IArrayType llvmType
                                                               , IDebugType <ITypeRef, DIType> elementType
                                                               , BitcodeModule module
                                                               , uint count
                                                               , uint lowerBound
                                                               , uint alignment
                                                               )
        {
            if (llvmType.IsSized)
            {
                return(module.DIBuilder.CreateArrayType(module.Layout.BitSizeOf(llvmType)
                                                        , alignment
                                                        , elementType.DIType
                                                        , module.DIBuilder.CreateSubRange(lowerBound, count)
                                                        ));
            }

            return(module.DIBuilder.CreateReplaceableCompositeType(Tag.ArrayType, string.Empty, module.DICompileUnit, null, 0));
        }
Пример #26
0
        /// <summary>Initializes a new instance of the <see cref="DebugArrayType"/> class</summary>
        /// <param name="llvmType">Underlying LLVM array type to bind debug info to</param>
        /// <param name="elementType">Array element type with debug information</param>
        /// <param name="module">module to use for creating debug information</param>
        /// <param name="count">Number of elements in the array</param>
        /// <param name="lowerBound">Lower bound of the array [default = 0]</param>
        /// <param name="alignment">Alignment for the type</param>
        public DebugArrayType(IArrayType llvmType
                              , IDebugType <ITypeRef, DIType> elementType
                              , BitcodeModule module
                              , uint count
                              , uint lowerBound = 0
                              , uint alignment  = 0
                              )
            : base(llvmType)
        {
            llvmType.ValidateNotNull(nameof(llvmType));
            elementType.ValidateNotNull(nameof(elementType));

            if (llvmType.ElementType.GetTypeRef() != elementType.GetTypeRef())
            {
                throw new ArgumentException("elementType doesn't match array element type");
            }

            DIType           = CreateDebugInfoForArray(llvmType, elementType, module, count, lowerBound, alignment);
            DebugElementType = elementType;
        }
Пример #27
0
        // Override these factory methods to create language specfic IDebugProperty implementations
        public virtual BaseProperty MakeProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent)
        {
            IDebugType type = null;

            if (value == null || value.IsNullReference() || staticType.Kind == TypeKind.Stream ||
                staticType.Kind == TypeKind.FlexArray || staticType.Kind == TypeKind.Enum)
            {
                type = staticType;
            }
            else
            {
                type = value.RuntimeType();
            }

            switch (type.Kind)
            {
            case TypeKind.Primitive:
                return(MakePrimitiveTypeProperty(name, staticType, value, parent));

            case TypeKind.InnerClass:
            case TypeKind.Class:
                return(MakeClassProperty(name, staticType, value, parent));

            case TypeKind.FlexArray:
                return(MakeFlexArrayProperty(name, staticType, value, parent));

            case TypeKind.Tuple:
                return(MakeStructuralProperty(name, staticType, value, parent));

            case TypeKind.Stream:
                return(MakeStreamProperty(name, staticType, value, parent));

            case TypeKind.Array:
                return(MakeArrayProperty(name, staticType, value, parent));

            case TypeKind.Enum:
                return(MakeEnumProperty(name, staticType, value, parent));
            }
            return(null);
        }
Пример #28
0
        private static Function DeclareCopyFunc(BitcodeModule module
                                                , DIFile diFile
                                                , IDebugType <ITypeRef, DIType> voidType
                                                , DIDerivedType constFoo
                                                , DebugPointerType fooPtr
                                                )
        {
            // Since the first parameter is passed by value
            // using the pointer + alloca + memcopy pattern, the actual
            // source, and therefore debug, signature is NOT a pointer.
            // However, that usage would create a signature with two
            // pointers as the arguments, which doesn't match the source
            // To get the correct debug info signature this inserts an
            // explicit DebugType<> that overrides the default behavior
            // to pair the LLVM pointer type with the original source type.
            var copySig = module.Context.CreateFunctionType(module.DIBuilder
                                                            , voidType
                                                            , DebugType.Create(fooPtr, constFoo)
                                                            , fooPtr
                                                            );

            var copyFunc = module.CreateFunction(scope: diFile
                                                 , name: "copy"
                                                 , linkageName: null
                                                 , file: diFile
                                                 , line: 11
                                                 , signature: copySig
                                                 , isLocalToUnit: true
                                                 , isDefinition: true
                                                 , scopeLine: 14
                                                 , debugFlags: DebugInfoFlags.Prototyped
                                                 , isOptimized: false
                                                 ).Linkage(Linkage.Internal)  // static function
                           .AddAttributes(FunctionAttributeIndex.Function, AttributeKind.NoUnwind, AttributeKind.NoInline, AttributeKind.OptimizeNone)
                           .AddAttributes(FunctionAttributeIndex.Function, TargetDependentAttributes);

            TargetDetails.AddABIAttributesForByValueStructure(copyFunc, 0);
            return(copyFunc);
        }
Пример #29
0
        private static Function DeclareDoCopyFunc(BitcodeModule module, DIFile diFile, IDebugType <ITypeRef, DIType> voidType)
        {
            var doCopySig = module.Context.CreateFunctionType(module.DIBuilder, voidType);

            var doCopyFunc = module.CreateFunction(scope: diFile
                                                   , name: "DoCopy"
                                                   , linkageName: null
                                                   , file: diFile
                                                   , line: 23
                                                   , signature: doCopySig
                                                   , isLocalToUnit: false
                                                   , isDefinition: true
                                                   , scopeLine: 24
                                                   , debugFlags: DebugInfoFlags.None
                                                   , isOptimized: false
                                                   ).AddAttributes(FunctionAttributeIndex.Function, AttributeKind.NoInline, AttributeKind.NoUnwind, AttributeKind.OptimizeNone)
                             .AddAttributes(FunctionAttributeIndex.Function, TargetDependentAttributes);

            return(doCopyFunc);
        }
Пример #30
0
    public  void Reset() {

      this.m_Fields.Reset();
      if (null != this.m_Current){
        this.m_Current = null;
      }
    }
Пример #31
0
 public virtual BaseProperty MakeFlexArrayProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent){
   return new FlexArrayProperty(name, staticType, value, parent, this);
 }
Пример #32
0
 public virtual BaseProperty MakeStructuralProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent){
   return new StructuralProperty(name, staticType, value, parent, this);
 }
Пример #33
0
 public virtual BaseProperty MakePrimitiveTypeProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent){
   return new PrimitiveTypeProperty(name, staticType, value, parent, this);
 }
Пример #34
0
 public IDebugValue CreateObjectNoConstructor(IDebugType type)
 {
     throw new Exception("Not implemented Yet");
 }
Пример #35
0
 internal EnumArrayIndices(IEnumDebugValues enumValues, IDebugType elementType, IDebugProperty parent, IDebugValue containerValue, CommonExpressionEvaluator evaluator){
   this.enumValues = enumValues;
   this.elementType = elementType;
   this.parent = parent;
   this.containerValue = containerValue;
   this.index = 0;
   this.evaluator = evaluator;
 }
Пример #36
0
 public TypeProperty(IDebugType type, IDebugProperty parent, IDebugValue containerValue, CommonExpressionEvaluator evaluator){
   this.type = type;
   this.parent = parent;
   this.name = this.type.FullName;
   this.containerValue = containerValue;
   this.evaluator = evaluator;
 }
Пример #37
0
 public EnumProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent, CommonExpressionEvaluator evaluator)
   : base(name, staticType, value, parent, evaluator){
   this.enumType = value.RuntimeType() as IDebugEnumType;
   if (this.enumType == null)
     this.enumType = staticType as IDebugEnumType;
 }
Пример #38
0
 public ArrayProperty(string name, IDebugType staticType, IDebugValue containerValue, IDebugProperty parent, CommonExpressionEvaluator evaluator)
   : base(name, staticType, containerValue, parent, evaluator){
   arrayValue = (IDebugArrayValue)this.value;
 }
Пример #39
0
    public  bool MoveNext() {
      
      bool pRetVal = false;

      if (null != this.m_Current) {
        this.m_Current = null;
      } else {
        // Skip the first element
        this.m_Fields.Skip(1);
      }

      IDebugField field = null;
      IDebugField[] fields = new IDebugField[1];
      int fetched = 0;
      this.m_Fields.Next(1, fields, out fetched);
      if (null != fields[0]){
        field = fields[0];
        IDebugType type = null;
        type = SymbolHelper.DebugTypeFromField(field, this.m_Context);
        if (null != type) {
          this.m_Current = type;
          pRetVal = true;
        }
      }
      return pRetVal;
    }
Пример #40
0
 public BaseProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent, CommonExpressionEvaluator evaluator){
   this.name = name;
   this.staticType = staticType;
   this.parent = parent;
   this.value = value;
   this.evaluator = evaluator;
 }
Пример #41
0
    // Override these factory methods to create language specfic IDebugProperty implementations
    public virtual BaseProperty MakeProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent){
      IDebugType type = null;
      if (value == null || value.IsNullReference() || staticType.Kind == TypeKind.Stream 
        || staticType.Kind == TypeKind.FlexArray || staticType.Kind == TypeKind.Enum)
        type = staticType;
      else
        type = value.RuntimeType();

      switch (type.Kind){
        case TypeKind.Primitive:
          return MakePrimitiveTypeProperty(name, staticType, value, parent);
        case TypeKind.InnerClass:
        case TypeKind.Class:
          return MakeClassProperty(name, staticType, value, parent);
        case TypeKind.FlexArray:
          return MakeFlexArrayProperty(name, staticType, value, parent);
        case TypeKind.Tuple:
          return MakeStructuralProperty(name, staticType, value, parent);
        case TypeKind.Stream:
          return MakeStreamProperty(name, staticType, value, parent);
        case TypeKind.Array:
          return MakeArrayProperty(name, staticType, value, parent);
        case TypeKind.Enum:
          return MakeEnumProperty(name, staticType, value, parent);
      }
      return null;
    }
Пример #42
0
 public StructuralProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent, CommonExpressionEvaluator evaluator)
   : base(name, staticType, value, parent, evaluator){
   if (this.value != null)
     this.structuralType = this.value.RuntimeType() as IDebugStructuralType;
   else
     this.structuralType = staticType as IDebugStructuralType;
 }
Пример #43
0
 public  IDebugValue CreateObjectNoConstructor(IDebugType type) {
   throw new Exception("Not implemented Yet");
 }
Пример #44
0
 public FlexArrayProperty(string name, IDebugType staticType, IDebugValue value, IDebugProperty parent, CommonExpressionEvaluator evaluator)
   : base(name, staticType, value, parent, evaluator){
 }
Пример #45
0
 public  CEnumDebugTypes(IEnumDebugFields fields, IDebugContext context) {
   this.m_Fields = fields;
   this.m_Context = context;
   this.m_Current = null;
 }