Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > d635a8cd705396ade48f1d2b830a115d > files > 2042

libllvm-devel-8.0.0-1.1.mga7.i586.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>The PDB DBI (Debug Info) Stream &#8212; LLVM 8 documentation</title>
    <link rel="stylesheet" href="../_static/llvm-theme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="The Module Information Stream" href="ModiStream.html" />
    <link rel="prev" title="The PDB TPI Stream" href="TpiStream.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head><body>
<div class="logo">
  <a href="../index.html">
    <img src="../_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="ModiStream.html" title="The Module Information Stream"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="TpiStream.html" title="The PDB TPI Stream"
             accesskey="P">previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="../index.html">Documentation</a>&raquo;</li>

          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The PDB File Format</a> &#187;</li> 
      </ul>
    </div>


    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <div class="section" id="the-pdb-dbi-debug-info-stream">
<h1>The PDB DBI (Debug Info) Stream<a class="headerlink" href="#the-pdb-dbi-debug-info-stream" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#stream-header" id="id2">Stream Header</a></li>
<li><a class="reference internal" href="#substreams" id="id3">Substreams</a><ul>
<li><a class="reference internal" href="#module-info-substream" id="id4">Module Info Substream</a></li>
<li><a class="reference internal" href="#section-contribution-substream" id="id5">Section Contribution Substream</a></li>
<li><a class="reference internal" href="#section-map-substream" id="id6">Section Map Substream</a></li>
<li><a class="reference internal" href="#file-info-substream" id="id7">File Info Substream</a></li>
<li><a class="reference internal" href="#type-server-substream" id="id8">Type Server Substream</a></li>
<li><a class="reference internal" href="#ec-substream" id="id9">EC Substream</a></li>
<li><a class="reference internal" href="#optional-debug-header-stream" id="id10">Optional Debug Header Stream</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="introduction">
<span id="dbi-intro"></span><h2><a class="toc-backref" href="#id1">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>The PDB DBI Stream (Index 3) is one of the largest and most important streams
in a PDB file.  It contains information about how the program was compiled,
(e.g. compilation flags, etc), the compilands (e.g. object files) that
were used to link together the program, the source files which were used
to build the program, as well as references to other streams that contain more
detailed information about each compiland, such as the CodeView symbol records
contained within each compiland and the source and line information for
functions and other symbols within each compiland.</p>
</div>
<div class="section" id="stream-header">
<span id="dbi-header"></span><h2><a class="toc-backref" href="#id2">Stream Header</a><a class="headerlink" href="#stream-header" title="Permalink to this headline">¶</a></h2>
<p>At offset 0 of the DBI Stream is a header with the following layout:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">DbiStreamHeader</span> <span class="p">{</span>
  <span class="kt">int32_t</span> <span class="n">VersionSignature</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">VersionHeader</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">Age</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">GlobalStreamIndex</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">BuildNumber</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">PublicStreamIndex</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">PdbDllVersion</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">SymRecordStream</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">PdbDllRbld</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">ModInfoSize</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">SectionContributionSize</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">SectionMapSize</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">SourceInfoSize</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">TypeServerSize</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">MFCTypeServerIndex</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">OptionalDbgHeaderSize</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">ECSubstreamSize</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">Flags</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">Machine</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">Padding</span><span class="p">;</span>
<span class="p">};</span>
</pre></div>
</div>
<ul class="simple">
<li><strong>VersionSignature</strong> - Unknown meaning.  Appears to always be <code class="docutils literal notranslate"><span class="pre">-1</span></code>.</li>
<li><strong>VersionHeader</strong> - A value from the following enum.</li>
</ul>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">enum</span> <span class="k">class</span> <span class="nc">DbiStreamVersion</span> <span class="o">:</span> <span class="kt">uint32_t</span> <span class="p">{</span>
  <span class="n">VC41</span> <span class="o">=</span> <span class="mi">930803</span><span class="p">,</span>
  <span class="n">V50</span> <span class="o">=</span> <span class="mi">19960307</span><span class="p">,</span>
  <span class="n">V60</span> <span class="o">=</span> <span class="mi">19970606</span><span class="p">,</span>
  <span class="n">V70</span> <span class="o">=</span> <span class="mi">19990903</span><span class="p">,</span>
  <span class="n">V110</span> <span class="o">=</span> <span class="mi">20091201</span>
