blob: f405cf615e924580432a14e4cc12a2fe4bbd38c2 [file] [log] [blame]
Zachary Turnerea40f402018-03-29 16:28:20 +00001//===- ExplainOutputStyle.h ----------------------------------- *- C++ --*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Zachary Turnerea40f402018-03-29 16:28:20 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_TOOLS_LLVMPDBDUMP_EXPLAINOUTPUTSTYLE_H
10#define LLVM_TOOLS_LLVMPDBDUMP_EXPLAINOUTPUTSTYLE_H
11
12#include "LinePrinter.h"
13#include "OutputStyle.h"
14
15#include <string>
16
17namespace llvm {
18
19namespace pdb {
20
Zachary Turnerd5cf5cf2018-03-30 17:16:50 +000021class DbiStream;
Zachary Turner15b2bdf2018-04-04 17:29:09 +000022class InfoStream;
23class InputFile;
Zachary Turnerea40f402018-03-29 16:28:20 +000024
25class ExplainOutputStyle : public OutputStyle {
26
27public:
Zachary Turner15b2bdf2018-04-04 17:29:09 +000028 ExplainOutputStyle(InputFile &File, uint64_t FileOffset);
Zachary Turnerea40f402018-03-29 16:28:20 +000029
30 Error dump() override;
31
32private:
Zachary Turner15b2bdf2018-04-04 17:29:09 +000033 Error explainPdbFile();
34 Error explainBinaryFile();
Zachary Turnerea40f402018-03-29 16:28:20 +000035
Zachary Turner15b2bdf2018-04-04 17:29:09 +000036 bool explainPdbBlockStatus();
Zachary Turnerea40f402018-03-29 16:28:20 +000037
Zachary Turner15b2bdf2018-04-04 17:29:09 +000038 bool isPdbFpm1() const;
39 bool isPdbFpm2() const;
Zachary Turnerea40f402018-03-29 16:28:20 +000040
Zachary Turner15b2bdf2018-04-04 17:29:09 +000041 bool isPdbSuperBlock() const;
42 bool isPdbFpmBlock() const;
43 bool isPdbBlockMapBlock() const;
44 bool isPdbStreamDirectoryBlock() const;
45 Optional<uint32_t> getPdbBlockStreamIndex() const;
Zachary Turnerea40f402018-03-29 16:28:20 +000046
Zachary Turner15b2bdf2018-04-04 17:29:09 +000047 void explainPdbSuperBlockOffset();
48 void explainPdbFpmBlockOffset();
49 void explainPdbBlockMapOffset();
50 void explainPdbStreamDirectoryOffset();
51 void explainPdbStreamOffset(uint32_t Stream);
52 void explainPdbUnknownBlock();
Zachary Turnerd5cf5cf2018-03-30 17:16:50 +000053
Zachary Turner15b2bdf2018-04-04 17:29:09 +000054 void explainStreamOffset(DbiStream &Stream, uint32_t OffsetInStream);
55 void explainStreamOffset(InfoStream &Stream, uint32_t OffsetInStream);
56
57 uint32_t pdbBlockIndex() const;
58 uint32_t pdbBlockOffset() const;
59
60 InputFile &File;
Zachary Turnerea40f402018-03-29 16:28:20 +000061 const uint64_t FileOffset;
Zachary Turnerea40f402018-03-29 16:28:20 +000062 LinePrinter P;
63};
64} // namespace pdb
65} // namespace llvm
66
67#endif