コード例 #1
0
 public DbiModuleInfo(BitAccess bits, bool readStrings)
 {
     bits.ReadInt32(out opened);
     section = new DbiSecCon(bits);
     bits.ReadUInt16(out flags);
     bits.ReadInt16(out stream);
     bits.ReadInt32(out cbSyms);
     bits.ReadInt32(out cbOldLines);
     bits.ReadInt32(out cbLines);
     bits.ReadInt16(out files);
     bits.ReadInt16(out pad1);
     bits.ReadUInt32(out offsets);
     bits.ReadInt32(out niSource);
     bits.ReadInt32(out niCompiler);
     if (readStrings)
     {
         bits.ReadCString(out moduleName);
         bits.ReadCString(out objectName);
     }
     else
     {
         bits.SkipCString(out moduleName);
         bits.SkipCString(out objectName);
     }
     bits.Align(4);
     if (opened != 0 || pad1 != 0)
     {
         throw new PdbException("Invalid DBI module. " +
                                "(opened={0}, pad={1})", opened, pad1);
     }
 }
コード例 #2
0
ファイル: DbiModuleInfo.cs プロジェクト: hesam/SketchSharp
 public DbiModuleInfo(BitAccess bits, bool readStrings)
 {
     bits.ReadInt32(out opened);
     section = new DbiSecCon(bits);
     bits.ReadUInt16(out flags);
     bits.ReadInt16(out stream);
     bits.ReadInt32(out cbSyms);
     bits.ReadInt32(out cbOldLines);
     bits.ReadInt32(out cbLines);
     bits.ReadInt16(out files);
     bits.ReadInt16(out pad1);
     bits.ReadUInt32(out offsets);
     bits.ReadInt32(out niSource);
     bits.ReadInt32(out niCompiler);
     if (readStrings) {
         bits.ReadCString(out moduleName);
         bits.ReadCString(out objectName);
     }
     else {
         bits.SkipCString(out moduleName);
         bits.SkipCString(out objectName);
     }
     bits.Align(4);
     if (opened != 0 || pad1 != 0) {
         throw new PdbException("Invalid DBI module. "+
                                "(opened={0}, pad={1})", opened, pad1);
     }
 }
コード例 #3
0
ファイル: DumpMisc.cs プロジェクト: modulexcite/IL2JS
        static void DumpLines(BitAccess bits,
                              int begin,
                              int limit)
        {
            uint lastAddr = 0;

            // Read the files first
            Console.WriteLine("      Lines:");
            bits.Position = begin;
            while (bits.Position < limit) {
                int sig;
                int siz;
                bits.ReadInt32(out sig);
                bits.ReadInt32(out siz);
                int place = bits.Position;
                int endSym = bits.Position + siz;

                switch ((DEBUG_S_SUBSECTION)sig) {
                    case DEBUG_S_SUBSECTION.FILECHKSMS:
                        int beg = bits.Position;
                        while (bits.Position < endSym) {
                            CV_FileCheckSum chk;
                            int nif = bits.Position - beg;
                            bits.ReadUInt32(out chk.name);
                            bits.ReadUInt8(out chk.len);
                            bits.ReadUInt8(out chk.type);

                            int where = bits.Position;
                            bits.Position += chk.len;
                            bits.Align(4);
                            Console.WriteLine("            nif={0,4}, ni={1,5}, type={2:x2}, len={3}",
                                              nif, chk.name, chk.type, chk.len);
                            Dump(bits.Buffer, where, where + chk.len);
                        }
                        bits.Position = endSym;
                        break;

                    case DEBUG_S_SUBSECTION.LINES:
                        bits.Position = endSym;
                        break;

                    default:
                        Console.WriteLine("            ??? {0}", (DEBUG_S_SUBSECTION)sig);
                        Dump(bits.Buffer, bits.Position, bits.Position + siz);
                        bits.Position = endSym;
                        break;
                }
            }

            // Read the lines next.
            bits.Position = begin;
            while (bits.Position < limit) {
                int sig;
                int siz;
                bits.ReadInt32(out sig);
                bits.ReadInt32(out siz);
                int endSym = bits.Position + siz;

                switch ((DEBUG_S_SUBSECTION)sig) {
                    case DEBUG_S_SUBSECTION.LINES: {
                        CV_LineSection sec;

                        bits.ReadUInt32(out sec.off);
                        bits.ReadUInt16(out sec.sec);
                        bits.ReadUInt16(out sec.flags);
                        bits.ReadUInt32(out sec.cod);
                        Console.WriteLine("          addr={0:x4}:{1:x8}, flg={2:x4}, cod={3,8}",
                                          sec.sec, sec.off, sec.flags, sec.cod);
                        if (sec.off < lastAddr) {
                            throw new PdbDebugException("address {0} follows {1}", sec.off, lastAddr);
                        }
                        else if (sec.off > lastAddr) {
                            lastAddr = sec.off;
                        }

                        while (bits.Position < endSym) {
                            CV_SourceFile file;
                            bits.ReadUInt32(out file.index);
                            bits.ReadUInt32(out file.count);
                            bits.ReadUInt32(out file.linsiz);   // Size of payload.
                            Console.WriteLine("            nif={0,4}, cnt={1,4}",
                                              file.index, file.count);

                            int plin = bits.Position;
                            int pcol = bits.Position + 8 * (int)file.count;

                            //Dump(bits.Buffer, bits.Position, bits.Position + file.linsiz);
                            for (int i = 0; i < file.count; i++) {
                                CV_Line line;
                                CV_Column column = new CV_Column();

                                bits.Position = plin + 8 * i;
                                bits.ReadUInt32(out line.offset);
                                bits.ReadUInt32(out line.flags);

                                uint delta = (line.flags & 0x7f000000) >> 24;
                                bool statement = ((line.flags & 0x80000000) == 0);
                                if ((sec.flags & 1) != 0) {
                                    bits.Position = pcol + 4 * i;
                                    bits.ReadUInt16(out column.offColumnStart);
                                    bits.ReadUInt16(out column.offColumnEnd);
                                }
                                Console.WriteLine("              pc={0:x8} # {1,8}.{2,2}.{3,2}",
                                                  line.offset,
                                                  line.flags & 0xffffff,
                                                  column.offColumnStart,
                                                  column.offColumnEnd);
                            }
                        }
                        break;
                    }
                }
                bits.Position = endSym;
            }
        }