<span class="p">};</span>
</pre></div>
</div>
<p>Similar to the <a class="reference internal" href="PdbStream.html"><span class="doc">PDB Stream</span></a>, this value always appears to be
<code class="docutils literal notranslate"><span class="pre">V70</span></code>, and it is not clear what the other values are for.</p>
<ul class="simple">
<li><strong>Age</strong> - The number of times the PDB has been written.  Equal to the same
field from the <a class="reference internal" href="PdbStream.html#pdb-stream-header"><span class="std std-ref">PDB Stream header</span></a>.</li>
<li><strong>GlobalStreamIndex</strong> - The index of the <a class="reference internal" href="GlobalStream.html"><span class="doc">Global Symbol Stream</span></a>,
which contains CodeView symbol records for all global symbols.  Actual records
are stored in the symbol record stream, and are referenced from this stream.</li>
<li><strong>BuildNumber</strong> - A bitfield containing values representing the major and minor
version number of the toolchain (e.g. 12.0 for MSVC 2013) used to build the
program, with the following layout:</li>
</ul>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="kt">uint16_t</span> <span class="nl">MinorVersion</span> <span class="p">:</span> <span class="mi">8</span><span class="p">;</span>
<span class="kt">uint16_t</span> <span class="nl">MajorVersion</span> <span class="p">:</span> <span class="mi">7</span><span class="p">;</span>
<span class="kt">uint16_t</span> <span class="nl">NewVersionFormat</span> <span class="p">:</span> <span class="mi">1</span><span class="p">;</span>
</pre></div>
</div>
<p>For the purposes of LLVM, we assume <code class="docutils literal notranslate"><span class="pre">NewVersionFormat</span></code> to be always <code class="docutils literal notranslate"><span class="pre">true</span></code>.
If it is <code class="docutils literal notranslate"><span class="pre">false</span></code>, the layout above does not apply and the reader should consult
the <a class="reference external" href="https://github.com/Microsoft/microsoft-pdb">Microsoft Source Code</a> for
further guidance.</p>
<ul class="simple">
<li><strong>PublicStreamIndex</strong> - The index of the <a class="reference internal" href="PublicStream.html"><span class="doc">Public Symbol Stream</span></a>,
which contains CodeView symbol records for all public symbols.  Actual records
are stored in the symbol record stream, and are referenced from this stream.</li>
<li><strong>PdbDllVersion</strong> - The version number of <code class="docutils literal notranslate"><span class="pre">mspdbXXXX.dll</span></code> used to produce this
PDB.  Note this obviously does not apply for LLVM as LLVM does not use <code class="docutils literal notranslate"><span class="pre">mspdb.dll</span></code>.</li>
<li><strong>SymRecordStream</strong> - The stream containing all CodeView symbol records used
by the program.  This is used for deduplication, so that many different
compilands can refer to the same symbols without having to include the full record
content inside of each module stream.</li>
<li><strong>PdbDllRbld</strong> - Unknown</li>
<li><strong>MFCTypeServerIndex</strong> - The length of the :ref:dbi_mfc_type_server_substream</li>
<li><strong>Flags</strong> - A bitfield with the following layout, containing various
information about how the program was built:</li>
</ul>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="kt">uint16_t</span> <span class="nl">WasIncrementallyLinked</span> <span class="p">:</span> <span class="mi">1</span><span class="p">;</span>
<span class="kt">uint16_t</span> <span class="nl">ArePrivateSymbolsStripped</span> <span class="p">:</span> <span class="mi">1</span><span class="p">;</span>
<span class="kt">uint16_t</span> <span class="nl">HasConflictingTypes</span> <span class="p">:</span> <span class="mi">1</span><span class="p">;</span>
<span class="kt">uint16_t</span> <span class="nl">Reserved</span> <span class="p">:</span> <span class="mi">13</span><span class="p">;</span>
</pre></div>
</div>
<p>The only one of these that is not self-explanatory is <code class="docutils literal notranslate"><span class="pre">HasConflictingTypes</span></code>.
Although undocumented, <code class="docutils literal notranslate"><span class="pre">link.exe</span></code> contains a hidden flag <code class="docutils literal notranslate"><span class="pre">/DEBUG:CTYPES</span></code>.
If it is passed to <code class="docutils literal notranslate"><span class="pre">link.exe</span></code>, this field will be set.  Otherwise it will
not be set.  It is unclear what this flag does, although it seems to have
subtle implications on the algorithm used to look up type records.</p>
<ul class="simple">
<li><strong>Machine</strong> - A value from the <a class="reference external" href="https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx">CV_CPU_TYPE_e</a>
enumeration.  Common values are <code class="docutils literal notranslate"><span class="pre">0x8664</span></code> (x86-64) and <code class="docutils literal notranslate"><span class="pre">0x14C</span></code> (x86).</li>
</ul>
<p>Immediately after the fixed-size DBI Stream header are <code class="docutils literal notranslate"><span class="pre">7</span></code> variable-length
<cite>substreams</cite>.  The following <code class="docutils literal notranslate"><span class="pre">7</span></code> fields of the DBI Stream header specify the
number of bytes of the corresponding substream.  Each substream’s contents will
be described in detail <a class="reference internal" href="#dbi-substreams"><span class="std std-ref">below</span></a>.  The length of the entire
DBI Stream should equal <code class="docutils literal notranslate"><span class="pre">64</span></code> (the length of the header above) plus the value
of each of the following <code class="docutils literal notranslate"><span class="pre">7</span></code> fields.</p>
<ul class="simple">
<li><strong>ModInfoSize</strong> - The length of the <a class="reference internal" href="#dbi-mod-info-substream"><span class="std std-ref">Module Info Substream</span></a>.</li>
<li><strong>SectionContributionSize</strong> - The length of the <a class="reference internal" href="#dbi-sec-contr-substream"><span class="std std-ref">Section Contribution Substream</span></a>.</li>
<li><strong>SectionMapSize</strong> - The length of the <a class="reference internal" href="#dbi-section-map-substream"><span class="std std-ref">Section Map Substream</span></a>.</li>
<li><strong>SourceInfoSize</strong> - The length of the <a class="reference internal" href="#dbi-file-info-substream"><span class="std std-ref">File Info Substream</span></a>.</li>
<li><strong>TypeServerSize</strong> - The length of the <a class="reference internal" href="#dbi-type-server-substream"><span class="std std-ref">Type Server Substream</span></a>.</li>
<li><strong>OptionalDbgHeaderSize</strong> - The length of the <a class="reference internal" href="#dbi-optional-dbg-stream"><span class="std std-ref">Optional Debug Header Stream</span></a>.</li>
<li><strong>ECSubstreamSize</strong> - The length of the <a class="reference internal" href="#dbi-ec-substream"><span class="std std-ref">EC Substream</span></a>.</li>
</ul>
</div>
<div class="section" id="substreams">
<span id="dbi-substreams"></span><h2><a class="toc-backref" href="#id3">Substreams</a><a class="headerlink" href="#substreams" title="Permalink to this headline">¶</a></h2>
<div class="section" id="module-info-substream">
<span id="dbi-mod-info-substream"></span><h3><a class="toc-backref" href="#id4">Module Info Substream</a><a class="headerlink" href="#module-info-substream" title="Permalink to this headline">¶</a></h3>
<p>Begins at offset <code class="docutils literal notranslate"><span class="pre">0</span></code> immediately after the <a class="reference internal" href="#dbi-header"><span class="std std-ref">header</span></a>.  The
module info substream is an array of variable-length records, each one
describing a single module (e.g. object file) linked into the program.  Each
record in the array has the format:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">SectionContribEntry</span> <span class="p">{</span>
  <span class="kt">uint16_t</span> <span class="n">Section</span><span class="p">;</span>
  <span class="kt">char</span> <span class="n">Padding1</span><span class="p">[</span><span class="mi">2</span><span class="p">];</span>
  <span class="kt">int32_t</span> <span class="n">Offset</span><span class="p">;</span>
  <span class="kt">int32_t</span> <span class="n">Size</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">Characteristics</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">ModuleIndex</span><span class="p">;</span>
  <span class="kt">char</span> <span class="n">Padding2</span><span class="p">[</span><span class="mi">2</span><span class="p">];</span>
  <span class="kt">uint32_t</span> <span class="n">DataCrc</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">RelocCrc</span><span class="p">;</span>
