Example #1
0
        private static void LoadFuncsFromDbiModule(
            BitAccess bits,
            DbiModuleInfo info,
            Dictionary <int, string> names,
            List <PdbFunction> funcList,
            bool readStrings,
            MsfDirectory dir,
            Dictionary <string, int> nameIndex,
            PdbStreamHelper reader,
            Dictionary <string, PdbSource> sources)
        {
            PdbFunction[] funcs = null;
            bits.Position = 0;
            int sig;

            bits.ReadInt32(out sig);
            if (sig != 4)
            {
                throw new PdbDebugException("Invalid signature. (sig={0})", sig);
            }

            bits.Position = 4;
            // Console.WriteLine("{0}:", info.moduleName);
            funcs = PdbFunction.LoadManagedFunctions( /*info.moduleName,*/
                bits,
                (uint)info.cbSyms,
                readStrings);
            if (funcs != null)
            {
                bits.Position = info.cbSyms + info.cbOldLines;
                LoadManagedLines(
                    funcs,
                    names,
                    bits,
                    dir,
                    nameIndex,
                    reader,
                    (uint)(info.cbSyms + info.cbOldLines + info.cbLines),
                    sources);

                for (int i = 0; i < funcs.Length; i++)
                {
                    funcList.Add(funcs[i]);
                }
            }
        }
Example #2
0
        private static void LoadDbiStream(
            BitAccess bits,
            out DbiModuleInfo[] modules,
            out DbiDbgHdr header,
            bool readStrings)
        {
            DbiHeader dh = new DbiHeader(bits);

            header = new DbiDbgHdr();

            //if (dh.sig != -1 || dh.ver != 19990903) {
            //  throw new PdbException("Unsupported DBI Stream version, sig={0}, ver={1}",
            //                         dh.sig, dh.ver);
            //}

            // Read gpmod section.
            List <DbiModuleInfo> modList = new List <DbiModuleInfo>();
            int end = bits.Position + dh.gpmodiSize;

            while (bits.Position < end)
            {
                DbiModuleInfo mod = new DbiModuleInfo(bits, readStrings);
                modList.Add(mod);
            }

            if (bits.Position != end)
            {
                throw new PdbDebugException(
                          "Error reading DBI stream, pos={0} != {1}",
                          bits.Position,
                          end);
            }

            if (modList.Count > 0)
            {
                modules = modList.ToArray();
            }
            else
            {
                modules = null;
            }

            // Skip the Section Contribution substream.
            bits.Position += dh.secconSize;

            // Skip the Section Map substream.
            bits.Position += dh.secmapSize;

            // Skip the File Info substream.
            bits.Position += dh.filinfSize;

            // Skip the TSM substream.
            bits.Position += dh.tsmapSize;

            // Skip the EC substream.
            bits.Position += dh.ecinfoSize;

            // Read the optional header.
            end = bits.Position + dh.dbghdrSize;
            if (dh.dbghdrSize > 0)
            {
                header = new DbiDbgHdr(bits);
            }

            bits.Position = end;
        }
Example #3
0
        private static void LoadDbiStream(BitAccess bits,
                                  out DbiModuleInfo[] modules,
                                  out DbiDbgHdr header,
                                  bool readStrings)
        {
            DbiHeader dh = new DbiHeader(bits);
            header = new DbiDbgHdr();

            //if (dh.sig != -1 || dh.ver != 19990903) {
            //  throw new PdbException("Unsupported DBI Stream version, sig={0}, ver={1}",
            //                         dh.sig, dh.ver);
            //}

            // Read gpmod section.
            List<DbiModuleInfo> modList = new List<DbiModuleInfo>();
            int end = bits.Position + dh.gpmodiSize;
            while (bits.Position < end)
            {
                DbiModuleInfo mod = new DbiModuleInfo(bits, readStrings);
                modList.Add(mod);
            }
            if (bits.Position != end)
            {
                throw new PdbDebugException("Error reading DBI stream, pos={0} != {1}",
                                            bits.Position, end);
            }

            if (modList.Count > 0)
            {
                modules = modList.ToArray();
            }
            else
            {
                modules = null;
            }

            // Skip the Section Contribution substream.
            bits.Position += dh.secconSize;

            // Skip the Section Map substream.
            bits.Position += dh.secmapSize;

            // Skip the File Info substream.
            bits.Position += dh.filinfSize;

            // Skip the TSM substream.
            bits.Position += dh.tsmapSize;

            // Skip the EC substream.
            bits.Position += dh.ecinfoSize;

            // Read the optional header.
            end = bits.Position + dh.dbghdrSize;
            if (dh.dbghdrSize > 0)
            {
                header = new DbiDbgHdr(bits);
            }
            bits.Position = end;
        }
Example #4
0
        private static void LoadFuncsFromDbiModule(BitAccess bits,
                                           DbiModuleInfo info,
                                           Dictionary<int, string> names,
                                           List<PdbFunction> funcList,
                                           bool readStrings,
                                           MsfDirectory dir,
                                           Dictionary<string, int> nameIndex,
                                           PdbStreamHelper reader,
                                           Dictionary<string, PdbSource> sources)
        {
            PdbFunction[] funcs = null;
            bits.Position = 0;
            int sig;
            bits.ReadInt32(out sig);
            if (sig != 4)
            {
                throw new PdbDebugException("Invalid signature. (sig={0})", sig);
            }

            bits.Position = 4;
            // Console.WriteLine("{0}:", info.moduleName);
            funcs = PdbFunction.LoadManagedFunctions(/*info.moduleName,*/
                                                     bits, (uint)info.cbSyms,
                                                     readStrings);
            if (funcs != null)
            {
                bits.Position = info.cbSyms + info.cbOldLines;
                LoadManagedLines(funcs, names, bits, dir, nameIndex, reader,
                                 (uint)(info.cbSyms + info.cbOldLines + info.cbLines), sources);

                for (int i = 0; i < funcs.Length; i++)
                {
                    funcList.Add(funcs[i]);
                }
            }
        }