當前位置: 首頁>>代碼示例>>C#>>正文


C# MethodEntry.GetLineNumberTable方法代碼示例

本文整理匯總了C#中Mono.CompilerServices.SymbolWriter.MethodEntry.GetLineNumberTable方法的典型用法代碼示例。如果您正苦於以下問題:C# MethodEntry.GetLineNumberTable方法的具體用法?C# MethodEntry.GetLineNumberTable怎麽用?C# MethodEntry.GetLineNumberTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.CompilerServices.SymbolWriter.MethodEntry的用法示例。


在下文中一共展示了MethodEntry.GetLineNumberTable方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReadLineNumbers

		void ReadLineNumbers (MethodEntry entry, IDictionary instructions)
		{
			LineNumberTable lnt = entry.GetLineNumberTable ();
			foreach (LineNumberEntry line in lnt.LineNumbers) {
				Instruction instr = instructions [line.Offset] as Instruction;
				if (instr == null)
					continue;

				Document doc = GetDocument (entry.CompileUnit.SourceFile);
				instr.SequencePoint = new SequencePoint (doc);
				instr.SequencePoint.StartLine = line.Row;
				instr.SequencePoint.EndLine = line.Row;
			}
		}
開發者ID:transformersprimeabcxyz,項目名稱:monodevelop-1,代碼行數:14,代碼來源:MdbReader.cs

示例2: ReadLineNumbers

		private void ReadLineNumbers(MethodEntry entry, InstructionMapper mapper)
		{
			Document document = null;
			LineNumberTable table = entry.GetLineNumberTable();
			LineNumberEntry[] lineNumbers = table.LineNumbers;
			for (int i = 0; i < lineNumbers.Length; i++)
			{
				LineNumberEntry line = lineNumbers[i];
				Instruction instruction = mapper(line.Offset);
				if (instruction != null)
				{
					if (document == null)
					{
						document = this.GetDocument(entry.CompileUnit.SourceFile);
					}
					instruction.SequencePoint = new SequencePoint(document)
					{
						StartLine = line.Row,
						EndLine = line.Row
					};
				}
			}
		}
開發者ID:qq1792,項目名稱:LSharp,代碼行數:23,代碼來源:MdbReader.cs

示例3: ReadLineNumbers

		void ReadLineNumbers (MethodEntry entry, InstructionMapper mapper)
		{
			Document document = null;
			var table = entry.GetLineNumberTable ();

			foreach (var line in table.LineNumbers) {
				var instruction = mapper (line.Offset);
				if (instruction == null)
					continue;

				if (document == null)
					document = GetDocument (entry.CompileUnit.SourceFile);

				instruction.SequencePoint = new SequencePoint (document) {
					StartLine = line.Row,
					EndLine = line.Row,
				};
			}
		}
開發者ID:yayanyang,項目名稱:monodevelop,代碼行數:19,代碼來源:MdbReader.cs

示例4: ProcessMethod

	private void ProcessMethod (MethodDefinition monoMethod, MethodEntry entry, ClassCoverageItem klass, string methodName, string cov_info)
#endif
	{
		if (entry == null)
			// Compiler generated, abstract method etc.
			return;

		LineNumberEntry[] lines = entry.GetLineNumberTable ().LineNumbers;

		if (lines.Length == 0)
			return;

		int start_line = lines [0].Row;
		int end_line = lines [lines.Length - 1].Row;

		MethodCoverageItem method 
			= new MethodCoverageItem (klass, methodName);

		method.startLine = start_line;
		method.endLine = end_line;
#if USE_REFLECTION
		method.filtered = IsFiltered ("[" + monoMethod.DeclaringType.Assembly + "]" + monoMethod.DeclaringType + "::" + monoMethod.Name);
#else
		method.filtered = IsFiltered ("[" + monoMethod.DeclaringType.Module.Name + "]" + monoMethod.DeclaringType + "::" + monoMethod.Name);
#endif
		klass.methodsByMethod [monoMethod] = method;


		if (klass.sourceFile == null) {
			string sourceFile = entry.CompileUnit.SourceFile.FileName;

			SourceFileCoverageData source = (SourceFileCoverageData)sources [sourceFile];
			if (source == null) {
				source = new SourceFileCoverageData (sourceFile);
				sources [sourceFile] = source;
			}
			klass.sourceFile = source;
		}
			
		computeMethodCoverage (method, lines, cov_info);
	}
開發者ID:bennidhamma,項目名稱:monocov,代碼行數:41,代碼來源:CoverageModel.cs

