summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFContext.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index e9b3c0c132e..02c91d2464c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -80,6 +80,27 @@ static void dumpAccelSection(raw_ostream &OS, StringRef Name,
Accel.dump(OS);
}
+/// Dump the UUID load command.
+static void dumpUUID(raw_ostream &OS, const ObjectFile &Obj) {
+ auto *MachO = dyn_cast<MachOObjectFile>(&Obj);
+ if (!MachO)
+ return;
+ for (auto LC : MachO->load_commands()) {
+ raw_ostream::uuid_t UUID;
+ if (LC.C.cmd == MachO::LC_UUID) {
+ if (LC.C.cmdsize < sizeof(UUID) + sizeof(LC.C)) {
+ OS << "error: UUID load command is too short.\n";
+ return;
+ }
+ OS << "UUID: ";
+ memcpy(&UUID, LC.Ptr+sizeof(LC.C), sizeof(UUID));
+ OS.write_uuid(UUID);
+ OS << ' ' << MachO->getFileFormatName();
+ OS << ' ' << MachO->getFileName() << '\n';
+ }
+ }
+}
+
static void
dumpDWARFv5StringOffsetsSection(raw_ostream &OS, StringRef SectionName,
const DWARFObject &Obj,
@@ -203,6 +224,13 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
uint64_t DumpType = DumpOpts.DumpType;
bool DumpEH = DumpOpts.DumpEH;
+ const auto *ObjFile = DObj->getFile();
+ if (!(DumpType & DIDT_UUID) || DumpType == DIDT_All)
+ outs() << ObjFile->getFileName() << ":\tfile format "
+ << ObjFile->getFileFormatName() << "\n\n";
+ if (DumpType & DIDT_UUID)
+ dumpUUID(OS, *ObjFile);
+
if (DumpType & DIDT_DebugAbbrev) {
OS << ".debug_abbrev contents:\n";
getDebugAbbrev()->dump(OS);
OpenPOWER on IntegriCloud