Merge branch 'GP-259_ghizard_PDB-Related_Help_Changes' into Ghidra_9.2

This commit is contained in:
ghidra1
2020-11-03 18:32:13 -05:00
3 changed files with 96 additions and 69 deletions
@@ -12,47 +12,56 @@
<BODY lang="EN-US"> <BODY lang="EN-US">
<H1><A name="Load_PDB_File"></A>Load PDB File</H1> <H1><A name="Load_PDB_File"></A>Load PDB File</H1>
<P>A program database (PDB) file holds debugging and project state information about programs <P>A program database (PDB) file holds debugging and project state information about a program
compiled using a Microsoft compiler and written in <CODE>C/C++</CODE>, <CODE>C#</CODE>, and and can be created in a number of ways. Historically, it has been created using a Microsoft
<CODE>Visual Basic</CODE>. A user generates a PDB file using the <CODE>/ZI or /Zi</CODE> flag compiler and written in <CODE>C/C++</CODE>, <CODE>C#</CODE>, and <CODE>Visual Basic</CODE>.
(for C/C++ programs) or the <CODE>/debug</CODE> flag (for Visual Basic/C# programs).</P> A user generates a PDB file using the <CODE>/ZI or /Zi</CODE> flag (for C/C++ programs) or the
<CODE>/debug</CODE> flag (for Visual Basic/C# programs).</P>
<P>Ghidra uses the <A href="#dia">DIA SDK</A> to read information from the PDB file.&nbsp; <P>There are two mechanisms for processing a PDB file. First, the platform-independent
Therefore, Ghidra can only load *.PDB files while running on Windows platforms. However, while PDB Universal Reader/Analyzer, which can read a raw PDB file and apply it. Its capabilities
on Windows, the user may create *.PDB.XML files that can be loaded on non-Windows platforms. are expected to be expanded in future releases. Second, the legacy capability that uses the
*.PDB.XML files can be created in three different ways: <A href="#dia">DIA SDK</A> to read information from the PDB file. This mechanism can only run
on a Windows platform, however it creates an XML representation of information gleaned using
the DIA SDK. These XML files can be saved and then used on Windows and non-Windows platforms
hosting Ghidra.</P>
<P>If loading a PDB, this should be done prior to other analysis, except in special cases,
such as when only loading data types.</P>
<P>Restricted loading of data types or public symbols is
supported by PDB Universal.</P>
<H2>To Load a PDB</H2>
<BLOCKQUOTE> <BLOCKQUOTE>
<UL> <OL>
<LI>From the Ghidra GUI in Windows, use the <A href="help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm">Ghidra Script Manager</A> <LI>From the menu-bar of a tool, select <B>File <IMG src="../../shared/arrow.gif" alt=""
to run the <I>CreatePdbXmlFilesScript.java</I> script. Follow the prompts to choose width="18" height="14"> Load PDB File</B></LI>
the .PDB file (or directory containing .PDB file(s)) to be converted to .PDB.XML form.
When given a directory, the script recursively traverses all subfolders to find .PDB <LI>In the file chooser, select the PDB file (*.PDB or *.PDB.XML)</LI>
files. A created .PDB.XML file is placed in the same location as the corresponding original
.PDB file.</LI> <LI>Click the "Select PDB" button</LI>
<br> </OL>
<LI>From a Windows command line, navigate to the following directory: <I>&lt;ghidra install root&gt;/support</I>
and run the <I>createPdbXmlFiles.bat</I> script. The script takes one argument representing either <BLOCKQUOTE><UL>
one .PDB file or a directory of .PDB files. When given a directory, the script recursively <LI>PDB Universal is automatically used for *.PDB on non-Windows platforms</LI>
traverses all subdirectories to find .PDB files. A created .PDB.XML file is placed in the <LI>PDB MSDIA is used for *.PDB.XML files</LI>
same location as the corresponding original .PDB file. Sample calls to the script are shown below. </UL></BLOCKQUOTE>
<br><br>
<CODE>&nbsp;&nbsp;&nbsp;&nbsp;createPdbXmlFiles.bat C:\Symbols\samplePdb.pdb</CODE> <P>When a user chooses a PDB or XML file to load for a program, Ghidra will verify its
<br> signature to be valid for the program. At this time, the PDB MSDIA loader cannot be used to
<CODE>&nbsp;&nbsp;&nbsp;&nbsp;createPdbXmlFiles.bat C:\Symbols</CODE> force-load a mismatched PDB. To perform a force-load of a PDB file, the user must choose the
<br> PDB Universal loader if given the option. Force-loading an mismatched file can have
</LI> consequences, such as loading incorrect data types and symbols located at the wrong
<br> addresses.</P>
<LI>Run the included <I>pdb.exe</I> executable (found in the <I>&lt;ghidra install root&gt;/Ghidra/Features/PDB/os/win64</I>
directory) and redirect (save) its output to an XML file as shown below: <P>
<br><br> PDB files may also be loaded using the PDB Analyzer, which is available through
<CODE>&nbsp;&nbsp;&nbsp;&nbsp;pdb.exe samplePdb.pdb > samplePdb.pdb.xml</CODE> <A HREF="help/topics/AutoAnalysisPlugin/AutoAnalysis.htm#Auto_Analyze">Auto Analysis</A> or as
</LI> a <A HREF="help/topics/AutoAnalysisPlugin/AutoAnalysis.htm#Analyze_One_Shot">One Shot Analyzer</A>.
</UL>
</BLOCKQUOTE>
</P> </P>
<P><B>NOTE:</B> Execution of <i>pdb.exe</i> has runtime dependencies which must be satisfied. </BLOCKQUOTE>
Please refer to the <a href="docs/README_PDB.html">README_PDB</a> document for details.</P>
<H2>Information Loaded From PDB</H2> <H2>Information Loaded From PDB</H2>
@@ -76,24 +85,6 @@
</OL> </OL>
</BLOCKQUOTE> </BLOCKQUOTE>
<H2>To Load a PDB</H2>
<BLOCKQUOTE>
<OL>
<LI>From the menu-bar of a tool, select <B>File <IMG src="../../shared/arrow.gif" alt=""
width="18" height="14"> Load PDB File</B></LI>
<LI>In the file chooser, select the PDB file (*.PDB for Windows and *.PDB.XML for other platforms)</LI>
<LI>Click the "Select PDB" button</LI>
</OL>
<P>
PDB files may also be loaded using the PDB Analyzer, which is available through
<A HREF="help/topics/AutoAnalysisPlugin/AutoAnalysis.htm#Auto_Analyze">Auto Analysis</A> or as
a <A HREF="help/topics/AutoAnalysisPlugin/AutoAnalysis.htm#Analyze_One_Shot">One Shot Analyzer</A>.
</P>
</BLOCKQUOTE>
<H2>Loading Errors</H2> <H2>Loading Errors</H2>
<BLOCKQUOTE> <BLOCKQUOTE>
@@ -106,6 +97,44 @@
<P align="center">Figure 1</P> <P align="center">Figure 1</P>
</BLOCKQUOTE> </BLOCKQUOTE>
<H2>The DIA SDK-Based Capability</H2>
<P>*.PDB.XML files can be created in three different ways:
<BLOCKQUOTE><UL>
<LI>From the Ghidra GUI in Windows, use the
<A href="help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm">Ghidra Script Manager</A>
to run the <I>CreatePdbXmlFilesScript.java</I> script. Follow the prompts to choose
the .PDB file (or directory containing .PDB file(s)) to be converted to .PDB.XML form.
When given a directory, the script recursively traverses all subfolders to find .PDB
files. A created .PDB.XML file is placed in the same location as the corresponding original
.PDB file.</LI>
<br>
<LI>From a Windows command line, navigate to the following directory:
<I>&lt;ghidra install root&gt;/support</I>
and run the <I>createPdbXmlFiles.bat</I> script. The script takes one argument representing
either one .PDB file or a directory of .PDB files. When given a directory, the script
recursively traverses all subdirectories to find .PDB files. A created .PDB.XML file is
placed in the same location as the corresponding original .PDB file. Sample calls to the
script are shown below.
<br><br>
<CODE>&nbsp;&nbsp;&nbsp;&nbsp;createPdbXmlFiles.bat C:\Symbols\samplePdb.pdb</CODE>
<br>
<CODE>&nbsp;&nbsp;&nbsp;&nbsp;createPdbXmlFiles.bat C:\Symbols</CODE>
<br>
</LI>
<br>
<LI>Run the included <I>pdb.exe</I> executable (found in the <I>&lt;ghidra install
root&gt;/Ghidra/Features/PDB/os/win64</I> directory) and redirect (save) its output to an
XML file as shown below:
<br><br>
<CODE>&nbsp;&nbsp;&nbsp;&nbsp;pdb.exe samplePdb.pdb > samplePdb.pdb.xml</CODE>
</LI>
</UL></BLOCKQUOTE>
</P>
<P><B>NOTE:</B> Execution of <i>pdb.exe</i> has runtime dependencies which must be satisfied.
Please refer to the <a href="docs/README_PDB.html">README_PDB</a> document for details.</P>
<H2><A name="dia"></A>Debug Interface Access SDK</H2> <H2><A name="dia"></A>Debug Interface Access SDK</H2>
<BLOCKQUOTE> <BLOCKQUOTE>
@@ -122,8 +151,6 @@
you will need to add and register one or more files on your computer. Refer to the you will need to add and register one or more files on your computer. Refer to the
<a href="docs/README_PDB.html">README_PDB</a> document for detailed instructions. <a href="docs/README_PDB.html">README_PDB</a> document for detailed instructions.
</P> </P>
</BLOCKQUOTE> </BLOCKQUOTE>
</BODY> </BODY>
</HTML> </HTML>
@@ -14,9 +14,11 @@
<BODY lang="EN-US"> <BODY lang="EN-US">
<H1>PDB</H1> <H1>PDB</H1>
<P>Ghidra offers the ability to download and apply PDB debug information for Microsoft programs. <P>Ghidra offers the ability to download and apply PDB debug information for programs that run
The <I><A href="download_pdb_file.html">Download PDB File</A></I> feature allows users to download on Microsoft Windows operating systems.
a PDB file that matches the user's current program, given an accessible Symbol Server. The <I><A href="download_pdb_file.html">Download PDB File</A></I> feature allows users to
download and optionally load/apply a PDB file that matches the user's current program, given an
accessible Symbol Server.
The <I><A href="help/topics/ImporterPlugin/load_pdb.html">Load PDB File</A></I> feature The <I><A href="help/topics/ImporterPlugin/load_pdb.html">Load PDB File</A></I> feature
allows users to apply a local PDB file to the current program. The <I>PDB Analyzer</I> also allows users to apply a local PDB file to the current program. The <I>PDB Analyzer</I> also
automatically applies PDB symbols (attempting a search for matching PDB files locally) during automatically applies PDB symbols (attempting a search for matching PDB files locally) during
@@ -151,10 +151,8 @@
<LI>If the download was successful or an existing PDB file was found, you may be asked <LI>If the download was successful or an existing PDB file was found, you may be asked
whether you want to apply the PDB to the program.</LI> whether you want to apply the PDB to the program.</LI>
<P><IMG src="../../shared/note.png" border="0">You will not be asked if you want to <P><IMG src="../../shared/note.png" border="0">If Yes is chosen, see
apply the found file if the file is of type .PDB and you are not on a Windows system. <A href="help/topics/ImporterPlugin/load_pdb.html">Load PDB File</A> for continued help.</P>
This is because .PDB files can only be parsed when running on Windows, while .PDB.XML
files can be parsed on any Operating System.</P>
</OL> </OL>
</BLOCKQUOTE> </BLOCKQUOTE>