summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-02-13 01:23:51 +0000
committerZachary Turner <zturner@google.com>2015-02-13 01:23:51 +0000
commit2a5c0a27b6fe45e2c556ff94987be39220abfc09 (patch)
tree4e929c4b266057e95c1ebe19c28b94fc9d46b678 /llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
parent54e2bc6c9b0047c3dbed74922d44e9e4e7b257cc (diff)
downloadbcm5719-llvm-2a5c0a27b6fe45e2c556ff94987be39220abfc09.tar.gz
bcm5719-llvm-2a5c0a27b6fe45e2c556ff94987be39220abfc09.zip
Improve llvm-pdbdump output display.
This patch adds a number of improvements to llvm-pdbdump. 1) Dumping of the entire global scope, and not only those symbols that live in individual compilands. 2) Prepend class name to member functions and data 3) Improved display of bitfields. 4) Support for dumping more kinds of data symbols. llvm-svn: 229012
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp59
1 files changed, 41 insertions, 18 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
index bffad8af751..3c4be3ad2d0 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp
@@ -8,8 +8,10 @@
//===----------------------------------------------------------------------===//
#include <utility>
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/PDBExtras.h"
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
#include "llvm/Support/Format.h"
@@ -21,48 +23,69 @@ PDBSymbolData::PDBSymbolData(const IPDBSession &PDBSession,
void PDBSymbolData::dump(raw_ostream &OS, int Indent,
PDB_DumpLevel Level) const {
- OS.indent(Indent);
+ OS << stream_indent(Indent);
+ PDB_LocType Loc = getLocationType();
+ PDB_DataKind Kind = getDataKind();
if (Level == PDB_DumpLevel::Compact) {
- PDB_LocType Loc = getLocationType();
- OS << Loc << " data [";
- int Length;
switch (Loc) {
- case PDB_LocType::Static:
- OS << format_hex(getRelativeVirtualAddress(), 10);
- Length = getLength();
+ case PDB_LocType::Static: {
+ uint32_t RVA = getRelativeVirtualAddress();
+ OS << Kind << " data[";
+ if (RVA != 0)
+ OS << format_hex(RVA, 10);
+ else
+ OS << "???";
break;
+ }
case PDB_LocType::TLS:
+ OS << "threadlocal " << Kind << " data[";
OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10);
break;
case PDB_LocType::RegRel:
- OS << getRegisterId() << " + " << getOffset() << "]";
+ OS << "regrel " << Kind << " data[";
+ OS << getRegisterId() << " + " << getOffset();
break;
- case PDB_LocType::ThisRel:
- OS << "this + " << getOffset() << "]";
+ case PDB_LocType::ThisRel: {
+ uint32_t Offset = getOffset();
+ OS << Kind << " data[this + " << format_hex(Offset, 4);
break;
+ }
case PDB_LocType::Enregistered:
- OS << getRegisterId() << "]";
+ OS << "register " << Kind << " data[" << getRegisterId();
break;
case PDB_LocType::BitField: {
+ OS << "bitfield data[this + ";
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;
+ OS << format_hex(Offset, 4) << ":" << BitPos << "," << Length;
break;
}
case PDB_LocType::Slot:
OS << getSlot();
+ break;
+ case PDB_LocType::Constant: {
+ OS << "constant data[";
+ OS << getValue();
+ break;
+ }
case PDB_LocType::IlRel:
case PDB_LocType::MetaData:
- case PDB_LocType::Constant:
default:
OS << "???";
}
- OS << "] ";
+ }
+ OS << "] ";
+ if (Kind == PDB_DataKind::Member || Kind == PDB_DataKind::StaticMember) {
+ uint32_t ClassId = getClassParentId();
+ if (auto Class = Session.getSymbolById(ClassId)) {
+ if (auto UDT = dyn_cast<PDBSymbolTypeUDT>(Class.get()))
+ OS << UDT->getName();
+ else
+ OS << "{class " << Class->getSymTag() << "}";
+ OS << "::";
+ }
}
OS << getName() << "\n";
+ OS.flush();
} \ No newline at end of file
OpenPOWER on IntegriCloud