• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Cil.MethodSymbols类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.Cecil.Cil.MethodSymbols的典型用法代码示例。如果您正苦于以下问题:C# MethodSymbols类的具体用法?C# MethodSymbols怎么用?C# MethodSymbols使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MethodSymbols类属于Mono.Cecil.Cil命名空间,在下文中一共展示了MethodSymbols类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: foreach

		int ICorDebugManagedCallback.LoadAssembly (CorDebugAppDomain pAppDomain, CorDebugAssembly pAssembly)
		{
			assemblies.Add (pAssembly);

			//CorMetadataImport mi = new CorMetadataImport(pAssembly);

			//Seems like this is always set on MicroFramework
			//pAssembly. JITCompilerFlags = CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION;
			List<string> docPaths = new List<string> ();
			if (pAssembly.DebugData != null) {
				var md = pAssembly.MetaData;
				var reader = pAssembly.DebugData;
				if (!pAssembly.IsFrameworkAssembly) {
					foreach (var module in md.Assembly.Modules) {
						foreach (var t in module.Types) {
							foreach (var m in t.Methods) {
								var methodSymbols = new MethodSymbols (m.MetadataToken);
								//Ugly hack
								if(reader is Mono.Cecil.Mdb.MdbReader)
								{
									foreach(var variable in m.Body.Variables)
										methodSymbols.Variables.Add(variable);
								}
								reader.Read (methodSymbols);
								if (methodSymbols.Instructions.Count == 0)
									continue;
								DocInfo document;
								if (!documents.TryGetValue (methodSymbols.Instructions [0].SequencePoint.Document.Url, out document)) {
									document = new DocInfo (methodSymbols.Instructions [0].SequencePoint.Document.Url);
									document.Assembly = pAssembly;
									documents.Add (document.Url, document);
								}
								document.AddMethod (m, methodSymbols);
								if (!docPaths.Contains (document.Url))
									docPaths.Add (document.Url);
							}
						}
					}
				}
				pAssembly.SetJmcStatus (true);
			} else {
				// Flag modules without debug info as not JMC. In this way
				// the debugger won't try to step into them
				pAssembly.SetJmcStatus (false);
			}
			foreach (var docPath in docPaths)
				BindSourceFileBreakpoints (docPath);
			pAppDomain.Process.Continue ();
			return 0;
		}
开发者ID:Roddoric,项目名称:Monkey.Robotics,代码行数:50,代码来源:MicroFrameworkDebuggerSession.cs


示例2: GetLocalVarToken

		static MetadataToken GetLocalVarToken (ByteBuffer buffer, MethodSymbols symbols)
		{
			if (symbols.variables.IsNullOrEmpty ())
				return MetadataToken.Zero;

			buffer.position = 8;
			return new MetadataToken (buffer.ReadUInt32 ());
		}
开发者ID:JustasB,项目名称:cudafy,代码行数:8,代码来源:CodeWriter.cs


