상속: DebugInformation
예제 #1
0
파일: PdbWriter.cs 프로젝트: jbevain/cecil
        public void Write(MethodDebugInformation info)
        {
            var method_token = info.method.MetadataToken;
            var sym_token = new SymbolToken (method_token.ToInt32 ());

            writer.OpenMethod (sym_token);

            if (!info.sequence_points.IsNullOrEmpty ())
                DefineSequencePoints (info.sequence_points);

            if (info.scope != null)
                DefineScope (info.scope, info);

            writer.CloseMethod ();
        }
예제 #2
0
파일: MdbReader.cs 프로젝트: jbevain/cecil
        public MethodDebugInformation Read(MethodDefinition method)
        {
            var method_token = method.MetadataToken;
            var entry = symbol_file.GetMethodByToken (method_token.ToInt32	());
            if (entry == null)
                return null;

            var info = new MethodDebugInformation (method);

            var scopes = ReadScopes (entry, info);
            ReadLineNumbers (entry, info);
            ReadLocalVariables (entry, scopes);

            return info;
        }
예제 #3
0
파일: MdbWriter.cs 프로젝트: jbevain/cecil
        public void Write(MethodDebugInformation info)
        {
            var method = new SourceMethod (info.method);

            var sequence_points = info.SequencePoints;
            int count = sequence_points.Count;
            if (count == 0)
                return;

            var offsets = new int [count];
            var start_rows = new int [count];
            var end_rows = new int [count];
            var start_cols = new int [count];
            var end_cols = new int [count];

            SourceFile file;
            Populate (sequence_points, offsets, start_rows, end_rows, start_cols, end_cols, out file);

            var builder = writer.OpenMethod (file.CompilationUnit, 0, method);

            for (int i = 0; i < count; i++) {
                builder.MarkSequencePoint (
                    offsets [i],
                    file.CompilationUnit.SourceFile,
                    start_rows [i],
                    start_cols [i],
                    end_rows [i],
                    end_cols [i],
                    false);
            }

            if (info.scope != null)
                WriteRootScope (info.scope, info);

            writer.CloseMethod ();
        }
예제 #4
0
파일: PortablePdb.cs 프로젝트: pureivan/XIL
        public void Write(MethodDebugInformation info)
        {
            CheckMethodDebugInformationTable();

            pdb_metadata.AddMethodDebugInformation(info);
        }
예제 #5
0
파일: MdbWriter.cs 프로젝트: jbevain/cecil
        void WriteScope(ScopeDebugInformation scope, MethodDebugInformation info)
        {
            writer.OpenScope (scope.Start.Offset);

            WriteScopeVariables (scope);

            if (scope.HasScopes)
                WriteScopes (scope.Scopes, info);

            writer.CloseScope (scope.End.IsEndOfMethod ? info.code_size : scope.End.Offset);
        }
예제 #6
0
파일: PdbReader.cs 프로젝트: jbevain/cecil
        void ReadSequencePoints(PdbFunction function, MethodDebugInformation info)
        {
            if (function.lines == null)
                return;

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

            foreach (PdbLines lines in function.lines)
                ReadLines (lines, info);
        }
예제 #7
0
파일: PdbReader.cs 프로젝트: jbevain/cecil
        static ScopeDebugInformation ReadScopeAndLocals(PdbScope scope, MethodDebugInformation info)
        {
            var parent = new ScopeDebugInformation ();
            parent.Start = new InstructionOffset ((int) scope.offset);
            parent.End = new InstructionOffset ((int) (scope.offset + scope.length));

            if (!scope.slots.IsNullOrEmpty()) {
                parent.variables = new Collection<VariableDebugInformation> (scope.slots.Length);

                foreach (PdbSlot slot in scope.slots) {
                    if (slot.flags == 1) // parameter names
                        continue;

                    var index = (int) slot.slot;
                    var variable = new VariableDebugInformation (index, slot.name);
                    if (slot.flags == 4)
                        variable.IsDebuggerHidden = true;
                    parent.variables.Add (variable);
                }
            }

            if (!scope.constants.IsNullOrEmpty ()) {
                parent.constants = new Collection<ConstantDebugInformation> (scope.constants.Length);

                foreach (var constant in scope.constants) {
                    parent.constants.Add (new ConstantDebugInformation (
                        constant.name,
                        (TypeReference) info.method.Module.LookupToken ((int) constant.token),
                        constant.value));
                }
            }

            parent.scopes = ReadScopeAndLocals (scope.scopes, info);

            return parent;
        }
