AddMethod() public method

public AddMethod ( MethodEntry entry ) : void
entry MethodEntry
return void
示例#1
0
        public void DefineMethod(MonoSymbolFile file, int token)
        {
            MethodEntry entry = new MethodEntry(
                file, _comp_unit.Entry, token, ScopeVariables,
                Locals, method_lines.ToArray(), Blocks, null, 0, ns_id);

            file.AddMethod(entry);
        }
        public void DefineMethod(MonoSymbolFile file)
        {
            LineNumberEntry[] lines = new LineNumberEntry[this.method_lines_pos];
            Array.Copy(this.method_lines, lines, this.method_lines_pos);
            MethodEntry entry = new MethodEntry(file, this._comp_unit.Entry, this._method.Token, this.ScopeVariables, this.Locals, lines, this.Blocks, this.RealMethodName, (MethodEntry.Flags) 0, this._ns_id);

            file.AddMethod(entry);
        }
示例#3
0
        public void DefineMethod(MonoSymbolFile file)
        {
            MethodEntry entry = new MethodEntry(
                file, _comp_unit.Entry, _method.Token, ScopeVariables,
                Locals, method_lines.ToArray(), Blocks, _real_name, 0,                  //_method_flags,
                _ns_id);

            file.AddMethod(entry);
        }
示例#4
0
        public void DefineMethod(MonoSymbolFile file)
        {
            LineNumberEntry[] lines = new LineNumberEntry [method_lines_pos];
            Array.Copy(method_lines, lines, method_lines_pos);

            MethodEntry entry = new MethodEntry(
                file, _comp_unit.Entry, _method.Token, ScopeVariables,
                Locals, lines, Blocks, RealMethodName, 0,                 //_method_flags,
                _ns_id);

            file.AddMethod(entry);
        }
示例#5
0
        public void DefineMethod(MonoSymbolFile file, int token)
        {
            var blocks = Blocks;

            //
            // When index is provided by user it can be inserted in
            // any order but mdb format does not store its value. It
            // uses store order instead as the index.
            //
            Array.Sort(blocks, (x, y) => x.Index.CompareTo(y.Index));

            var entry = new MethodEntry(
                file, _comp_unit.Entry, token, ScopeVariables,
                Locals, method_lines.ToArray(), blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id);

            file.AddMethod(entry);
        }
示例#6
0
		public void RewriteMdbFile (string inputFile)
		{
			if (!settings.Quiet)
				Console.WriteLine ("Processing {0}", inputFile);
			var input = MonoSymbolFile.ReadSymbolFile (inputFile);

			var output = new MonoSymbolFile ();

			foreach (var s in input.Sources) {
				var newFileName = settings.FileNamesOnly
					? Path.Combine (Path.GetDirectoryName (s.FileName), settings.Replace (Path.GetFileName (s.FileName)))
					: settings.Replace (s.FileName);

				if (settings.Verbose)
					Console.WriteLine ("{0} -> {1}", s.FileName, newFileName);

				s.FileName = newFileName;
				output.AddSource (s);
			}

			foreach (var cu in input.CompileUnits) {
				cu.ReadAll ();
				output.AddCompileUnit (cu);
			}
		
			foreach (var m in input.Methods) {
				m.ReadAll ();
				output.AddMethod (m);
			}


			var mdbName = new FileInfo (inputFile).Name;
			var tmpMdb = Path.GetTempFileName ();
			var finalMdb = inputFile;
			if (settings.OutputDirectory != null)
				finalMdb = Path.Combine (settings.OutputDirectory, mdbName);

			using (var stream = new FileStream (tmpMdb, FileMode.Create)) {
				output.CreateSymbolFile (input.Guid, stream);
			}
			input.Dispose ();

			File.Delete (finalMdb);
			File.Move (tmpMdb, finalMdb);
		}
