Beispiel #1
0
        /// <summary>
        /// </summary>
        /// <param name="bits">
        /// </param>
        /// <param name="modules">
        /// </param>
        /// <param name="header">
        /// </param>
        /// <param name="readStrings">
        /// </param>
        /// <exception cref="PdbException">
        /// </exception>
        /// <exception cref="PdbDebugException">
        /// </exception>
        private static void LoadDbiStream(BitAccess bits, out DbiModuleInfo[] modules, out DbiDbgHdr header, bool readStrings)
        {
            var 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.
            var modList = new ArrayList();
            var end     = bits.Position + dh.gpmodiSize;

            while (bits.Position < end)
            {
                var 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 = (DbiModuleInfo[])modList.ToArray(typeof(DbiModuleInfo));
            }
            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;
        }
Beispiel #2
0
        /// <summary>
        /// </summary>
        /// <param name="bits">
        /// </param>
        /// <param name="info">
        /// </param>
        /// <param name="names">
        /// </param>
        /// <param name="funcList">
        /// </param>
        /// <param name="readStrings">
        /// </param>
        /// <param name="dir">
        /// </param>
        /// <param name="nameIndex">
        /// </param>
        /// <param name="reader">
        /// </param>
        /// <exception cref="PdbDebugException">
        /// </exception>
        private static void LoadFuncsFromDbiModule(
            BitAccess bits,
            DbiModuleInfo info,
            IntHashTable names,
            ArrayList funcList,
            bool readStrings,
            MsfDirectory dir,
            Dictionary <string, int> nameIndex,
            PdbReader reader)
        {
            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));

                for (var i = 0; i < funcs.Length; i++)
                {
                    funcList.Add(funcs[i]);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// </summary>
        /// <param name="bits">
        /// </param>
        /// <param name="info">
        /// </param>
        /// <param name="names">
        /// </param>
        /// <param name="funcList">
        /// </param>
        /// <param name="readStrings">
        /// </param>
        /// <param name="dir">
        /// </param>
        /// <param name="nameIndex">
        /// </param>
        /// <param name="reader">
        /// </param>
        /// <exception cref="PdbDebugException">
        /// </exception>
        private static void LoadFuncsFromDbiModule(
            BitAccess bits, 
            DbiModuleInfo info, 
            IntHashTable names, 
            ArrayList funcList, 
            bool readStrings, 
            MsfDirectory dir, 
            Dictionary<string, int> nameIndex, 
            PdbReader reader)
        {
            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));

                for (var i = 0; i < funcs.Length; i++)
                {
                    funcList.Add(funcs[i]);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// </summary>
        /// <param name="bits">
        /// </param>
        /// <param name="modules">
        /// </param>
        /// <param name="header">
        /// </param>
        /// <param name="readStrings">
        /// </param>
        /// <exception cref="PdbException">
        /// </exception>
        /// <exception cref="PdbDebugException">
        /// </exception>
        private static void LoadDbiStream(BitAccess bits, out DbiModuleInfo[] modules, out DbiDbgHdr header, bool readStrings)
        {
            var 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.
            var modList = new ArrayList();
            var end = bits.Position + dh.gpmodiSize;
            while (bits.Position < end)
            {
                var 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 = (DbiModuleInfo[])modList.ToArray(typeof(DbiModuleInfo));
            }
            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;
        }