예제 #8
0
파일: PdbReader.cs 프로젝트: jbevain/cecil
        static void ReadLine(PdbLine line, Document document, MethodDebugInformation info)
        {
            var sequence_point = new SequencePoint ((int) line.offset, document);
            sequence_point.StartLine = (int) line.lineBegin;
            sequence_point.StartColumn = (int) line.colBegin;
            sequence_point.EndLine = (int) line.lineEnd;
            sequence_point.EndColumn = (int) line.colEnd;

            info.sequence_points.Add (sequence_point);
        }
예제 #9
0
파일: MdbReader.cs 프로젝트: jbevain/cecil
        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));
            }
        }
예제 #10
0
 void ReadStateMachineKickOffMethod(MethodDebugInformation method_info)
 {
     method_info.kickoff_method = debug_reader.ReadStateMachineKickoffMethod (method_info.method);
 }
예제 #11
0
 void ReadSequencePoints(MethodDebugInformation method_info)
 {
     method_info.sequence_points = debug_reader.ReadSequencePoints (method_info.method);
 }
예제 #12
0
 void ReadScope(MethodDebugInformation method_info)
 {
     method_info.scope = debug_reader.ReadScope (method_info.method);
 }
예제 #13
0
 void ReadCustomDebugInformations(MethodDebugInformation info)
 {
     info.method.custom_infos = debug_reader.GetCustomDebugInformation (info.method);
 }
예제 #14
0
파일: MdbWriter.cs 프로젝트: jbevain/cecil
 void WriteScopes(Collection<ScopeDebugInformation> scopes, MethodDebugInformation info)
 {
     for (int i = 0; i < scopes.Count; i++)
         WriteScope (scopes [i], info);
 }
예제 #15
0
파일: PortablePdb.cs 프로젝트: pureivan/XIL
 public void Write(MethodDebugInformation info)
 {
     writer.Write(info);
 }
예제 #16
0
파일: MdbReader.cs 프로젝트: jbevain/cecil
        static ScopeDebugInformation[] ReadScopes(MethodEntry entry, MethodDebugInformation info)
        {
            var blocks = entry.GetCodeBlocks ();
            var scopes = new ScopeDebugInformation [blocks.Length + 1];

            info.scope = scopes [0] = new ScopeDebugInformation {
                Start = new InstructionOffset (0),
                End = new InstructionOffset (info.code_size),
            };

            foreach (var block in blocks) {
                if (block.BlockType != CodeBlockEntry.Type.Lexical && block.BlockType != CodeBlockEntry.Type.CompilerGenerated)
                    continue;

                var scope = new ScopeDebugInformation ();
                scope.Start = new InstructionOffset (block.StartOffset);
                scope.End = new InstructionOffset (block.EndOffset);

                scopes [block.Index + 1] = scope;

                if (!AddScope (info.scope.Scopes, scope))
                    info.scope.Scopes.Add (scope);
            }

            return scopes;
        }
예제 #17
0
        public void Write(MethodDebugInformation info)
        {
            CheckMethodDebugInformationTable ();

            pdb_metadata.AddMethodDebugInformation (info);
        }
