1 //===- ExplainOutputStyle.h ----------------------------------- *- C++ --*-===//
2 //
3 // 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
6 //
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 
17 namespace llvm {
18 
19 namespace pdb {
20 
21 class DbiStream;
22 class InfoStream;
23 class InputFile;
24 
25 class ExplainOutputStyle : public OutputStyle {
26 
27 public:
28   ExplainOutputStyle(InputFile &File, uint64_t FileOffset);
29 
30   Error dump() override;
31 
32 private:
33   Error explainPdbFile();
34   Error explainBinaryFile();
35 
36   bool explainPdbBlockStatus();
37 
38   bool isPdbFpm1() const;
39   bool isPdbFpm2() const;
40 
41   bool isPdbSuperBlock() const;
42   bool isPdbFpmBlock() const;
43   bool isPdbBlockMapBlock() const;
44   bool isPdbStreamDirectoryBlock() const;
45   Optional<uint32_t> getPdbBlockStreamIndex() const;
46 
47   void explainPdbSuperBlockOffset();
48   void explainPdbFpmBlockOffset();
49   void explainPdbBlockMapOffset();
50   void explainPdbStreamDirectoryOffset();
51   void explainPdbStreamOffset(uint32_t Stream);
52   void explainPdbUnknownBlock();
53 
54   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;
61   const uint64_t FileOffset;
62   LinePrinter P;
63 };
64 } // namespace pdb
65 } // namespace llvm
66 
67 #endif
68