Sophie

Sophie

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

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 Info Stream (aka the PDB 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 PDB TPI Stream" href="TpiStream.html" />
    <link rel="prev" title="The MSF File Format" href="MsfFile.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="TpiStream.html" title="The PDB TPI Stream"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="MsfFile.html" title="The MSF File Format"
             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-info-stream-aka-the-pdb-stream">
<h1>The PDB Info Stream (aka the PDB Stream)<a class="headerlink" href="#the-pdb-info-stream-aka-the-pdb-stream" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#stream-header" id="id1">Stream Header</a></li>
<li><a class="reference internal" href="#matching-a-pdb-to-its-executable" id="id2">Matching a PDB to its executable</a></li>
</ul>
</div>
<div class="section" id="stream-header">
<span id="pdb-stream-header"></span><h2><a class="toc-backref" href="#id1">Stream Header</a><a class="headerlink" href="#stream-header" title="Permalink to this headline">¶</a></h2>
<p>At offset 0 of the PDB 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">PdbStreamHeader</span> <span class="p">{</span>
  <span class="n">ulittle32_t</span> <span class="n">Version</span><span class="p">;</span>
  <span class="n">ulittle32_t</span> <span class="n">Signature</span><span class="p">;</span>
  <span class="n">ulittle32_t</span> <span class="n">Age</span><span class="p">;</span>
  <span class="n">Guid</span> <span class="n">UniqueId</span><span class="p">;</span>
<span class="p">};</span>
</pre></div>
</div>
<ul class="simple">
<li><strong>Version</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">PdbStreamVersion</span> <span class="o">:</span> <span class="kt">uint32_t</span> <span class="p">{</span>
  <span class="n">VC2</span> <span class="o">=</span> <span class="mi">19941610</span><span class="p">,</span>
  <span class="n">VC4</span> <span class="o">=</span> <span class="mi">19950623</span><span class="p">,</span>
  <span class="n">VC41</span> <span class="o">=</span> <span class="mi">19950814</span><span class="p">,</span>
  <span class="n">VC50</span> <span class="o">=</span> <span class="mi">19960307</span><span class="p">,</span>
  <span class="n">VC98</span> <span class="o">=</span> <span class="mi">19970604</span><span class="p">,</span>
  <span class="n">VC70Dep</span> <span class="o">=</span> <span class="mi">19990604</span><span class="p">,</span>
  <span class="n">VC70</span> <span class="o">=</span> <span class="mi">20000404</span><span class="p">,</span>
  <span class="n">VC80</span> <span class="o">=</span> <span class="mi">20030901</span><span class="p">,</span>
  <span class="n">VC110</span> <span class="o">=</span> <span class="mi">20091201</span><span class="p">,</span>
  <span class="n">VC140</span> <span class="o">=</span> <span class="mi">20140508</span><span class="p">,</span>
<span class="p">};</span>
</pre></div>
</div>
<p>While the meaning of this field appears to be obvious, in practice we have
never observed a value other than <code class="docutils literal notranslate"><span class="pre">VC70</span></code>, even with modern versions of
the toolchain, and it is unclear why the other values exist.  It is assumed
that certain aspects of the PDB stream’s layout, and perhaps even that of
the other streams, will change if the value is something other than <code class="docutils literal notranslate"><span class="pre">VC70</span></code>.</p>
<ul class="simple">
<li><strong>Signature</strong> - A 32-bit time-stamp generated with a call to <code class="docutils literal notranslate"><span class="pre">time()</span></code> at
the time the PDB file is written.  Note that due to the inherent uniqueness
problems of using a timestamp with 1-second granularity, this field does not
really serve its intended purpose, and as such is typically ignored in favor
of the <code class="docutils literal notranslate"><span class="pre">Guid</span></code> field, described below.</li>
<li><strong>Age</strong> - The number of times the PDB file has been written.  This can be used
along with <code class="docutils literal notranslate"><span class="pre">Guid</span></code> to match the PDB to its corresponding executable.</li>
<li><strong>Guid</strong> - A 128-bit identifier guaranteed to be unique across space and time.
In general, this can be thought of as the result of calling the Win32 API
<a class="reference external" href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa379205(v=vs.85).aspx">UuidCreate</a>,
although LLVM cannot rely on that, as it must work on non-Windows platforms.</li>
</ul>
</div>
<div class="section" id="matching-a-pdb-to-its-executable">
<h2><a class="toc-backref" href="#id2">Matching a PDB to its executable</a><a class="headerlink" href="#matching-a-pdb-to-its-executable" title="Permalink to this headline">¶</a></h2>
<p>The linker is responsible for writing both the PDB and the final executable, and
as a result is the only entity capable of writing the information necessary to
match the PDB to the executable.</p>
<p>In order to accomplish this, the linker generates a guid for the PDB (or
re-uses the existing guid if it is linking incrementally) and increments the Age
field.</p>
<p>The executable is a PE/COFF file, and part of a PE/COFF file is the presence of
number of “directories”.  For our purposes here, we are interested in the “debug
directory”.  The exact format of a debug directory is described by the
<a class="reference external" href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms680307(v=vs.85).aspx">IMAGE_DEBUG_DIRECTORY structure</a>.
For this particular case, the linker emits a debug directory of type
<code class="docutils literal notranslate"><span class="pre">IMAGE_DEBUG_TYPE_CODEVIEW</span></code>.  The format of this record is defined in
<code class="docutils literal notranslate"><span class="pre">llvm/DebugInfo/CodeView/CVDebugRecord.h</span></code>, but it suffices to say here only
that it includes the same <code class="docutils literal notranslate"><span class="pre">Guid</span></code> and <code class="docutils literal notranslate"><span class="pre">Age</span></code> fields.  At runtime, a
debugger or tool can scan the COFF executable image for the presence of
a debug directory of the correct type and verify that the Guid and Age match.</p>
</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="TpiStream.html" title="The PDB TPI Stream"
             >next</a> |</li>
        <li class="right" >
          <a href="MsfFile.html" title="The MSF File Format"
             >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>