예제 #18
0
 public MethodDebugInformation Read(MethodDefinition method)
 {
     var info = new MethodDebugInformation (method);
     ReadSequencePoints (info);
     ReadScope (info);
     ReadStateMachineKickOffMethod (info);
     ReadCustomDebugInformations (info);
     return info;
 }
예제 #19
0
파일: PortablePdb.cs 프로젝트: pureivan/XIL
 void ReadSequencePoints(MethodDebugInformation method_info)
 {
     method_info.sequence_points = debug_reader.ReadSequencePoints(method_info.method);
 }
예제 #20
0
파일: PdbWriter.cs 프로젝트: jbevain/cecil
        void DefineScope(ScopeDebugInformation scope, MethodDebugInformation info)
        {
            var start_offset = scope.Start.Offset;
            var end_offset = scope.End.IsEndOfMethod
                ? info.code_size
                : scope.End.Offset;

            writer.OpenScope (start_offset);

            var sym_token = new SymbolToken (info.local_var_token.ToInt32 ());

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

            if (!scope.scopes.IsNullOrEmpty ()) {
                for (int i = 0; i < scope.scopes.Count; i++)
                    DefineScope (scope.scopes [i], info);
            }

            writer.CloseScope (end_offset);
        }
예제 #21
0
파일: PortablePdb.cs 프로젝트: pureivan/XIL
 void ReadScope(MethodDebugInformation method_info)
 {
     method_info.scope = debug_reader.ReadScope(method_info.method);
 }
예제 #22
0
파일: PdbReader.cs 프로젝트: jbevain/cecil
        static Collection<ScopeDebugInformation> ReadScopeAndLocals(PdbScope [] scopes, MethodDebugInformation info)
        {
            var symbols = new Collection<ScopeDebugInformation> (scopes.Length);

            foreach (PdbScope scope in scopes)
                if (scope != null)
                    symbols.Add (ReadScopeAndLocals (scope, info));

            return symbols;
        }
예제 #23
0
파일: PortablePdb.cs 프로젝트: pureivan/XIL
 void ReadStateMachineKickOffMethod(MethodDebugInformation method_info)
 {
     method_info.kickoff_method = debug_reader.ReadStateMachineKickoffMethod(method_info.method);
 }
예제 #24
0
파일: PdbReader.cs 프로젝트: jbevain/cecil
        void ReadLines(PdbLines lines, MethodDebugInformation info)
        {
            var document = GetDocument (lines.file);

            foreach (var line in lines.lines)
                ReadLine (line, document, info);
        }
예제 #25
0
파일: PortablePdb.cs 프로젝트: pureivan/XIL
 void ReadCustomDebugInformations(MethodDebugInformation info)
 {
     info.method.custom_infos = debug_reader.GetCustomDebugInformation(info.method);
 }
예제 #26
0
파일: PdbReader.cs 프로젝트: jbevain/cecil
        public MethodDebugInformation Read(MethodDefinition method)
        {
            var method_token = method.MetadataToken;

            PdbFunction function;
            if (!functions.TryGetValue (method_token.ToUInt32 (), out function))
                return null;

            var symbol = new MethodDebugInformation (method);

            ReadSequencePoints (function, symbol);

            if (!function.scopes.IsNullOrEmpty())
                symbol.scope = ReadScopeAndLocals (function.scopes [0], symbol);

            if (function.scopes.Length > 1) {
                for (int i = 1; i < function.scopes.Length; i++) {
                    var s = ReadScopeAndLocals (function.scopes [i], symbol);
                    if (!AddScope (symbol.scope.Scopes, s))
                        symbol.scope.Scopes.Add (s);
                }
            }

            return symbol;
        }
예제 #27
0
파일: MdbWriter.cs 프로젝트: jbevain/cecil
        void WriteRootScope(ScopeDebugInformation scope, MethodDebugInformation info)
        {
            WriteScopeVariables (scope);

            if (scope.HasScopes)
                WriteScopes (scope.Scopes, info);
        }