mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[llvm-pdbdump] Dump stream sizes and stream blocks to yaml.
llvm-svn: 271940
This commit is contained in:
parent
9cba8e4a60
commit
ca1c5f2e74
@ -12,11 +12,11 @@
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::yaml;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::pdb::yaml;
|
||||
|
||||
void llvm::yaml::MappingTraits<MsfHeaders>::mapping(
|
||||
IO &IO, pdb::yaml::MsfHeaders &Obj) {
|
||||
void MappingTraits<MsfHeaders>::mapping(IO &IO, MsfHeaders &Obj) {
|
||||
IO.mapRequired("BlockSize", Obj.BlockSize);
|
||||
IO.mapRequired("Unknown0", Obj.Unknown0);
|
||||
IO.mapRequired("NumBlocks", Obj.BlockCount);
|
||||
@ -29,7 +29,16 @@ void llvm::yaml::MappingTraits<MsfHeaders>::mapping(
|
||||
IO.mapRequired("NumStreams", Obj.NumStreams);
|
||||
}
|
||||
|
||||
void llvm::yaml::MappingTraits<pdb::yaml::PdbObject>::mapping(
|
||||
IO &IO, pdb::yaml::PdbObject &Obj) {
|
||||
void MappingTraits<PdbObject>::mapping(IO &IO, PdbObject &Obj) {
|
||||
IO.mapOptional("MSF", Obj.Headers);
|
||||
IO.mapOptional("StreamSizes", Obj.StreamSizes);
|
||||
IO.mapOptional("StreamMap", Obj.StreamMap);
|
||||
}
|
||||
|
||||
void MappingTraits<StreamSizeEntry>::mapping(IO &IO, StreamSizeEntry &Obj) {
|
||||
IO.mapRequired("Size", Obj.Size);
|
||||
}
|
||||
|
||||
void MappingTraits<StreamMapEntry>::mapping(IO &IO, StreamMapEntry &Obj) {
|
||||
IO.mapRequired("Blocks", Obj.Blocks);
|
||||
}
|
||||
|
@ -36,13 +36,33 @@ struct MsfHeaders {
|
||||
uint32_t NumStreams;
|
||||
};
|
||||
|
||||
struct StreamSizeEntry {
|
||||
uint32_t Size;
|
||||
};
|
||||
|
||||
struct StreamMapEntry {
|
||||
std::vector<uint32_t> Blocks;
|
||||
};
|
||||
|
||||
struct PdbObject {
|
||||
Optional<MsfHeaders> Headers;
|
||||
Optional<std::vector<StreamSizeEntry>> StreamSizes;
|
||||
Optional<std::vector<StreamMapEntry>> StreamMap;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
namespace yaml {
|
||||
template <> struct MappingTraits<pdb::yaml::StreamSizeEntry> {
|
||||
static void mapping(IO &IO, pdb::yaml::StreamSizeEntry &Obj);
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<pdb::yaml::StreamMapEntry> {
|
||||
static void mapping(IO &IO, pdb::yaml::StreamMapEntry &Obj);
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
|
||||
static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
|
||||
};
|
||||
@ -53,5 +73,7 @@ template <> struct MappingTraits<pdb::yaml::PdbObject> {
|
||||
}
|
||||
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(uint32_t)
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamSizeEntry)
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamMapEntry)
|
||||
|
||||
#endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
|
||||
|
@ -45,6 +45,13 @@ Error YAMLOutputStyle::dumpStreamSummary() {
|
||||
if (!opts::DumpStreamSummary)
|
||||
return Error::success();
|
||||
|
||||
std::vector<yaml::StreamSizeEntry> Sizes;
|
||||
for (uint32_t I = 0; I < File.getNumStreams(); ++I) {
|
||||
yaml::StreamSizeEntry Entry;
|
||||
Entry.Size = File.getStreamByteSize(I);
|
||||
Sizes.push_back(Entry);
|
||||
}
|
||||
Obj.StreamSizes.emplace(Sizes);
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
@ -52,6 +59,15 @@ Error YAMLOutputStyle::dumpStreamBlocks() {
|
||||
if (!opts::DumpStreamBlocks)
|
||||
return Error::success();
|
||||
|
||||
std::vector<yaml::StreamMapEntry> Blocks;
|
||||
for (uint32_t I = 0; I < File.getNumStreams(); ++I) {
|
||||
yaml::StreamMapEntry Entry;
|
||||
auto BlockList = File.getStreamBlockList(I);
|
||||
Entry.Blocks.assign(BlockList.begin(), BlockList.end());
|
||||
Blocks.push_back(Entry);
|
||||
}
|
||||
Obj.StreamMap.emplace(Blocks);
|
||||
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user