PdbWriter(PdbState pdbState, MetaData metaData) { this.pdbState = pdbState; this.metaData = metaData; this.module = metaData.Module; this.instrToOffset = new Dictionary <Instruction, uint>(); this.customDebugInfoWriterContext = new PdbCustomDebugInfoWriterContext(); this.localsEndScopeIncValue = pdbState.GetCompiler(metaData.module) == Compiler.VisualBasic ? 1 : 0; }
PdbCustomDebugInfoWriter(MetaData metaData, MethodDef method, PdbCustomDebugInfoWriterContext context) { this.metaData = metaData; this.method = method; this.logger = context.Logger; this.memoryStream = context.MemoryStream; this.writer = context.Writer; this.instructionToOffsetDict = context.InstructionToOffsetDict; this.bodySize = 0; this.instructionToOffsetDictInitd = false; memoryStream.SetLength(0); memoryStream.Position = 0; }
/// <summary> /// Returns the raw custom debug info or null if there was an error /// </summary> /// <param name="metaData">Metadata</param> /// <param name="context">Writer context</param> /// <param name="method">Method</param> /// <param name="customDebugInfos">Custom debug infos to write</param> /// <returns></returns> public static byte[] Write(MetaData metaData, MethodDef method, PdbCustomDebugInfoWriterContext context, IList <PdbCustomDebugInfo> customDebugInfos) { var writer = new PdbCustomDebugInfoWriter(metaData, method, context); return(writer.Write(customDebugInfos)); }