<span class="p">};</span>
</pre></div>
</div>
<p>While most of these are self-explanatory, the <code class="docutils literal notranslate"><span class="pre">Characteristics</span></code> field
warrants some elaboration.  It corresponds to the <code class="docutils literal notranslate"><span class="pre">Characteristics</span></code>
field of the <a class="reference external" href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms680341(v=vs.85).aspx">IMAGE_SECTION_HEADER</a>
structure.</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">ModInfo</span> <span class="p">{</span>
  <span class="kt">uint32_t</span> <span class="n">Unused1</span><span class="p">;</span>
  <span class="n">SectionContribEntry</span> <span class="n">SectionContr</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">Flags</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">ModuleSymStream</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">SymByteSize</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">C11ByteSize</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">C13ByteSize</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">SourceFileCount</span><span class="p">;</span>
  <span class="kt">char</span> <span class="n">Padding</span><span class="p">[</span><span class="mi">2</span><span class="p">];</span>
  <span class="kt">uint32_t</span> <span class="n">Unused2</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">SourceFileNameIndex</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">PdbFilePathNameIndex</span><span class="p">;</span>
  <span class="kt">char</span> <span class="n">ModuleName</span><span class="p">[];</span>
  <span class="kt">char</span> <span class="n">ObjFileName</span><span class="p">[];</span>
