コード例 #1
0
ファイル: Utils.cs プロジェクト: baulig/debugger
        public static void DumpLineNumberTable(TextWriter writer, MonoSymbolFile file,
							Cecil.MethodDefinition mdef, C.MethodEntry entry)
        {
            try {
                DumpLineNumberTable_internal (writer, file, mdef, entry);
            } catch (Exception ex) {
                writer.WriteLine ("DUMP LNT EX: {0}", ex);
            }
        }
コード例 #2
0
            public MonoSourceFile(DebuggerSession session, Module module,
					       C.SourceFileEntry file, string path)
                : base(session, module, path)
            {
                this.file = file;
            }
コード例 #3
0
            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;
            }
コード例 #4
0
            public MonoMethodLineNumberTable(MonoSymbolFile file, MonoMethod method,
							  MethodSource source, C.MethodEntry entry,
							  JitLineNumberEntry[] jit_lnt)
                : base(file, method)
            {
                this.method = method;
                this.entry = entry;
                this.line_numbers = jit_lnt;
            }
コード例 #5
0
            public MonoMethod(MonoSymbolFile file, MethodSource source, int domain,
					   C.MethodEntry method, Cecil.MethodDefinition mdef)
                : base(source.Name, file.ImageFile, file.Module)
            {
                this.file = file;
                this.source = source;
                this.domain = domain;
                this.method = method;
                this.mdef = mdef;

                foreach (Cecil.CustomAttribute cattr in mdef.CustomAttributes) {
                    string cname = cattr.Constructor.DeclaringType.FullName;
                    if ((cname == "System.Diagnostics.DebuggerHiddenAttribute") ||
                        (cname == "System.Runtime.CompilerServices.CompilerGeneratedAttribute"))
                        is_compiler_generated = true;
                }
            }
コード例 #6
0
            public static MonoCodeBlock[] CreateBlocks(MonoMethod method,
								    MethodAddress address,
								    C.CodeBlockEntry[] the_blocks,
								    out List<MonoCodeBlock> root_blocks)
            {
                MonoCodeBlock[] blocks = new MonoCodeBlock [the_blocks.Length];
                for (int i = 0; i < blocks.Length; i++) {
                    Block.Type type = (Block.Type) the_blocks [i].BlockType;
                    int start = find_address (address, the_blocks [i].StartOffset);
                    int end = find_address (address, the_blocks [i].EndOffset);
                    blocks [i] = new MonoCodeBlock (i, type, start, end);
                }

                root_blocks = new List<MonoCodeBlock> ();

                for (int i = 0; i < blocks.Length; i++) {
                    if (the_blocks [i].Parent < 0)
                        root_blocks.Add (blocks [i]);
                    else {
                        MonoCodeBlock parent = blocks [the_blocks [i].Parent - 1];
                        blocks [i].Parent = parent;
                        parent.AddChildBlock (blocks [i]);
                    }
                }

                return blocks;
            }
コード例 #7
0
ファイル: Utils.cs プロジェクト: baulig/debugger
        static void DumpLineNumberTable_internal(TextWriter writer, MonoSymbolFile file,
							  Cecil.MethodDefinition mdef, C.MethodEntry entry)
        {
            string full_name = MonoSymbolFile.GetMethodName (mdef);
            if (mdef.MetadataToken.TokenType != Cecil.Metadata.TokenType.Method) {
                writer.WriteLine ("UNKNOWN METHOD: {0}", full_name);
                return;
            }

            writer.WriteLine ();
            writer.WriteLine ("Symfile Line Numbers (file / row / offset):");
            writer.WriteLine ("-------------------------------------------");

            C.LineNumberEntry[] lnt;
            lnt = entry.GetLineNumberTable ().LineNumbers;
            for (int i = 0; i < lnt.Length; i++) {
                C.LineNumberEntry lne = lnt [i];

                writer.WriteLine ("{0,4} {1,4} {2,4} {3,4:x}{4}", i,
                          lne.File, lne.Row, lne.Offset,
                          lne.IsHidden ? " (hidden)" : "");
            }

            writer.WriteLine ("-------------------------------------------");
            writer.WriteLine ();

            List<string> lines;
            Dictionary<int,int> offsets;

            if (!DisassembleMethod_internal (file.ImageFile, (int) mdef.MetadataToken.RID, out lines, out offsets)) {
                writer.WriteLine ("Cannot disassemble method: {0}", full_name);
                return;
            }

            writer.WriteLine ("Disassembling {0}:\n\n{1}\n", full_name, String.Join ("\n", lines.ToArray ()));
        }