aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-02-10 22:43:25 +0000
committerZachary Turner <zturner@google.com>2015-02-10 22:43:25 +0000
commita5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9 (patch)
tree9012681968824b47f3c3f208cd91fa82cf48aa5d /llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
parentca19485f08fc41bb7de5be925c06735937b3ea50 (diff)
downloadllvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.zip
llvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.tar.gz
llvm-a5549178f12d3d4dad72e1ab8efbb6fc9ed0d2c9.tar.bz2
Rewrite llvm-pdbdump in terms of LLVMDebugInfoPDB.
This makes llvm-pdbdump available on all platforms, although it will currently fail to create a dumper if there is no PDB reader implementation for the current platform. It implements dumping of compilands and children, which is less information than was previously available, but it has to be rewritten from scratch using the new set of interfaces, so the rest of the functionality will be added back in subsequent commits. llvm-svn: 228755
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp49
1 files changed, 48 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
index e93307fb..f605af2 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
@@ -8,12 +8,59 @@
//===----------------------------------------------------------------------===//
#include <utility>
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/Support/Format.h"
+
using namespace llvm;
PDBSymbolData::PDBSymbolData(const IPDBSession &PDBSession,
std::unique_ptr<IPDBRawSymbol> DataSymbol)
: PDBSymbol(PDBSession, std::move(DataSymbol)) {}
-void PDBSymbolData::dump(llvm::raw_ostream &OS) const {} \ No newline at end of file
+void PDBSymbolData::dump(raw_ostream &OS, int Indent,
+ PDB_DumpLevel Level) const {
+ OS.indent(Indent);
+ if (Level == PDB_DumpLevel::Compact) {
+ PDB_LocType Loc = getLocationType();
+ OS << Loc << " data [";
+ switch (Loc) {
+ case PDB_LocType::Static:
+ OS << format_hex(getRelativeVirtualAddress(), 10);
+ break;
+ case PDB_LocType::TLS:
+ OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10);
+ break;
+ case PDB_LocType::RegRel:
+ OS << getRegisterId() << " + " << getOffset() << "]";
+ break;
+ case PDB_LocType::ThisRel:
+ OS << "this + " << getOffset() << "]";
+ break;
+ case PDB_LocType::Enregistered:
+ OS << getRegisterId() << "]";
+ break;
+ case PDB_LocType::BitField: {
+ uint32_t Offset = getOffset();
+ uint32_t BitPos = getBitPosition();
+ uint32_t Length = getLength();
+ uint32_t StartBits = 8 - BitPos;
+ uint32_t MiddleBytes = (Length - StartBits) / 8;
+ uint32_t EndBits = Length - StartBits - MiddleBytes * 8;
+ OS << format_hex(Offset, 10) << ":" << BitPos;
+ OS << " - " << format_hex(Offset + MiddleBytes, 10) << ":" << EndBits;
+ break;
+ }
+ case PDB_LocType::Slot:
+ OS << getSlot();
+ case PDB_LocType::IlRel:
+ case PDB_LocType::MetaData:
+ case PDB_LocType::Constant:
+ default:
+ OS << "???";
+ }
+ OS << "] ";
+ }
+ OS << getName() << "\n";
+} \ No newline at end of file