summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/DIA
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-04-24 17:47:24 +0000
committerZachary Turner <zturner@google.com>2017-04-24 17:47:24 +0000
commit1690164cac96cf3670f380a74b27443c71b6a32e (patch)
tree199cc2fd16d66ae9664d50afbfdf01eb536276a5 /llvm/lib/DebugInfo/PDB/DIA
parentcadadabb7664407be7553363e1a580f92d681548 (diff)
downloadbcm5719-llvm-1690164cac96cf3670f380a74b27443c71b6a32e.tar.gz
bcm5719-llvm-1690164cac96cf3670f380a74b27443c71b6a32e.zip
[llvm-pdbdump] Re-write the record layout code to be more resilient.
This reworks the way virtual bases are handled, and also the way padding is detected across multiple levels of aggregates, producing a much more accurate result. llvm-svn: 301203
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/DIA')
-rw-r--r--llvm/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp5
-rw-r--r--llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp17
2 files changed, 17 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
index 5e8c0bdc171..4e2474c51cb 100644
--- a/llvm/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
+++ b/llvm/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
@@ -14,6 +14,7 @@
#include "llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h"
#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
@@ -720,7 +721,7 @@ uint32_t DIARawSymbol::getVirtualTableShapeId() const {
return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualTableShapeId);
}
-std::unique_ptr<PDBSymbolTypeVTable>
+std::unique_ptr<PDBSymbolTypeBuiltin>
DIARawSymbol::getVirtualBaseTableType() const {
CComPtr<IDiaSymbol> TableType;
if (FAILED(Symbol->get_virtualBaseTableType(&TableType)) || !TableType)
@@ -729,7 +730,7 @@ DIARawSymbol::getVirtualBaseTableType() const {
auto RawVT = llvm::make_unique<DIARawSymbol>(Session, TableType);
auto Pointer =
llvm::make_unique<PDBSymbolTypePointer>(Session, std::move(RawVT));
- return unique_dyn_cast<PDBSymbolTypeVTable>(Pointer->getPointeeType());
+ return unique_dyn_cast<PDBSymbolTypeBuiltin>(Pointer->getPointeeType());
}
PDB_DataKind DIARawSymbol::getDataKind() const {
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
index 6ecf335812b..ef47b92b4f2 100644
--- a/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
+++ b/llvm/lib/DebugInfo/PDB/DIA/DIASession.cpp
@@ -21,12 +21,22 @@
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Format.h"
+#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
using namespace llvm::pdb;
-static Error ErrorFromHResult(HRESULT Result, StringRef Context) {
+template <typename... Ts>
+static Error ErrorFromHResult(HRESULT Result, const char *Str, Ts &&... Args) {
+ SmallString<64> MessageStorage;
+ StringRef Context;
+ if (sizeof...(Args) > 0) {
+ MessageStorage = formatv(Str, std::forward<Ts>(Args)...).str();
+ Context = MessageStorage;
+ } else
+ Context = Str;
+
switch (Result) {
case E_PDB_NOT_FOUND:
return make_error<GenericError>(generic_error_code::invalid_path, Context);
@@ -95,8 +105,9 @@ Error DIASession::createFromPdb(StringRef Path,
const wchar_t *Path16Str = reinterpret_cast<const wchar_t*>(Path16.data());
HRESULT HR;
- if (FAILED(HR = DiaDataSource->loadDataFromPdb(Path16Str)))
- return ErrorFromHResult(HR, "Calling loadDataFromPdb");
+ if (FAILED(HR = DiaDataSource->loadDataFromPdb(Path16Str))) {
+ return ErrorFromHResult(HR, "Calling loadDataFromPdb {0}", Path);
+ }
if (FAILED(HR = DiaDataSource->openSession(&DiaSession)))
return ErrorFromHResult(HR, "Calling openSession");
OpenPOWER on IntegriCloud