mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
f5c6b23b50
After some internal discussions, we agreed that the raw output style had outlived its usefulness. It was originally created before we had even thought of dumping to YAML, and it was intended to give us some insight into the internals of a PDB file. Now we have YAML mode which does almost exactly this but is more powerful in that it can round-trip back to a PDB, which the raw mode could not do. So the raw mode had become purely a maintenance burden. One option was to just delete it. However, its original goal was to be as readable as possible while staying close to the "metal" - i.e. presenting the output in a way that maps directly to the underlying file format. We don't actually need that last requirement anymore since it's covered by the yaml mode, so we could repurpose "raw" mode to actually just be as readable as possible. This patch implements about 80% of the functionality previously in raw mode, but in a completely different style that is more akin to what cvdump outputs. Records are very compressed, often times appearing on just one line. One nice thing about this is that it makes full record matching easier, because you can grep for indices, names, and leaf types on a single line often. See the tests for some examples of what the new output looks like. Note that this patch actually regresses the functionality of raw mode in a few areas, but only because the patch was already unreasonably large and going 100% would have been even worse. Specifically, this patch is missing: The ability to dump module debug subsections (checksums, lines, etc) The ability to dump section headers Aside from that everything is here. While goign through the tests fixing them all up, I found many duplicate tests. They've been deleted. In subsequent patches I will go through and re-add the missing functionality. Differential Revision: https://reviews.llvm.org/D34191 llvm-svn: 305495
145 lines
4.1 KiB
C++
145 lines
4.1 KiB
C++
//===- llvm-pdbutil.h ----------------------------------------- *- C++ --*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
|
|
#define LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
|
|
|
|
#include "llvm/ADT/Optional.h"
|
|
#include "llvm/Support/CommandLine.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include <memory>
|
|
#include <stdint.h>
|
|
|
|
namespace llvm {
|
|
namespace pdb {
|
|
class PDBSymbolData;
|
|
class PDBSymbolFunc;
|
|
uint32_t getTypeLength(const PDBSymbolData &Symbol);
|
|
}
|
|
}
|
|
|
|
namespace opts {
|
|
|
|
enum class DumpLevel { None, Basic, Verbose };
|
|
|
|
enum class ModuleSubsection {
|
|
Unknown,
|
|
Lines,
|
|
FileChecksums,
|
|
InlineeLines,
|
|
CrossScopeImports,
|
|
CrossScopeExports,
|
|
StringTable,
|
|
Symbols,
|
|
FrameData,
|
|
CoffSymbolRVAs,
|
|
All
|
|
};
|
|
|
|
namespace pretty {
|
|
|
|
enum class ClassDefinitionFormat { None, Layout, All };
|
|
enum class ClassSortMode {
|
|
None,
|
|
Name,
|
|
Size,
|
|
Padding,
|
|
PaddingPct,
|
|
PaddingImmediate,
|
|
PaddingPctImmediate
|
|
};
|
|
|
|
enum class SymbolSortMode { None, Name, Size };
|
|
|
|
enum class SymLevel { Functions, Data, Thunks, All };
|
|
|
|
bool shouldDumpSymLevel(SymLevel Level);
|
|
bool compareFunctionSymbols(
|
|
const std::unique_ptr<llvm::pdb::PDBSymbolFunc> &F1,
|
|
const std::unique_ptr<llvm::pdb::PDBSymbolFunc> &F2);
|
|
bool compareDataSymbols(const std::unique_ptr<llvm::pdb::PDBSymbolData> &F1,
|
|
const std::unique_ptr<llvm::pdb::PDBSymbolData> &F2);
|
|
|
|
extern llvm::cl::opt<bool> Compilands;
|
|
extern llvm::cl::opt<bool> Symbols;
|
|
extern llvm::cl::opt<bool> Globals;
|
|
extern llvm::cl::opt<bool> Classes;
|
|
extern llvm::cl::opt<bool> Enums;
|
|
extern llvm::cl::opt<bool> Typedefs;
|
|
extern llvm::cl::opt<bool> All;
|
|
extern llvm::cl::opt<bool> ExcludeCompilerGenerated;
|
|
|
|
extern llvm::cl::opt<bool> NoEnumDefs;
|
|
extern llvm::cl::list<std::string> ExcludeTypes;
|
|
extern llvm::cl::list<std::string> ExcludeSymbols;
|
|
extern llvm::cl::list<std::string> ExcludeCompilands;
|
|
extern llvm::cl::list<std::string> IncludeTypes;
|
|
extern llvm::cl::list<std::string> IncludeSymbols;
|
|
extern llvm::cl::list<std::string> IncludeCompilands;
|
|
extern llvm::cl::opt<SymbolSortMode> SymbolOrder;
|
|
extern llvm::cl::opt<ClassSortMode> ClassOrder;
|
|
extern llvm::cl::opt<uint32_t> SizeThreshold;
|
|
extern llvm::cl::opt<uint32_t> PaddingThreshold;
|
|
extern llvm::cl::opt<uint32_t> ImmediatePaddingThreshold;
|
|
extern llvm::cl::opt<ClassDefinitionFormat> ClassFormat;
|
|
extern llvm::cl::opt<uint32_t> ClassRecursionDepth;
|
|
}
|
|
|
|
namespace raw {
|
|
struct BlockRange {
|
|
uint32_t Min;
|
|
llvm::Optional<uint32_t> Max;
|
|
};
|
|
|
|
extern llvm::cl::opt<bool> DumpSummary;
|
|
extern llvm::cl::opt<bool> DumpStreams;
|
|
extern llvm::Optional<BlockRange> DumpBlockRange;
|
|
extern llvm::cl::list<std::string> DumpStreamData;
|
|
extern llvm::cl::opt<bool> DumpStringTable;
|
|
extern llvm::cl::opt<bool> DumpTypes;
|
|
extern llvm::cl::opt<bool> DumpTypeData;
|
|
extern llvm::cl::opt<bool> DumpTypeHashes;
|
|
extern llvm::cl::opt<bool> DumpIds;
|
|
extern llvm::cl::opt<bool> DumpIdData;
|
|
extern llvm::cl::opt<bool> DumpSymbols;
|
|
extern llvm::cl::opt<bool> DumpSymRecordBytes;
|
|
extern llvm::cl::opt<bool> DumpPublics;
|
|
extern llvm::cl::opt<bool> DumpSectionContribs;
|
|
extern llvm::cl::opt<bool> DumpSectionMap;
|
|
extern llvm::cl::opt<bool> DumpModules;
|
|
extern llvm::cl::opt<bool> DumpModuleFiles;
|
|
extern llvm::cl::opt<bool> RawAll;
|
|
}
|
|
|
|
namespace diff {
|
|
extern llvm::cl::opt<bool> Pedantic;
|
|
}
|
|
|
|
namespace pdb2yaml {
|
|
extern llvm::cl::opt<bool> All;
|
|
extern llvm::cl::opt<bool> NoFileHeaders;
|
|
extern llvm::cl::opt<bool> Minimal;
|
|
extern llvm::cl::opt<bool> StreamMetadata;
|
|
extern llvm::cl::opt<bool> StreamDirectory;
|
|
extern llvm::cl::opt<bool> StringTable;
|
|
extern llvm::cl::opt<bool> PdbStream;
|
|
extern llvm::cl::opt<bool> DbiStream;
|
|
extern llvm::cl::opt<bool> TpiStream;
|
|
extern llvm::cl::opt<bool> IpiStream;
|
|
extern llvm::cl::list<std::string> InputFilename;
|
|
extern llvm::cl::opt<bool> DumpModules;
|
|
extern llvm::cl::opt<bool> DumpModuleFiles;
|
|
extern llvm::cl::list<ModuleSubsection> DumpModuleSubsections;
|
|
extern llvm::cl::opt<bool> DumpModuleSyms;
|
|
} // namespace pdb2yaml
|
|
}
|
|
|
|
#endif
|