<span class="p">};</span>
</pre></div>
</div>
<ul class="simple">
<li><strong>SectionContr</strong> - Describes the properties of the section in the final binary
which contain the code and data from this module.</li>
<li><strong>Flags</strong> - A bitfield with the following format:</li>
</ul>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="kt">uint16_t</span> <span class="nl">Dirty</span> <span class="p">:</span> <span class="mi">1</span><span class="p">;</span>  <span class="c1">// ``true`` if this ModInfo has been written since reading the PDB.</span>
<span class="kt">uint16_t</span> <span class="nl">EC</span> <span class="p">:</span> <span class="mi">1</span><span class="p">;</span>     <span class="c1">// ``true`` if EC information is present for this module. It is unknown what EC actually is.</span>
<span class="kt">uint16_t</span> <span class="nl">Unused</span> <span class="p">:</span> <span class="mi">6</span><span class="p">;</span>
<span class="kt">uint16_t</span> <span class="nl">TSM</span> <span class="p">:</span> <span class="mi">8</span><span class="p">;</span>    <span class="c1">// Type Server Index for this module.  It is unknown what this is used for, but it is not used by LLVM.</span>
</pre></div>
</div>
<ul class="simple">
<li><strong>ModuleSymStream</strong> - The index of the stream that contains symbol information
for this module.  This includes CodeView symbol information as well as source
and line information.</li>
<li><strong>SymByteSize</strong> - The number of bytes of data from the stream identified by
<code class="docutils literal notranslate"><span class="pre">ModuleSymStream</span></code> that represent CodeView symbol records.</li>
<li><strong>C11ByteSize</strong> - The number of bytes of data from the stream identified by
<code class="docutils literal notranslate"><span class="pre">ModuleSymStream</span></code> that represent C11-style CodeView line information.</li>
<li><strong>C13ByteSize</strong> - The number of bytes of data from the stream identified by
<code class="docutils literal notranslate"><span class="pre">ModuleSymStream</span></code> that represent C13-style CodeView line information.  At
most one of <code class="docutils literal notranslate"><span class="pre">C11ByteSize</span></code> and <code class="docutils literal notranslate"><span class="pre">C13ByteSize</span></code> will be non-zero.</li>
<li><strong>SourceFileCount</strong> - The number of source files that contributed to this
module during compilation.</li>
<li><strong>SourceFileNameIndex</strong> - The offset in the names buffer of the primary
translation unit used to build this module.  All PDB files observed to date
always have this value equal to 0.</li>
<li><strong>PdbFilePathNameIndex</strong> - The offset in the names buffer of the PDB file
containing this module’s symbol information.  This has only been observed
to be non-zero for the special <code class="docutils literal notranslate"><span class="pre">*</span> <span class="pre">Linker</span> <span class="pre">*</span></code> module.</li>
<li><strong>ModuleName</strong> - The module name.  This is usually either a full path to an
object file (either directly passed to <code class="docutils literal notranslate"><span class="pre">link.exe</span></code> or from an archive) or
a string of the form <code class="docutils literal notranslate"><span class="pre">Import:&lt;dll</span> <span class="pre">name&gt;</span></code>.</li>
<li><strong>ObjFileName</strong> - The object file name.  In the case of an module that is
linked directly passed to <code class="docutils literal notranslate"><span class="pre">link.exe</span></code>, this is the same as <strong>ModuleName</strong>.
In the case of a module that comes from an archive, this is usually the full
path to the archive.</li>
</ul>
</div>
<div class="section" id="section-contribution-substream">
<span id="dbi-sec-contr-substream"></span><h3><a class="toc-backref" href="#id5">Section Contribution Substream</a><a class="headerlink" href="#section-contribution-substream" title="Permalink to this headline">¶</a></h3>
<p>Begins at offset <code class="docutils literal notranslate"><span class="pre">0</span></code> immediately after the <a class="reference internal" href="#dbi-mod-info-substream"><span class="std std-ref">Module Info Substream</span></a> ends,
and consumes <code class="docutils literal notranslate"><span class="pre">Header-&gt;SectionContributionSize</span></code> bytes.  This substream begins
with a single <code class="docutils literal notranslate"><span class="pre">uint32_t</span></code> which will be one of the following values:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">enum</span> <span class="k">class</span> <span class="nc">SectionContrSubstreamVersion</span> <span class="o">:</span> <span class="kt">uint32_t</span> <span class="p">{</span>
  <span class="n">Ver60</span> <span class="o">=</span> <span class="mh">0xeffe0000</span> <span class="o">+</span> <span class="mi">19970605</span><span class="p">,</span>
  <span class="n">V2</span> <span class="o">=</span> <span class="mh">0xeffe0000</span> <span class="o">+</span> <span class="mi">20140516</span>
