internal virtual void EmitLocalSymInfo(ISymbolWriter symWriter) { int num; for (num = 0; num < this.m_iLocalSymCount; num++) { symWriter.DefineLocalVariable(this.m_strName[num], FieldAttributes.PrivateScope, this.m_ubSignature[num], SymAddressKind.ILOffset, this.m_iLocalSlot[num], 0, 0, this.m_iStartOffset[num], this.m_iEndOffset[num]); } for (num = 0; num < this.m_iNameSpaceCount; num++) { symWriter.UsingNamespace(this.m_namespace[num]); } }
internal virtual void EmitLocalSymInfo(ISymbolWriter symWriter) { int i; for (i = 0; i < m_iLocalSymCount; i++) { symWriter.DefineLocalVariable( m_strName[i], FieldAttributes.PrivateScope, // @todo: What is local variable attributes??? m_ubSignature[i], SymAddressKind.ILOffset, m_iLocalSlot[i], 0, // addr2 is not used yet 0, // addr3 is not used m_iStartOffset[i], m_iEndOffset[i]); } for (i = 0; i < m_iNameSpaceCount; i++) { symWriter.UsingNamespace(m_namespace[i]); } }
internal virtual void EmitLocalSymInfo(ISymbolWriter symWriter) { int i; for (i = 0; i < m_iLocalSymCount; i ++) { symWriter.DefineLocalVariable( m_strName[i], FieldAttributes.PrivateScope, m_ubSignature[i], SymAddressKind.ILOffset, m_iLocalSlot[i], 0, // addr2 is not used yet 0, // addr3 is not used m_iStartOffset[i], m_iEndOffset[i]); } for (i = 0; i < m_iNameSpaceCount; i ++) { symWriter.UsingNamespace(m_namespace[i]); } }
void CreateScopes(MethodBody body, ScopeCollection scopes) { foreach (Scope s in scopes) { int startOffset = s.Start.Offset; int endOffset = s.End == body.Instructions.Outside ? body.Instructions[body.Instructions.Count - 1].Offset + 1 : s.End.Offset; m_writer.OpenScope(startOffset); m_writer.UsingNamespace(body.Method.DeclaringType.Namespace); m_writer.OpenNamespace(body.Method.DeclaringType.Namespace); int start = Math.Max(0, body.Instructions.IndexOf(s.Start)); int end = s.End == body.Instructions.Outside ? body.Instructions.Count - 1 : body.Instructions.IndexOf(s.End); ArrayList instructions = new ArrayList(); for (int i = start; i <= end; i++) { if (body.Instructions[i] != null && body.Instructions[i].SequencePoint != null) { instructions.Add(body.Instructions [i]); } } Document doc = null; int [] offsets = new int [instructions.Count]; int [] startRows = new int [instructions.Count]; int [] startCols = new int [instructions.Count]; int [] endRows = new int [instructions.Count]; int [] endCols = new int [instructions.Count]; for (int i = 0; i < instructions.Count; i++) { Instruction instr = (Instruction)instructions [i]; offsets [i] = instr.Offset; if (doc == null) { doc = instr.SequencePoint.Document; } startRows [i] = instr.SequencePoint.StartLine; startCols [i] = instr.SequencePoint.StartColumn; endRows [i] = instr.SequencePoint.EndLine; endCols [i] = instr.SequencePoint.EndColumn; } if (doc != null) { m_writer.DefineSequencePoints(GetDocument(doc), offsets, startRows, startCols, endRows, endCols); } // Cecil PDB writer does not yet write the variable names. // This is not yet implemented. // TODO local variable support //CreateLocalVariable (s, startOffset, endOffset); //CreateScopes (body, s.Scopes); m_writer.CloseNamespace(); m_writer.CloseScope(endOffset); } }