xref: /llvm-project/llvm/docs/PDB/ModiStream.rst (revision ae02f6b594e650d19bc823e35f90d832fc890140)
1218ce83fSZachary Turner=====================================
2218ce83fSZachary TurnerThe Module Information Stream
3218ce83fSZachary Turner=====================================
43f0627c5SZachary Turner
53f0627c5SZachary Turner.. contents::
63f0627c5SZachary Turner   :local:
73f0627c5SZachary Turner
83f0627c5SZachary Turner.. _modi_stream_intro:
93f0627c5SZachary Turner
103f0627c5SZachary TurnerIntroduction
113f0627c5SZachary Turner============
123f0627c5SZachary Turner
133f0627c5SZachary TurnerThe Module Info Stream (henceforth referred to as the Modi stream) contains
143f0627c5SZachary Turnerinformation about a single module (object file, import library, etc that
153f0627c5SZachary Turnercontributes to the binary this PDB contains debug information about.  There
163f0627c5SZachary Turneris one modi stream for each module, and the mapping between modi stream index
173f0627c5SZachary Turnerand module is contained in the :doc:`DBI Stream <DbiStream>`.  The modi stream
183f0627c5SZachary Turnerfor a single module contains line information for the compiland, as well as
193f0627c5SZachary Turnerall CodeView information for the symbols defined in the compiland.  Finally,
203f0627c5SZachary Turnerthere is a "global refs" substream which is not well understood.
213f0627c5SZachary Turner
223f0627c5SZachary Turner.. _modi_stream_layout:
233f0627c5SZachary Turner
243f0627c5SZachary TurnerStream Layout
253f0627c5SZachary Turner=============
263f0627c5SZachary Turner
273f0627c5SZachary TurnerA modi stream is laid out as follows:
283f0627c5SZachary Turner
293f0627c5SZachary Turner
303f0627c5SZachary Turner.. code-block:: c++
313f0627c5SZachary Turner
323f0627c5SZachary Turner  struct ModiStream {
333f0627c5SZachary Turner    uint32_t Signature;
343f0627c5SZachary Turner    uint8_t Symbols[SymbolSize-4];
353f0627c5SZachary Turner    uint8_t C11LineInfo[C11Size];
363f0627c5SZachary Turner    uint8_t C13LineInfo[C13Size];
373f0627c5SZachary Turner
383f0627c5SZachary Turner    uint32_t GlobalRefsSize;
393f0627c5SZachary Turner    uint8_t GlobalRefs[GlobalRefsSize];
403f0627c5SZachary Turner  };
413f0627c5SZachary Turner
423f0627c5SZachary Turner- **Signature** - Unknown.  In practice only the value of ``4`` has been
433f0627c5SZachary Turner  observed.  It is hypothesized that this value corresponds to the set of
443f0627c5SZachary Turner  ``CV_SIGNATURE_xx`` defines in ``cvinfo.h``, with the value of ``4``
453f0627c5SZachary Turner  meaning that this module has C13 line information (as opposed to C11 line
463f0627c5SZachary Turner  information).  A corollary of this is that we expect to only ever see
473f0627c5SZachary Turner  C13 line info, and that we do not understand the format of C11 line info.
483f0627c5SZachary Turner
493f0627c5SZachary Turner- **Symbols** - The :ref:`CodeView Symbol Substream <modi_symbol_substream>`.
503f0627c5SZachary Turner  ``SymbolSize`` is equal to the value of ``SymByteSize`` for the
51*ae02f6b5SNico Weber  corresponding module's entry in the :ref:`Module Info Substream
52*ae02f6b5SNico Weber  <dbi_mod_info_substream>` of the :doc:`DBI Stream <DbiStream>`.
533f0627c5SZachary Turner
543f0627c5SZachary Turner- **C11LineInfo** - A block containing CodeView line information in C11
553f0627c5SZachary Turner  format.  ``C11Size`` is equal to the value of ``C11ByteSize`` from the
563f0627c5SZachary Turner  :ref:`Module Info Substream <dbi_mod_info_substream>` of the
573f0627c5SZachary Turner  :doc:`DBI Stream <DbiStream>`.  If this value is ``0``, then C11 line
583f0627c5SZachary Turner  information is not present.  As mentioned previously, the format of
593f0627c5SZachary Turner  C11 line info is not understood and we assume all line in modern PDBs
603f0627c5SZachary Turner  to be in C13 format.
613f0627c5SZachary Turner
623f0627c5SZachary Turner- **C13LineInfo** - A block containing CodeView line information in C13
633f0627c5SZachary Turner  format.  ``C13Size`` is equal to the value of ``C13ByteSize`` from the
643f0627c5SZachary Turner  :ref:`Module Info Substream <dbi_mod_info_substream>` of the
653f0627c5SZachary Turner  :doc:`DBI Stream <DbiStream>`.  If this value is ``0``, then C13 line
663f0627c5SZachary Turner  information is not present.
673f0627c5SZachary Turner
683f0627c5SZachary Turner- **GlobalRefs** - The meaning of this substream is not understood.
693f0627c5SZachary Turner
703f0627c5SZachary Turner.. _modi_symbol_substream:
713f0627c5SZachary Turner
723f0627c5SZachary TurnerThe CodeView Symbol Substream
733f0627c5SZachary Turner=============================
743f0627c5SZachary Turner
753f0627c5SZachary TurnerThe CodeView Symbol Substream.  This is an array of variable length
763f0627c5SZachary Turnerrecords describing the functions, variables, inlining information,
773f0627c5SZachary Turnerand other symbols defined in the compiland.  The entire array consumes
783f0627c5SZachary Turner``SymbolSize-4`` bytes.  The format of a CodeView Symbol Record (and
793f0627c5SZachary Turnerthusly, an array of CodeView Symbol Records) is described in
803f0627c5SZachary Turner:doc:`CodeViewSymbols`.
81