コード例 #4
0
        static void LoadManagedLines(PdbFunction[] funcs,
                                     IntHashTable names,
                                     BitAccess bits,
                                     uint limit)
        {
            Array.Sort(funcs, PdbFunction.byAddress);
            checks.Clear();

            // Read the files first
            int begin = bits.Position;
            while (bits.Position < limit) {
                int sig;
                int siz;
                bits.ReadInt32(out sig);
                bits.ReadInt32(out siz);
                int place = bits.Position;
                int endSym = bits.Position + siz;

                switch ((DEBUG_S_SUBSECTION)sig) {
                    case DEBUG_S_SUBSECTION.FILECHKSMS:
                        while (bits.Position < endSym) {
                            CV_FileCheckSum chk;

                            int ni = bits.Position - place;
                            bits.ReadUInt32(out chk.name);
                            bits.ReadUInt8(out chk.len);
                            bits.ReadUInt8(out chk.type);

                            string name = (string)names[(int)chk.name];
                            PdbSource src = new PdbSource((uint)ni, name);
                            checks.Add(ni, src);
                            bits.Position += chk.len;
                            bits.Align(4);
                        }
                        bits.Position = endSym;
                        break;

                    default:
                        bits.Position = endSym;
                        break;
                }
            }

            // Read the lines next.
            bits.Position = begin;
            while (bits.Position < limit) {
                int sig;
                int siz;
                bits.ReadInt32(out sig);
                bits.ReadInt32(out siz);
                int endSym = bits.Position + siz;

                switch ((DEBUG_S_SUBSECTION)sig) {
                    case DEBUG_S_SUBSECTION.LINES: {
                        CV_LineSection sec;

                        bits.ReadUInt32(out sec.off);
                        bits.ReadUInt16(out sec.sec);
                        bits.ReadUInt16(out sec.flags);
                        bits.ReadUInt32(out sec.cod);
                        PdbFunction func = FindFunction(funcs, sec.sec, sec.off);

                        // Count the line blocks.
                        int begSym = bits.Position;
                        int blocks = 0;
                        while (bits.Position < endSym) {
                            CV_SourceFile file;
                            bits.ReadUInt32(out file.index);
                            bits.ReadUInt32(out file.count);
                            bits.ReadUInt32(out file.linsiz);   // Size of payload.
                            int linsiz = (int)file.count * (8 + ((sec.flags & 1) != 0 ? 4 : 0));
                            bits.Position += linsiz;
                            blocks++;
                        }

                        func.lines = new PdbLines[blocks];
                        int block = 0;

                        bits.Position = begSym;
                        while (bits.Position < endSym) {
                            CV_SourceFile file;
                            bits.ReadUInt32(out file.index);
                            bits.ReadUInt32(out file.count);
                            bits.ReadUInt32(out file.linsiz);   // Size of payload.

                            PdbSource src = (PdbSource)checks[(int)file.index];
                            PdbLines tmp = new PdbLines(src, file.count);
                            func.lines[block++] = tmp;
                            PdbLine[] lines = tmp.lines;

                            int plin = bits.Position;
                            int pcol = bits.Position + 8 * (int)file.count;

                            for (int i = 0; i < file.count; i++) {
                                CV_Line line;
                                CV_Column column = new CV_Column();

                                bits.Position = plin + 8 * i;
                                bits.ReadUInt32(out line.offset);
                                bits.ReadUInt32(out line.flags);

                                uint delta = (line.flags & 0x7f000000) >> 24;
                                bool statement = ((line.flags & 0x80000000) == 0);
                                if ((sec.flags & 1) != 0) {
                                    bits.Position = pcol + 4 * i;
                                    bits.ReadUInt16(out column.offColumnStart);
                                    bits.ReadUInt16(out column.offColumnEnd);
                                }

                                lines[i] = new PdbLine(line.offset,
                                                       line.flags & 0xffffff,
                                                       column.offColumnStart,
                                                       column.offColumnEnd);
                            }
                        }
                        break;
                    }
                }
                bits.Position = endSym;
            }
        }