示例3: ReadLineNumbers

		void ReadLineNumbers (MethodEntry entry, MethodSymbols symbols)
		{
			var table = entry.GetLineNumberTable ();
			var lines = table.LineNumbers;

			var instructions = symbols.instructions = new Collection<InstructionSymbol> (lines.Length);

			for (int i = 0; i < lines.Length; i++) {
				var line = lines [i];

				instructions.Add (new InstructionSymbol (line.Offset, new SequencePoint (GetDocument (entry.CompileUnit.SourceFile)) {
					StartLine = line.Row,
					EndLine = line.Row,
				}));
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:16,代码来源:MdbReader.cs


示例4: DefineSequencePoints

        void DefineSequencePoints(MethodSymbols symbols)
        {
            var instructions = symbols.instructions;
            if (instructions == null)
                return;

            for (int i = 0; i < instructions.Count; i++) {
                var instruction = instructions [i];
                var sequence_point = instruction.SequencePoint;

                writer.DefineSequencePoints (
                    GetDocument (sequence_point.Document),
                    new [] { instruction.Offset },
                    new [] { sequence_point.StartLine },
                    new [] { sequence_point.StartColumn },
                    new [] { sequence_point.EndLine },
                    new [] { sequence_point.EndColumn });
            }
        }
开发者ID:atykhyy,项目名称:cecil,代码行数:19,代码来源:PdbWriter.cs


示例5: WriteScope

        void WriteScope(MethodSymbols symbols, ScopeSymbol scope)
        {
            writer.OpenScope  (scope.Start);

            foreach (var s in scope.Scopes)
                WriteScope (symbols, s);

            DefineVariables   (symbols, scope.Variables, scope.Start, scope.End) ;
            writer.CloseScope (scope.End);
        }
开发者ID:atykhyy,项目名称:cecil,代码行数:10,代码来源:PdbWriter.cs


示例6: PatchRawMethodBody

        public ByteBuffer PatchRawMethodBody(MethodDefinition method, CodeWriter writer, out MethodSymbols symbols)
        {
            var buffer = new ByteBuffer ();
            symbols = new MethodSymbols (method.Name);

            this.method = method;
            reader.context = method;

            MoveTo (method.RVA);

            var flags = ReadByte ();

            MetadataToken local_var_token;

            switch (flags & 0x3) {
            case 0x2: // tiny
                buffer.WriteByte (flags);
                local_var_token = MetadataToken.Zero;
                symbols.code_size = flags >> 2;
                PatchRawCode (buffer, symbols.code_size, writer);
                break;
            case 0x3: // fat
                base.position--;

                PatchRawFatMethod (buffer, symbols, writer, out local_var_token);
                break;
            default:
                throw new NotSupportedException ();
            }

            var symbol_reader = reader.module.SymbolReader;
            if (symbol_reader != null && writer.metadata.write_symbols) {
                symbols.method_token = GetOriginalToken (writer.metadata, method);
                symbols.local_var_token = local_var_token;
                symbol_reader.Read (symbols);
            }

            return buffer;
        }
开发者ID:bladecoding,项目名称:cecil,代码行数:39,代码来源:CodeReader.cs


示例7: SourceMethodSymbol

 public SourceMethodSymbol(MethodSymbols symbols)
 {
     name = symbols.MethodName;
     token = symbols.MethodToken.ToInt32 ();
 }
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:5,代码来源:MdbWriter.cs


示例8: Write

        public void Write(MethodSymbols symbols)
        {
            var sym_token = new SymbolToken (symbols.MethodToken.ToInt32 ());

            writer.OpenMethod (sym_token);
            DefineSequencePoints (symbols);
            DefineVariables (symbols);
            writer.CloseMethod ();
        }
开发者ID:peterwald,项目名称:cecil,代码行数:9,代码来源:PdbWriter.cs


示例9: ReadLines

        void ReadLines(PdbLines lines, MethodSymbols symbols)
        {
            symbols.Document = GetDocument (lines.file);

            var count = lines.lines.Length;

            symbols.Offsets = new int [count];
            symbols.StartRows = new int [count];
            symbols.StartColumns = new int [count];
            symbols.EndRows = new int [count];
            symbols.EndColumns = new int [count];

            for (int i = 0; i < lines.lines.Length; i++) {
                var line = lines.lines [i];

                symbols.Offsets [i] = (int) line.offset;
                symbols.StartRows [i] = (int) line.lineBegin;
                symbols.StartColumns [i] = line.colBegin;
                symbols.EndRows [i] = (int) line.lineEnd;
                symbols.EndColumns [i] = line.colEnd;
            }
        }
开发者ID:peterwald,项目名称:cecil,代码行数:22,代码来源:PdbReader.cs


示例10: DefineSequencePoints

 void DefineSequencePoints(MethodSymbols symbols)
 {
     writer.DefineSequencePoints (
         GetDocument (symbols.Document),
         symbols.Offsets,
         symbols.StartRows,
         symbols.StartColumns,
         symbols.EndRows,
         symbols.EndColumns);
 }
开发者ID:peterwald,项目名称:cecil,代码行数:10,代码来源:PdbWriter.cs


示例11: DefineVariables

        void DefineVariables(MethodSymbols symbols)
        {
            if (!symbols.HasVariables)
                return;

            var start_offset = 0;
            var end_offset = symbols.CodeSize;

            writer.OpenScope (start_offset);

            var sym_token = new SymbolToken (symbols.LocalVarToken.ToInt32 ());

            var variables = symbols.Variables;
            for (int i = 0; i < variables.Count; i++) {
                var variable = variables [i];
                CreateLocalVariable (variable, sym_token, start_offset, end_offset);
            }

            writer.CloseScope (end_offset);
        }
开发者ID:peterwald,项目名称:cecil,代码行数:20,代码来源:PdbWriter.cs


示例12: ReadScopeAndLocals

        static void ReadScopeAndLocals(PdbScope scope, ScopeSymbol parent, MethodSymbols symbols)
        {
            if (scope == null)
                return;

            ScopeSymbol s = new ScopeSymbol ();
            s.start = (int) scope.offset;
            s.end   = (int)(scope.offset + scope.length);

            if (parent != null)
                parent.Scopes.Add (s);
            else
            if (symbols.scope == null)
                symbols.scope = s;
            else
                throw new InvalidDataException () ;

            foreach (PdbSlot slot in scope.slots) {
                int index = (int) slot.slot;
                if (index < 0 || index >= symbols.Variables.Count)
                    continue;

                VariableDefinition variable = symbols.Variables [index];
                variable.Name = slot.name;

                s.Variables.Add (variable);
            }

            ReadScopeAndLocals (scope.scopes, s, symbols);
        }
开发者ID:atykhyy,项目名称:cecil,代码行数:30,代码来源:PdbReader.cs


示例13: Read

        public void Read(MethodSymbols symbols)
        {
            PdbFunction function;
            if (!functions.TryGetValue (symbols.MethodToken.ToUInt32 (), out function))
                return;

            ReadSequencePoints (function, symbols);
            ReadScopeAndLocals (function.scopes, null, symbols);

            if (!string.IsNullOrEmpty (function.iteratorClass))
                symbols.IteratorType = function.iteratorClass;

            if (function.iteratorScopes != null)
                foreach (Microsoft.Cci.ILocalScope scope in function.iteratorScopes)
                {
                    RangeSymbol range = new RangeSymbol ();
                    range.start = (int) scope.Offset;
                    range.end   = (int)(scope.Offset + scope.Length);
                    symbols.IteratorScopes.Add (range);
                }
        }
开发者ID:atykhyy,项目名称:cecil,代码行数:21,代码来源:PdbReader.cs


示例14: ReadLocalVariables

		static void ReadLocalVariables (MethodEntry entry, MethodSymbols symbols)
		{
			foreach (var local in entry.GetLocals ()) {
				if (local.Index < 0 || local.Index >= symbols.Variables.Count) // Mono 2.6 emits wrong local infos for iterators
					continue;

				var variable = symbols.Variables [local.Index];
				variable.Name = local.Name;
			}
		}
开发者ID:0xb1dd1e,项目名称:cecil,代码行数:10,代码来源:MdbReader.cs


示例15: Read

        public void Read(MethodSymbols symbols)
        {
            PdbFunction function;
            if (!functions.TryGetValue (symbols.MethodToken.ToUInt32 (), out function))
                return;

            ReadSequencePoints (function, symbols);
            ReadLocals (function.scopes, symbols);
        }
开发者ID:rongchunzhang,项目名称:cecil,代码行数:9,代码来源:PdbReader.cs


示例16: PatchRawFatMethod

        void PatchRawFatMethod(ByteBuffer buffer, MethodSymbols symbols, CodeWriter writer, out MetadataToken local_var_token)
        {
            var flags = ReadUInt16 ();
            buffer.WriteUInt16 (flags);
            buffer.WriteUInt16 (ReadUInt16 ());
            symbols.code_size = ReadInt32 ();
            buffer.WriteInt32 (symbols.code_size);
            local_var_token = ReadToken ();

            if (local_var_token.RID > 0) {
                var variables = symbols.variables = ReadVariables (local_var_token);
                buffer.WriteUInt32 (variables != null
                    ? writer.GetStandAloneSignature (symbols.variables).ToUInt32 ()
                    : 0);
            } else
                buffer.WriteUInt32 (0);

            PatchRawCode (buffer, symbols.code_size, writer);

            if ((flags & 0x8) != 0)
                PatchRawSection (buffer, writer.metadata);
        }
开发者ID:bladecoding,项目名称:cecil,代码行数:22,代码来源:CodeReader.cs


示例17: ReadLines

        void ReadLines(PdbLines lines, MethodSymbols symbols)
        {
            for (int i = 0; i < lines.lines.Length; i++) {
                var line = lines.lines [i];

                symbols.Instructions.Add (new InstructionSymbol ((int) line.offset, new SequencePoint (GetDocument (lines.file)) {
                    StartLine = (int) line.lineBegin,
                    StartColumn = (int) line.colBegin,
                    EndLine = (int) line.lineEnd,
                    EndColumn = (int) line.colEnd,
                }));
            }
        }
开发者ID:rongchunzhang,项目名称:cecil,代码行数:13,代码来源:PdbReader.cs


示例18: Write

        public void Write(MethodSymbols symbols)
        {
            var method = new SourceMethodSymbol (symbols);

            var file = GetSourceFile (symbols.Instructions [0].SequencePoint.Document);
            var builder = writer.OpenMethod (file.CompilationUnit, 0, method);
            var count = symbols.Instructions.Count;

            for (int i = 0; i < count; i++) {
                var instruction = symbols.Instructions [i];
                var sequence_point = instruction.SequencePoint;

                builder.MarkSequencePoint (
                    instruction.Offset,
                    GetSourceFile (sequence_point.Document).CompilationUnit.SourceFile,
                    sequence_point.StartLine,
                    sequence_point.EndLine,
                    false);
            }

            if (symbols.HasVariables)
                AddVariables (symbols.Variables);

            writer.CloseMethod ();
        }
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:25,代码来源:MdbWriter.cs


示例19: ReadLocals

 void ReadLocals(PdbScope [] scopes, MethodSymbols symbols)
 {
     foreach (var scope in scopes)
         ReadLocals (scope, symbols);
 }
开发者ID:rongchunzhang,项目名称:cecil,代码行数:5,代码来源:PdbReader.cs


示例20: Write

        public void Write(MethodSymbols symbols)
        {
            if (symbols.instructions.IsNullOrEmpty () && !symbols.HasVariables)
                return;

            var sym_token = new SymbolToken (symbols.MethodToken.ToInt32 ());

            writer.OpenMethod (sym_token);
            DefineSequencePoints (symbols);

            if (symbols.Scope != null)
                WriteScope (symbols, symbols.Scope);
            else
            {
                var start_offset = 0;
                var end_offset = symbols.CodeSize;

                writer.OpenScope  (start_offset);
                DefineVariables   (symbols, symbols.Variables, start_offset, end_offset);
                writer.CloseScope (end_offset);
            }

            if (!string.IsNullOrEmpty (symbols.IteratorType))
                DefineIteratorType   (sym_token, symbols.IteratorType);

            if (symbols.iterator_scopes != null)
                DefineIteratorScopes (sym_token, symbols.IteratorScopes);

            writer.CloseMethod ();
        }
开发者ID:atykhyy,项目名称:cecil,代码行数:30,代码来源:PdbWriter.cs



注:本文中的Mono.Cecil.Cil.MethodSymbols类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Cil.OpCode类代码示例发布时间:2022-05-26
下一篇:
C# Cil.MethodBody类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap