mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
5d88e16362
While it's not entirely clear why a compiler or linker might put this information into an object or PDB file, one has been spotted in the wild which was causing llvm-pdbdump to crash. This patch adds support for reading-writing these sections. Since I don't know how to get one of the native tools to generate this kind of debug info, the only test here is one in which we feed YAML into the tool to produce a PDB and then spit out YAML from the resulting PDB and make sure that it matches. llvm-svn: 304738
67 lines
2.3 KiB
C++
67 lines
2.3 KiB
C++
//===- DebugSubsectionVisitor.cpp ---------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"
|
|
|
|
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
|
|
#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"
|
|
#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"
|
|
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
|
|
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
|
|
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
|
|
#include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h"
|
|
#include "llvm/Support/BinaryStreamReader.h"
|
|
#include "llvm/Support/BinaryStreamRef.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::codeview;
|
|
|
|
Error llvm::codeview::visitDebugSubsection(const DebugSubsectionRecord &R,
|
|
DebugSubsectionVisitor &V) {
|
|
BinaryStreamReader Reader(R.getRecordData());
|
|
switch (R.kind()) {
|
|
case DebugSubsectionKind::Lines: {
|
|
DebugLinesSubsectionRef Fragment;
|
|
if (auto EC = Fragment.initialize(Reader))
|
|
return EC;
|
|
|
|
return V.visitLines(Fragment);
|
|
}
|
|
case DebugSubsectionKind::FileChecksums: {
|
|
DebugChecksumsSubsectionRef Fragment;
|
|
if (auto EC = Fragment.initialize(Reader))
|
|
return EC;
|
|
|
|
return V.visitFileChecksums(Fragment);
|
|
}
|
|
case DebugSubsectionKind::InlineeLines: {
|
|
DebugInlineeLinesSubsectionRef Fragment;
|
|
if (auto EC = Fragment.initialize(Reader))
|
|
return EC;
|
|
return V.visitInlineeLines(Fragment);
|
|
}
|
|
case DebugSubsectionKind::CrossScopeExports: {
|
|
DebugCrossModuleExportsSubsectionRef Section;
|
|
if (auto EC = Section.initialize(Reader))
|
|
return EC;
|
|
return V.visitCrossModuleExports(Section);
|
|
}
|
|
case DebugSubsectionKind::CrossScopeImports: {
|
|
DebugCrossModuleImportsSubsectionRef Section;
|
|
if (auto EC = Section.initialize(Reader))
|
|
return EC;
|
|
return V.visitCrossModuleImports(Section);
|
|
}
|
|
default: {
|
|
DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData());
|
|
return V.visitUnknown(Fragment);
|
|
}
|
|
}
|
|
}
|