<span class="p">};</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">Ver60</span></code> is the only value which has been observed in a PDB so far.  Following
this <code class="docutils literal notranslate"><span class="pre">4</span></code> byte field is an array of fixed-length structures.  If the version
is <code class="docutils literal notranslate"><span class="pre">Ver60</span></code>, it is an array of <code class="docutils literal notranslate"><span class="pre">SectionContribEntry</span></code> structures.  If the
version is <code class="docutils literal notranslate"><span class="pre">V2</span></code>, it is an array of <code class="docutils literal notranslate"><span class="pre">SectionContribEntry2</span></code> structures,
defined as follows:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">SectionContribEntry2</span> <span class="p">{</span>
  <span class="n">SectionContribEntry</span> <span class="n">SC</span><span class="p">;</span>
  <span class="kt">uint32_t</span> <span class="n">ISectCoff</span><span class="p">;</span>
<span class="p">};</span>
</pre></div>
</div>
<p>The purpose of the second field is not well understood.</p>
</div>
<div class="section" id="section-map-substream">
<span id="dbi-section-map-substream"></span><h3><a class="toc-backref" href="#id6">Section Map Substream</a><a class="headerlink" href="#section-map-substream" title="Permalink to this headline">¶</a></h3>
<p>Begins at offset <code class="docutils literal notranslate"><span class="pre">0</span></code> immediately after the <a class="reference internal" href="#dbi-sec-contr-substream"><span class="std std-ref">Section Contribution Substream</span></a> ends,
and consumes <code class="docutils literal notranslate"><span class="pre">Header-&gt;SectionMapSize</span></code> bytes.  This substream begins with an <code class="docutils literal notranslate"><span class="pre">8</span></code>
byte header followed by an array of fixed-length records.  The header and records
have the following layout:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">SectionMapHeader</span> <span class="p">{</span>
  <span class="kt">uint16_t</span> <span class="n">Count</span><span class="p">;</span>    <span class="c1">// Number of segment descriptors</span>
  <span class="kt">uint16_t</span> <span class="n">LogCount</span><span class="p">;</span> <span class="c1">// Number of logical segment descriptors</span>
<span class="p">};</span>

