public InstrumentedMethod(int id, IModule module, uint metadataToken, string detailName, ISourceMethod sourceMethod)
 {
     InstrumentedMethodId = id;
     Module        = module;
     MetadataToken = metadataToken;
     DetailName    = detailName;
     SourceMethod  = sourceMethod;
 }
Exemple #2
0
            public MethodItem(ISourceMethod method, int score, IMatchScorer scorer)
                : base(method.Name, scorer)
            {
                mMethod = method;
                Score   = score;
                var typeParts = mMethod.ParentType.Split('.');

                TypeName  = typeParts.LastOrDefault() ?? string.Empty;
                Namespace = string.Join(".", typeParts.Take(typeParts.Length - 1));
            }
        public DebugInfoSourceMethodBuilder(DebugInfoGenerator debugInfoGenerator, ISourceMethod method, CollectionMetadata file, CollectionMetadata subprograms)
        {
            this.debugInfoGenerator = debugInfoGenerator;

            CollectionMetadata subroutineTypes;
            CollectionMetadata functionVariables;
            subprograms.Add(this.function = debugInfoGenerator.DefineMethod(method, file, out functionVariables));

            this.functionVariables = functionVariables;
        }
Exemple #4
0
        public DebugInfoSourceMethodBuilder(DebugInfoGenerator debugInfoGenerator, ISourceMethod method, CollectionMetadata file, CollectionMetadata subprograms)
        {
            this.debugInfoGenerator = debugInfoGenerator;

            CollectionMetadata subroutineTypes;
            CollectionMetadata functionVariables;

            subprograms.Add(this.function = debugInfoGenerator.DefineMethod(method, file, out functionVariables));

            this.functionVariables = functionVariables;
        }
 public ISourceMethodBuilder OpenMethod(ICompileUnitEntry compilationUnit, ISourceMethod method)
 {
     return new DummySourceMethodBuilder();
 }
Exemple #6
0
 public ISourceMethodBuilder OpenMethod(ICompileUnitEntry compilationUnit, ISourceMethod method)
 {
     return(new DummySourceMethodBuilder());
 }
        public CollectionMetadata DefineMethod(
            ISourceMethod method,
            CollectionMetadata file,
            out CollectionMetadata functionVariables)
        {
            // Flags 256 - definition (as main()), 259 - public (member of a class)
            var flag = 256;

            // Line number of the opening '{' of the function
            var scopeLine = method.LineNumber;

            // find method definition
            this.methodDefinition = this.llvmWriter.MethodsByToken[method.Token];

            var methodReferenceType =
                this.llvmWriter.WriteToString(
                    () => this.llvmWriter.WriteMethodPointerType(this.llvmWriter.Output, this.methodDefinition));
            var methodDefinitionName =
                this.llvmWriter.WriteToString(
                    () => this.llvmWriter.WriteMethodDefinitionName(this.llvmWriter.Output, this.methodDefinition));

            CollectionMetadata subroutineTypes;
            CollectionMetadata parametersTypes;

            // add compile unit template
            var methodMetadataDefinition =
                new CollectionMetadata(this.indexedMetadata).Add(
                    string.Format(
                        @"0x2e\00{0}\00{1}\00{2}\00{3}\000\001\000\000\00{4}\000\00{5}",
                        method.Name,
                        method.DisplayName,
                        method.LinkageName,
                        method.LineNumber,
                        flag,
                        scopeLine),
                    // Source directory (including trailing slash) & file pair
                    file,
                    // Reference to context descriptor
                    this.fileType,
                    // Subroutine types
                    subroutineTypes = new CollectionMetadata(this.indexedMetadata),
                    // indicates which base type contains the vtable pointer for the derived class
                    null,
                    // function method reference ex. "i32 ()* @main"
                    new PlainTextMetadata(string.Concat(methodReferenceType, " ", methodDefinitionName)),
                    // Lists function template parameters
                    null,
                    // Function declaration descriptor
                    null,
                    // List of function variables
                    functionVariables = new CollectionMetadata(this.indexedMetadata));

            // add subrouting type
            subroutineTypes.Add(
                @"0x15\00\000\000\000\000\000\000",
                null,
                null,
                null,
                parametersTypes = new CollectionMetadata(this.indexedMetadata),
                null,
                null,
                null);

            this.currentFunction = methodMetadataDefinition;

            // add return type
            parametersTypes.Add(
                !this.methodDefinition.ReturnType.IsVoid() && !this.methodDefinition.ReturnType.IsStructureType()
                    ? this.DefineType(this.methodDefinition.ReturnType)
                    : null);
            foreach (var parameter in this.methodDefinition.GetParameters())
            {
                parametersTypes.Add(this.DefineType(parameter.ParameterType));
            }

            return(methodMetadataDefinition);
        }
 public ISourceMethodBuilder DefineMethod(ISourceMethod method)
 {
     return new DummySourceMethodBuilder();
 }