示例#7
0
		public void DefineMethod (MonoSymbolFile file, int token)
		{
			MethodEntry entry = new MethodEntry (
				file, _comp_unit.Entry, token, ScopeVariables,
				Locals, method_lines.ToArray (), Blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id);

			file.AddMethod (entry);
		}
		public void DefineMethod (MonoSymbolFile file)
		{
			LineNumberEntry[] lines = new LineNumberEntry [method_lines_pos];
			Array.Copy (method_lines, lines, method_lines_pos);

			MethodEntry entry = new MethodEntry (
				file, _comp_unit.Entry, _method.Token, ScopeVariables,
				Locals, lines, Blocks, RealMethodName, _method_flags,
				_ns_id);

			file.AddMethod (entry);
		}
        public void DefineMethod(MonoSymbolFile file, int token)
        {
            var blocks = Blocks;

            if (blocks.Length > 0)
            {
                //
                // When index is provided by user it can be inserted in
                // any order but mdb format does not store its value. It
                // uses stored order as the index instead.
                //
                var sorted    = new List <CodeBlockEntry> (blocks.Length);
                int max_index = 0;
                for (int i = 0; i < blocks.Length; ++i)
                {
                    max_index = System.Math.Max(max_index, blocks [i].Index);
                }

                for (int i = 0; i < max_index; ++i)
                {
                    var scope_index = i + 1;

                    //
                    // Common fast path
                    //
                    if (i < blocks.Length && blocks [i].Index == scope_index)
                    {
                        sorted.Add(blocks [i]);
                        continue;
                    }

                    bool found = false;
                    for (int ii = 0; ii < blocks.Length; ++ii)
                    {
                        if (blocks [ii].Index == scope_index)
                        {
                            sorted.Add(blocks [ii]);
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        continue;
                    }

                    //
                    // Ideally this should never happen but with current design we can
                    // generate scope index for unreachable code before reachable code
                    //
                    sorted.Add(new CodeBlockEntry(scope_index, -1, CodeBlockEntry.Type.CompilerGenerated, 0));
                }

                blocks = sorted.ToArray();
                //for (int i = 0; i < blocks.Length; ++i) {
                //	if (blocks [i].Index - 1 != i)
                //			throw new ArgumentException ("CodeBlocks cannot be converted to mdb format");
                //}
            }

            var entry = new MethodEntry(
                file, _comp_unit.Entry, token, ScopeVariables,
                Locals, method_lines.ToArray(), blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id);

            file.AddMethod(entry);
        }
示例#10
0
		public void DefineMethod(MonoSymbolFile file)
		{
			LineNumberEntry[] lines = new LineNumberEntry[this.method_lines_pos];
			Array.Copy(this.method_lines, lines, this.method_lines_pos);
			MethodEntry entry = new MethodEntry(file, this._comp_unit.Entry, this._method.Token, this.ScopeVariables, this.Locals, lines, this.Blocks, this.RealMethodName, (MethodEntry.Flags)0, this._ns_id);
			file.AddMethod(entry);
		}
示例#11
0
        static void MdbRebase(string mdbFile, string toRemove)
        {
            #if WINDOWS_BUILD
            Console.Error.WriteLine ("Warning: skipping MDB rebasing of {0} (not supported on Windows)", mdbFile);
            #else
            using (var input = MonoSymbolFile.ReadSymbolFile (mdbFile)) {
                var output = new MonoSymbolFile ();

                foreach (var source in input.Sources) {
                    source.FileName = Path.Combine (
                        Path.GetDirectoryName (source.FileName),
                        Path.GetFileName (source.FileName).Replace (toRemove, String.Empty)
                    );

                    output.AddSource (source);
                }

                foreach (var compileUnit in input.CompileUnits) {
                    compileUnit.ReadAll ();
                    output.AddCompileUnit (compileUnit);
                }

                foreach (var method in input.Methods) {
                    method.ReadAll ();
                    output.AddMethod (method);
                }

                var tmpMdb = Path.GetTempFileName ();

                using (var stream = new FileStream (tmpMdb, FileMode.Create))
                    output.CreateSymbolFile (input.Guid, stream);

                File.Delete (mdbFile);
                File.Move (tmpMdb, mdbFile);
            }
            #endif
        }
示例#12
0
		public void DefineMethod (MonoSymbolFile file, int token)
		{
			var blocks = Blocks;

			//
			// When index is provided by user it can be inserted in
			// any order but mdb format does not store its value. It
			// uses store order instead as the index.
			//
			Array.Sort (blocks, (x, y) => x.Index.CompareTo (y.Index));

			var entry = new MethodEntry (
				file, _comp_unit.Entry, token, ScopeVariables,
				Locals, method_lines.ToArray (), blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id);

			file.AddMethod (entry);
		}