Writes PDB files
예제 #1
0
파일: PERWAPI.cs 프로젝트: nomit007/f4
        /*----------------------------- Writing -----------------------------------------*/
        private void InitPEWriter(PEFileVersionInfo verInfo, MetaDataOut md, bool writePDB, string fileName)
        {
            this.verInfo = verInfo;
            if (!verInfo.fromExisting)
                verInfo.lMajor = MetaData.LMajors[(int)verInfo.netVersion];
            if (verInfo.isDLL) {
                hintNameTable = FileImage.dllHintNameTable.ToCharArray();
                if (!verInfo.fromExisting) verInfo.characteristics = FileImage.dllCharacteristics;
            } else {
                hintNameTable = FileImage.exeHintNameTable.ToCharArray();
                if (!verInfo.fromExisting) verInfo.characteristics = FileImage.exeCharacteristics;
            }
            text = new Section(FileImage.textName,0x60000020);     // IMAGE_SCN_CNT  CODE, EXECUTE, READ
            //      rsrc = new Section(rsrcName,0x40000040);     // IMAGE_SCN_CNT  INITIALIZED_DATA, READ
            metaData = md;
            metaData.InitMetaDataOut(this);

            // Check if we should include a PDB file
            if (writePDB) {

                // Work out the PDB filename from the PE files filename
                if ((fileName == null) || (fileName == "")) fileName = "default";

                // Setup the PDB Writer object
                pdbWriter = new PDBWriter(fileName);

                // Set the amount of space required for the debug information
                debugBytesSize += pdbWriter.PDBFilename.Length;

            }
        }
예제 #2
0
파일: PERWAPI.cs 프로젝트: nomit007/f4
        internal void WriteLocals(PDBWriter writer)
        {
            try {

             Local[] locals = _thisMeth.GetLocals();

             foreach (LocalBinding binding in _localBindings) {
                 writer.BindLocal(binding._name, binding._index, _thisMeth.locToken,0,0);
             }
             } catch (Exception e) {
             throw new Exception("Exception while writing debug info for: " +
                 this._thisMeth.NameString()+"\r\n"+e.ToString(),e);
             }
        }