示例5: ReadLineNumbers

        void ReadLineNumbers(MethodEntry entry, MethodDebugInformation info)
        {
            var table = entry.GetLineNumberTable ();

            info.sequence_points = new Collection<SequencePoint> (table.LineNumbers.Length);

            for (var i = 0; i < table.LineNumbers.Length; i++) {
                var line = table.LineNumbers [i];
                if (i > 0 && table.LineNumbers [i - 1].Offset == line.Offset)
                    continue;

                info.sequence_points.Add (LineToSequencePoint (line));
            }
        }
開發者ID:jbevain,項目名稱:cecil,代碼行數:14,代碼來源:MdbReader.cs

示例6: MonoMethodSource

            public MonoMethodSource(MonoSymbolFile file, SourceFile source_file,
						 C.MethodEntry method, Cecil.MethodDefinition mdef,
						 MonoClassType klass, MonoFunctionType function)
            {
                this.file = file;
                this.source_file = source_file;
                this.method = method;
                this.mdef = mdef;
                this.function = function;
                this.klass = klass;

                full_name = method.GetRealName ();
                if (full_name == null)
                    full_name = MonoSymbolFile.GetMethodName (mdef);

                C.LineNumberEntry start, end;
                C.LineNumberTable lnt = method.GetLineNumberTable ();
                if (lnt.GetMethodBounds (out start, out end))
                    start_row = start.Row; end_row = end.Row;
            }
開發者ID:atomia,項目名稱:mono_debugger,代碼行數:20,代碼來源:MonoSymbolFile.cs

示例7: CheckMethod

        protected void CheckMethod(MethodEntry method)
        {
            Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupByToken (
                Cecil.Metadata.TokenType.Method, method.Token & 0xffffff);
            if ((mdef == null) || (mdef.Body == null))
                throw new MonoSymbolFileException ("Method {0} (token {1:x}) not found in assembly.",
                                   method.Index, method.Token);

            string name = String.Format ("{0} ({1})", method.Index, GetMethodName (mdef));
            Debug ("[Method {0} - {1} - {2}]", method.Index, method.CompileUnit.SourceFile.FileName,
                   GetMethodName (mdef));

            LineNumberTable lnt = method.GetLineNumberTable ();
            if (lnt == null)
                throw new MonoSymbolFileException ("Cannot get LNT from method {0}.", name);

            if (lnt.LineNumbers == null)
                throw new MonoSymbolFileException ("Cannot get LNT from method {0}.", name);
            LineNumberEntry start, end;
            if (lnt.GetMethodBounds (out start, out end))
                Debug ("  Bounds: {0} {1}", start, end);
            foreach (LineNumberEntry line in lnt.LineNumbers)
                Debug ("    Line: {0}", line);

            CodeBlockEntry[] blocks = method.GetCodeBlocks () ?? new CodeBlockEntry [0];
            foreach (CodeBlockEntry block in blocks) {
                if ((block.Parent >= 0) && (block.Parent >= blocks.Length))
                    throw new MonoSymbolFileException (
                        "Code block {0} in method {1} has invalid parent index {2} (valid is 0..{3}).",
                        block, name, block.Parent, blocks.Length);
            }

            LocalVariableEntry[] locals = method.GetLocals () ?? new LocalVariableEntry [0];
            foreach (LocalVariableEntry local in locals) {
                if ((local.BlockIndex < 0) || ((local.BlockIndex > 0) && (local.BlockIndex > blocks.Length)))
                    throw new MonoSymbolFileException (
                        "Local variable {0} in method {1} has invalid block index {2} (valid is 0..{3}).",
                        local, name, local.BlockIndex, blocks.Length);

                Debug ("  Local: {0}", local);
            }

            int num_locals = mdef.Body.Variables.Count;

            ScopeVariable[] scope_vars = method.GetScopeVariables () ?? new ScopeVariable [0];
            foreach (ScopeVariable var in scope_vars) {
                Debug ("  Scope var: {0}", var);
                if ((mdef.IsStatic) && (var.Index < 0))
                    throw new MonoSymbolFileException (
                        "Method {0} has invalid scope variable {1} (referencing `this' in static method).",
                        name, var);
                if ((var.Index >= 0) && (var.Index >= num_locals))
                    throw new MonoSymbolFileException (
                        "Method {0} has invalid scope variable {1} (index out of bounds: {2} / {3}).",
                        name, var, var.Index, num_locals);
                if ((var.Scope > 0) && (File.GetAnonymousScope (var.Scope) == null))
                    throw new MonoSymbolFileException (
                        "Method {0} has invalid scope variable {1} (can't find scope {2}).",
                        name, var, var.Scope);
            }
        }
開發者ID:baulig,項目名稱:debugger,代碼行數:61,代碼來源:MdbSymbolReader.cs


注:本文中的Mono.CompilerServices.SymbolWriter.MethodEntry.GetLineNumberTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。