<span class="k">struct</span> <span class="n">SectionMapEntry</span> <span class="p">{</span>
  <span class="kt">uint16_t</span> <span class="n">Flags</span><span class="p">;</span>         <span class="c1">// See the SectionMapEntryFlags enum below.</span>
  <span class="kt">uint16_t</span> <span class="n">Ovl</span><span class="p">;</span>           <span class="c1">// Logical overlay number</span>
  <span class="kt">uint16_t</span> <span class="n">Group</span><span class="p">;</span>         <span class="c1">// Group index into descriptor array.</span>
  <span class="kt">uint16_t</span> <span class="n">Frame</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">SectionName</span><span class="p">;</span>   <span class="c1">// Byte index of segment / group name in string table, or 0xFFFF.</span>
  <span class="kt">uint16_t</span> <span class="n">ClassName</span><span class="p">;</span>     <span class="c1">// Byte index of class in string table, or 0xFFFF.</span>
  <span class="kt">uint32_t</span> <span class="n">Offset</span><span class="p">;</span>        <span class="c1">// Byte offset of the logical segment within physical segment.  If group is set in flags, this is the offset of the group.</span>
  <span class="kt">uint32_t</span> <span class="n">SectionLength</span><span class="p">;</span> <span class="c1">// Byte count of the segment or group.</span>
<span class="p">};</span>

