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 (); }
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; }
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 (); }
public void Write(MethodDebugInformation info) { CheckMethodDebugInformationTable(); pdb_metadata.AddMethodDebugInformation(info); }
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); }
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); }
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; }
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); }
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)); } }
void ReadStateMachineKickOffMethod(MethodDebugInformation method_info) { method_info.kickoff_method = debug_reader.ReadStateMachineKickoffMethod (method_info.method); }
void ReadSequencePoints(MethodDebugInformation method_info) { method_info.sequence_points = debug_reader.ReadSequencePoints (method_info.method); }
void ReadScope(MethodDebugInformation method_info) { method_info.scope = debug_reader.ReadScope (method_info.method); }
void ReadCustomDebugInformations(MethodDebugInformation info) { info.method.custom_infos = debug_reader.GetCustomDebugInformation (info.method); }
void WriteScopes(Collection<ScopeDebugInformation> scopes, MethodDebugInformation info) { for (int i = 0; i < scopes.Count; i++) WriteScope (scopes [i], info); }
public void Write(MethodDebugInformation info) { writer.Write(info); }
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; }
public void Write(MethodDebugInformation info) { CheckMethodDebugInformationTable (); pdb_metadata.AddMethodDebugInformation (info); }
public MethodDebugInformation Read(MethodDefinition method) { var info = new MethodDebugInformation (method); ReadSequencePoints (info); ReadScope (info); ReadStateMachineKickOffMethod (info); ReadCustomDebugInformations (info); return info; }
void ReadSequencePoints(MethodDebugInformation method_info) { method_info.sequence_points = debug_reader.ReadSequencePoints(method_info.method); }
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); }
void ReadScope(MethodDebugInformation method_info) { method_info.scope = debug_reader.ReadScope(method_info.method); }
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; }
void ReadStateMachineKickOffMethod(MethodDebugInformation method_info) { method_info.kickoff_method = debug_reader.ReadStateMachineKickoffMethod(method_info.method); }
void ReadLines(PdbLines lines, MethodDebugInformation info) { var document = GetDocument (lines.file); foreach (var line in lines.lines) ReadLine (line, document, info); }
void ReadCustomDebugInformations(MethodDebugInformation info) { info.method.custom_infos = debug_reader.GetCustomDebugInformation(info.method); }
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; }
void WriteRootScope(ScopeDebugInformation scope, MethodDebugInformation info) { WriteScopeVariables (scope); if (scope.HasScopes) WriteScopes (scope.Scopes, info); }