diff options
author | Reid Kleckner <rnk@google.com> | 2016-06-03 20:25:09 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-06-03 20:25:09 +0000 |
commit | f27f3f8491dfc7aa41f6cd8a95763acc677d379c (patch) | |
tree | bfcad7e106f02a36e9fb8ae9263614e633a76405 /llvm/lib/Object/COFFObjectFile.cpp | |
parent | 9faa5bcf13748459714fabac98f9109ea8616963 (diff) | |
download | bcm5719-llvm-f27f3f8491dfc7aa41f6cd8a95763acc677d379c.tar.gz bcm5719-llvm-f27f3f8491dfc7aa41f6cd8a95763acc677d379c.zip |
[Symbolize] Check if the PE file has a PDB and emit an error if we can't load it
Summary:
Previously we would try to load PDBs for every PE executable we tried to
symbolize. If that failed, we would fall back to DWARF. If there wasn't
any DWARF, we'd print mostly useless symbol information using the export
table.
With this change, we only try to load PDBs for executables that claim to
have them. If that fails, we can now print an error rather than falling
back silently. This should make it a lot easier to diagnose and fix
common symbolization issues, such as not having DIA or not having a PDB.
Reviewers: zturner, eugenis
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D20982
llvm-svn: 271725
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index 8390edda3bf..28627cd1d42 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -505,6 +505,17 @@ std::error_code COFFObjectFile::getDebugPDBInfo(const debug_directory *DebugDir, return std::error_code(); } +std::error_code COFFObjectFile::getDebugPDBInfo(const debug_pdb_info *&PDBInfo, + StringRef &PDBFileName) const { + for (const debug_directory &D : debug_directories()) + if (D.Type == COFF::IMAGE_DEBUG_TYPE_CODEVIEW) + return getDebugPDBInfo(&D, PDBInfo, PDBFileName); + // If we get here, there is no PDB info to return. + PDBInfo = nullptr; + PDBFileName = StringRef(); + return std::error_code(); +} + // Find the import table. std::error_code COFFObjectFile::initImportTablePtr() { // First, we get the RVA of the import table. If the file lacks a pointer to |