<span class="k">enum</span> <span class="k">class</span> <span class="nc">SectionMapEntryFlags</span> <span class="o">:</span> <span class="kt">uint16_t</span> <span class="p">{</span>
  <span class="n">Read</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">0</span><span class="p">,</span>              <span class="c1">// Segment is readable.</span>
  <span class="n">Write</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">1</span><span class="p">,</span>             <span class="c1">// Segment is writable.</span>
  <span class="n">Execute</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">2</span><span class="p">,</span>           <span class="c1">// Segment is executable.</span>
  <span class="n">AddressIs32Bit</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">3</span><span class="p">,</span>    <span class="c1">// Descriptor describes a 32-bit linear address.</span>
  <span class="n">IsSelector</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">8</span><span class="p">,</span>        <span class="c1">// Frame represents a selector.</span>
  <span class="n">IsAbsoluteAddress</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">9</span><span class="p">,</span> <span class="c1">// Frame represents an absolute address.</span>
  <span class="n">IsGroup</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">10</span>           <span class="c1">// If set, descriptor represents a group.</span>
<span class="p">};</span>
</pre></div>
</div>
<p>Many of these fields are not well understood, so will not be discussed further.</p>
</div>
<div class="section" id="file-info-substream">
<span id="dbi-file-info-substream"></span><h3><a class="toc-backref" href="#id7">File Info Substream</a><a class="headerlink" href="#file-info-substream" title="Permalink to this headline">¶</a></h3>
<p>Begins at offset <code class="docutils literal notranslate"><span class="pre">0</span></code> immediately after the <a class="reference internal" href="#dbi-section-map-substream"><span class="std std-ref">Section Map Substream</span></a> ends,
and consumes <code class="docutils literal notranslate"><span class="pre">Header-&gt;SourceInfoSize</span></code> bytes.  This substream defines the mapping
from module to the source files that contribute to that module.  Since multiple
modules can use the same source file (for example, a header file), this substream
uses a string table to store each unique file name only once, and then have each
module use offsets into the string table rather than embedding the string’s value
directly.  The format of this substream is as follows:</p>
<div class="highlight-c++ notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">FileInfoSubstream</span> <span class="p">{</span>
  <span class="kt">uint16_t</span> <span class="n">NumModules</span><span class="p">;</span>
  <span class="kt">uint16_t</span> <span class="n">NumSourceFiles</span><span class="p">;</span>

  <span class="kt">uint16_t</span> <span class="n">ModIndices</span><span class="p">[</span><span class="n">NumModules</span><span class="p">];</span>
  <span class="kt">uint16_t</span> <span class="n">ModFileCounts</span><span class="p">[</span><span class="n">NumModules</span><span class="p">];</span>
  <span class="kt">uint32_t</span> <span class="n">FileNameOffsets</span><span class="p">[</span><span class="n">NumSourceFiles</span><span class="p">];</span>
  <span class="kt">char</span> <span class="n">NamesBuffer</span><span class="p">[][</span><span class="n">NumSourceFiles</span><span class="p">];</span>
<span class="p">};</span>
</pre></div>
</div>
<p><strong>NumModules</strong> - The number of modules for which source file information is
contained within this substream.  Should match the corresponding value from the
ref:<cite>dbi_header</cite>.</p>
<p><strong>NumSourceFiles</strong>: In theory this is supposed to contain the number of source
files for which this substream contains information.  But that would present a
problem in that the width of this field being <code class="docutils literal notranslate"><span class="pre">16</span></code>-bits would prevent one from
having more than 64K source files in a program.  In early versions of the file
format, this seems to have been the case.  In order to support more than this, this
field of the is simply ignored, and computed dynamically by summing up the values of
the <code class="docutils literal notranslate"><span class="pre">ModFileCounts</span></code> array (discussed below).  In short, this value should be
ignored.</p>
<p><strong>ModIndices</strong> - This array is present, but does not appear to be useful.</p>
<p><strong>ModFileCountArray</strong> - An array of <code class="docutils literal notranslate"><span class="pre">NumModules</span></code> integers, each one containing
the number of source files which contribute to the module at the specified index.
While each individual module is limited to 64K contributing source files, the
union of all modules’ source files may be greater than 64K.  The real number of
source files is thus computed by summing this array.  Note that summing this array
does not give the number of <cite>unique</cite> source files, only the total number of source
file contributions to modules.</p>
<p><strong>FileNameOffsets</strong> - An array of <strong>NumSourceFiles</strong> integers (where <strong>NumSourceFiles</strong>
here refers to the 32-bit value obtained from summing <strong>ModFileCountArray</strong>), where
each integer is an offset into <strong>NamesBuffer</strong> pointing to a null terminated string.</p>
<p><strong>NamesBuffer</strong> - An array of null terminated strings containing the actual source
file names.</p>
</div>
<div class="section" id="type-server-substream">
<span id="dbi-type-server-substream"></span><h3><a class="toc-backref" href="#id8">Type Server Substream</a><a class="headerlink" href="#type-server-substream" title="Permalink to this headline">¶</a></h3>
<p>Begins at offset <code class="docutils literal notranslate"><span class="pre">0</span></code> immediately after the <a class="reference internal" href="#dbi-file-info-substream"><span class="std std-ref">File Info Substream</span></a> ends,
and consumes <code class="docutils literal notranslate"><span class="pre">Header-&gt;TypeServerSize</span></code> bytes.  Neither the purpose nor the layout
of this substream is understood, although it is assumed to related somehow to the
usage of <code class="docutils literal notranslate"><span class="pre">/Zi</span></code> and <code class="docutils literal notranslate"><span class="pre">mspdbsrv.exe</span></code>.  This substream will not be discussed further.</p>
</div>
<div class="section" id="ec-substream">
<span id="dbi-ec-substream"></span><h3><a class="toc-backref" href="#id9">EC Substream</a><a class="headerlink" href="#ec-substream" title="Permalink to this headline">¶</a></h3>
<p>Begins at offset <code class="docutils literal notranslate"><span class="pre">0</span></code> immediately after the <a class="reference internal" href="#dbi-type-server-substream"><span class="std std-ref">Type Server Substream</span></a> ends,
and consumes <code class="docutils literal notranslate"><span class="pre">Header-&gt;ECSubstreamSize</span></code> bytes.  Neither the purpose nor the layout
of this substream is understood, and it will not be discussed further.</p>
</div>
<div class="section" id="optional-debug-header-stream">
<span id="dbi-optional-dbg-stream"></span><h3><a class="toc-backref" href="#id10">Optional Debug Header Stream</a><a class="headerlink" href="#optional-debug-header-stream" title="Permalink to this headline">¶</a></h3>
<p>Begins at offset <code class="docutils literal notranslate"><span class="pre">0</span></code> immediately after the <a class="reference internal" href="#dbi-ec-substream"><span class="std std-ref">EC Substream</span></a> ends, and
consumes <code class="docutils literal notranslate"><span class="pre">Header-&gt;OptionalDbgHeaderSize</span></code> bytes.  This field is an array of
stream indices (e.g. <code class="docutils literal notranslate"><span class="pre">uint16_t</span></code>’s), each of which identifies a stream
index in the larger MSF file which contains some additional debug information.
Each position of this array has a special meaning, allowing one to determine
what kind of debug information is at the referenced stream.  <code class="docutils literal notranslate"><span class="pre">11</span></code> indices
are currently understood, although it’s possible there may be more.  The
layout of each stream generally corresponds exactly to a particular type
of debug data directory from the PE/COFF file.  The format of these fields
can be found in the <a class="reference external" href="https://www.microsoft.com/en-us/download/details.aspx?id=19509">Microsoft PE/COFF Specification</a>.</p>
<p><strong>FPO Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[0]</span></code>.  The data in the referenced stream is a
debug data directory of type <code class="docutils literal notranslate"><span class="pre">IMAGE_DEBUG_TYPE_FPO</span></code></p>
<p><strong>Exception Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[1]</span></code>.  The data in the referenced stream
is a debug data directory of type <code class="docutils literal notranslate"><span class="pre">IMAGE_DEBUG_TYPE_EXCEPTION</span></code>.</p>
<p><strong>Fixup Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[2]</span></code>.  The data in the referenced stream is a
debug data directory of type <code class="docutils literal notranslate"><span class="pre">IMAGE_DEBUG_TYPE_FIXUP</span></code>.</p>
<p><strong>Omap To Src Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[3]</span></code>.  The data in the referenced stream
is a debug data directory of type <code class="docutils literal notranslate"><span class="pre">IMAGE_DEBUG_TYPE_OMAP_TO_SRC</span></code>.  This
is used for mapping addresses between instrumented and uninstrumented code.</p>
<p><strong>Omap From Src Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[4]</span></code>.  The data in the referenced stream
is a debug data directory of type <code class="docutils literal notranslate"><span class="pre">IMAGE_DEBUG_TYPE_OMAP_FROM_SRC</span></code>.  This
is used for mapping addresses between instrumented and uninstrumented code.</p>
<p><strong>Section Header Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[5]</span></code>.  A dump of all section headers from
the original executable.</p>
<p><strong>Token / RID Map</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[6]</span></code>.  The layout of this stream is not
understood, but it is assumed to be a mapping from <code class="docutils literal notranslate"><span class="pre">CLR</span> <span class="pre">Token</span></code> to
<code class="docutils literal notranslate"><span class="pre">CLR</span> <span class="pre">Record</span> <span class="pre">ID</span></code>.  Refer to <a class="reference external" href="http://www.ecma-international.org/publications/standards/Ecma-335.htm">ECMA 335</a>
for more information.</p>
<p><strong>Xdata</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[7]</span></code>.  A copy of the <code class="docutils literal notranslate"><span class="pre">.xdata</span></code> section from the
executable.</p>
<p><strong>Pdata</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[8]</span></code>. This is assumed to be a copy of the <code class="docutils literal notranslate"><span class="pre">.pdata</span></code>
section from the executable, but that would make it identical to
<code class="docutils literal notranslate"><span class="pre">DbgStreamArray[1]</span></code>.  The difference between these two indices is not well
understood.</p>
<p><strong>New FPO Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[9]</span></code>.  The data in the referenced stream is a
debug data directory of type <code class="docutils literal notranslate"><span class="pre">IMAGE_DEBUG_TYPE_FPO</span></code>.  It is not clear how this
differs from <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[0]</span></code>, but in practice all observed PDB files have
used the “new” format rather than the “old” format.</p>
<p><strong>Original Section Header Data</strong> - <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[10]</span></code>.  Assumed to be similar
to <code class="docutils literal notranslate"><span class="pre">DbgStreamArray[5]</span></code>, but has not been observed in practice.</p>
</div>
</div>
</div>


          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="ModiStream.html" title="The Module Information Stream"
             >next</a> |</li>
        <li class="right" >
          <a href="TpiStream.html" title="The PDB TPI Stream"
             >previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="../index.html">Documentation</a>&raquo;</li>

          <li class="nav-item nav-item-1"><a href="index.html" >The PDB File Format</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2003-2020, LLVM Project.
      Last updated on 2020-09-07.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.4.
    </div>
  </body>
</html>