2017-06-22 22:57:39 +02:00
|
|
|
//===- DumpOutputStyle.h -------------------------------------- *- C++ --*-===//
|
2016-06-03 21:28:33 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-06-22 22:57:39 +02:00
|
|
|
#ifndef LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
|
|
|
|
#define LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
|
2016-06-03 21:28:33 +02:00
|
|
|
|
2017-06-16 00:24:24 +02:00
|
|
|
#include "LinePrinter.h"
|
2016-06-03 21:28:33 +02:00
|
|
|
#include "OutputStyle.h"
|
2017-08-21 16:53:25 +02:00
|
|
|
#include "StreamUtil.h"
|
2016-06-03 21:28:33 +02:00
|
|
|
|
2017-08-21 16:53:25 +02:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2017-05-05 01:53:01 +02:00
|
|
|
#include "llvm/ADT/Optional.h"
|
2017-03-14 00:28:25 +01:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2017-08-04 22:02:38 +02:00
|
|
|
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
|
2016-06-03 21:28:33 +02:00
|
|
|
|
2017-03-14 00:28:25 +01:00
|
|
|
#include <string>
|
|
|
|
|
2016-06-03 21:28:33 +02:00
|
|
|
namespace llvm {
|
2016-08-01 23:19:45 +02:00
|
|
|
class BitVector;
|
2017-05-19 21:26:58 +02:00
|
|
|
|
|
|
|
namespace codeview {
|
|
|
|
class LazyRandomTypeCollection;
|
|
|
|
}
|
|
|
|
|
2016-06-03 21:28:33 +02:00
|
|
|
namespace pdb {
|
2017-07-26 02:40:36 +02:00
|
|
|
class GSIHashTable;
|
|
|
|
|
2017-08-21 16:53:25 +02:00
|
|
|
struct StatCollection {
|
|
|
|
struct Stat {
|
|
|
|
Stat() {}
|
|
|
|
Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {}
|
|
|
|
uint32_t Count = 0;
|
|
|
|
uint32_t Size = 0;
|
|
|
|
|
|
|
|
void update(uint32_t RecordSize) {
|
|
|
|
++Count;
|
|
|
|
Size += RecordSize;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void update(uint32_t Kind, uint32_t RecordSize) {
|
|
|
|
Totals.update(RecordSize);
|
|
|
|
auto Iter = Individual.try_emplace(Kind, 1, RecordSize);
|
|
|
|
if (!Iter.second)
|
|
|
|
Iter.first->second.update(RecordSize);
|
|
|
|
}
|
|
|
|
Stat Totals;
|
|
|
|
DenseMap<uint32_t, Stat> Individual;
|
|
|
|
};
|
|
|
|
|
2017-06-22 22:57:39 +02:00
|
|
|
class DumpOutputStyle : public OutputStyle {
|
2017-08-21 16:53:25 +02:00
|
|
|
|
2016-06-03 21:28:33 +02:00
|
|
|
public:
|
2017-06-22 22:57:39 +02:00
|
|
|
DumpOutputStyle(PDBFile &File);
|
2016-06-03 21:28:33 +02:00
|
|
|
|
2016-06-30 19:42:48 +02:00
|
|
|
Error dump() override;
|
2016-06-06 22:37:05 +02:00
|
|
|
|
2016-06-03 21:28:33 +02:00
|
|
|
private:
|
2017-06-17 01:42:15 +02:00
|
|
|
Expected<codeview::LazyRandomTypeCollection &> initializeTypes(uint32_t SN);
|
2017-05-05 01:53:01 +02:00
|
|
|
|
2017-06-16 00:24:24 +02:00
|
|
|
Error dumpFileSummary();
|
2016-06-30 19:42:48 +02:00
|
|
|
Error dumpStreamSummary();
|
2017-08-21 16:53:25 +02:00
|
|
|
Error dumpModuleStats();
|
2017-01-20 23:42:09 +01:00
|
|
|
Error dumpStringTable();
|
2017-06-16 01:56:19 +02:00
|
|
|
Error dumpLines();
|
|
|
|
Error dumpInlineeLines();
|
2017-06-16 02:04:24 +02:00
|
|
|
Error dumpXmi();
|
|
|
|
Error dumpXme();
|
2016-06-30 19:42:48 +02:00
|
|
|
Error dumpTpiStream(uint32_t StreamIdx);
|
2017-06-16 00:24:24 +02:00
|
|
|
Error dumpModules();
|
2017-06-16 01:12:41 +02:00
|
|
|
Error dumpModuleFiles();
|
2017-06-16 00:24:24 +02:00
|
|
|
Error dumpModuleSyms();
|
2017-07-26 02:40:36 +02:00
|
|
|
Error dumpGlobals();
|
2017-06-16 00:24:24 +02:00
|
|
|
Error dumpPublics();
|
2017-07-26 02:40:36 +02:00
|
|
|
Error dumpSymbolsFromGSI(const GSIHashTable &Table, bool HashExtras);
|
2017-08-04 22:02:38 +02:00
|
|
|
Error dumpSectionHeaders();
|
2016-06-30 19:42:48 +02:00
|
|
|
Error dumpSectionContribs();
|
|
|
|
Error dumpSectionMap();
|
|
|
|
|
2017-08-04 22:02:38 +02:00
|
|
|
void dumpSectionHeaders(StringRef Label, DbgHeaderType Type);
|
|
|
|
|
2016-06-03 21:28:33 +02:00
|
|
|
PDBFile &File;
|
2017-06-16 00:24:24 +02:00
|
|
|
LinePrinter P;
|
2017-05-19 21:26:58 +02:00
|
|
|
std::unique_ptr<codeview::LazyRandomTypeCollection> TpiTypes;
|
|
|
|
std::unique_ptr<codeview::LazyRandomTypeCollection> IpiTypes;
|
2017-08-21 16:53:25 +02:00
|
|
|
SmallVector<StreamInfo, 32> StreamPurposes;
|
2016-06-03 21:28:33 +02:00
|
|
|
};
|
2017-06-16 00:24:24 +02:00
|
|
|
} // namespace pdb
|
|
|
|
} // namespace llvm
|
2016-06-03 21:28:33 +02:00
|
|
|
|
|
|
|
#endif
|