Rewrite llvm-pdbdump in terms of LLVMDebugInfoPDB.
[oota-llvm.git] / lib / DebugInfo / PDB / PDBSymbolThunk.cpp
index f1a8936357bc29b461582fb7686ca352dcf27ac8..a7bd96a3479d013603af2aea2473f1e6706b149a 100644 (file)
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
 
+#include "llvm/Support/Format.h"
+
 using namespace llvm;
 
 PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession,
                                std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolThunk::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
+                          PDB_DumpLevel Level) const {
+  if (Level == PDB_DumpLevel::Compact) {
+    OS.indent(Indent);
+    PDB_ThunkOrdinal Ordinal = getThunkOrdinal();
+    OS << "THUNK[" << Ordinal << "] ";
+    OS << "[" << format_hex(getRelativeVirtualAddress(), 10);
+    if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
+      OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
+    OS << "] ";
+    std::string Name = getName();
+    if (!Name.empty())
+      OS << Name;
+    OS << "\n";
+  }
+}