Exemple #9
0
 public ISourceMethodBuilder DefineMethod(ISourceMethod method)
 {
     return(new DummySourceMethodBuilder());
 }
Exemple #10
0
 public ISourceMethodBuilder OpenMethod(ICompileUnitEntry compilationUnit, ISourceMethod method)
 {
     return(compilationUnit.DefineMethod(method));
 }
        public CollectionMetadata DefineMethod(ISourceMethod method, CollectionMetadata file, out CollectionMetadata functionVariables)
        {
            // Flags 256 - definition (as main()), 259 - public (member of a class)
            var flag = 256;

            // Line number of the opening '{' of the function
            var scopeLine = method.LineNumber;

            // find method definition
            this.methodDefinition = this.writer.MethodsByToken[method.Token];

            var methodReferenceType = this.writer.WriteToString(() => this.writer.WriteMethodPointerType(this.writer.Output, this.methodDefinition));
            var methodDefinitionName = this.writer.WriteToString(() => this.writer.WriteMethodDefinitionName(this.writer.Output, this.methodDefinition));

            CollectionMetadata subroutineTypes;
            CollectionMetadata parametersTypes;

            // add compile unit template
            var methodMetadataDefinition =
                new CollectionMetadata(this.indexedMetadata).Add(
                    string.Format(
                        @"0x2e\00{0}\00{1}\00{2}\00{3}\000\001\000\000\00{4}\000\00{5}",
                        method.Name,
                        method.DisplayName,
                        method.LinkageName,
                        method.LineNumber,
                        flag,
                        scopeLine),
                // Source directory (including trailing slash) & file pair
                    file,
                // Reference to context descriptor
                    this.fileType,
                // Subroutine types
                    subroutineTypes = new CollectionMetadata(this.indexedMetadata),
                // indicates which base type contains the vtable pointer for the derived class
                    null,
                // function method reference ex. "i32 ()* @main"                
                    new PlainTextMetadata(string.Concat(methodReferenceType, " ", methodDefinitionName)),
                // Lists function template parameters
                    null,
                // Function declaration descriptor
                    null,
                // List of function variables
                    functionVariables = new CollectionMetadata(this.indexedMetadata));

            // add subrouting type
            subroutineTypes.Add(
                @"0x15\00\000\000\000\000\000\000", null, null, null, parametersTypes = new CollectionMetadata(this.indexedMetadata), null, null, null);

            this.currentFunction = methodMetadataDefinition;

            // add return type
            parametersTypes.Add(
                !this.methodDefinition.ReturnType.IsVoid() && !this.methodDefinition.ReturnType.IsStructureType()
                    ? this.DefineType(this.methodDefinition.ReturnType)
                    : null);
            foreach (var parameter in this.methodDefinition.GetParameters())
            {
                parametersTypes.Add(this.DefineType(parameter.ParameterType));
            }

            return methodMetadataDefinition;
        }
 public ISourceMethodBuilder DefineMethod(ISourceMethod method)
 {
     return new DebugInfoSourceMethodBuilder(this.debugInfoGenerator, method, this.file, this.subprograms);
 }
Exemple #13
0
 public ISourceMethodBuilder DefineMethod(ISourceMethod method)
 {
     return(new DebugInfoSourceMethodBuilder(this.debugInfoGenerator, method, this.file, this.subprograms));
 }
 public bool Equals(ISourceMethod other) => Equals(other as SourceMethod);
 public ISourceMethodBuilder OpenMethod(ICompileUnitEntry compilationUnit, ISourceMethod method)
 {
     return compilationUnit.DefineMethod(method);
 }
Exemple #16
0
 public void AddSourceMethod(ISourceMethod sourceMethod)
 {
     sourceMethod.Module.InstrumentedMethods
     .Where(m => m.SourceMethod.Equals(sourceMethod))
     .Subscribe(AddMethod);
 }