xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-pdbutil/ExplainOutputStyle.h (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
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 "OutputStyle.h"
13 
14 #include "llvm/DebugInfo/PDB/Native/LinePrinter.h"
15 
16 namespace llvm {
17 
18 namespace pdb {
19 
20 class DbiStream;
21 class InfoStream;
22 class InputFile;
23 
24 class ExplainOutputStyle : public OutputStyle {
25 
26 public:
27   ExplainOutputStyle(InputFile &File, uint64_t FileOffset);
28 
29   Error dump() override;
30 
31 private:
32   Error explainPdbFile();
33   Error explainBinaryFile();
34 
35   bool explainPdbBlockStatus();
36 
37   bool isPdbFpm1() const;
38   bool isPdbFpm2() const;
39 
40   bool isPdbSuperBlock() const;
41   bool isPdbFpmBlock() const;
42   bool isPdbBlockMapBlock() const;
43   bool isPdbStreamDirectoryBlock() const;
44   std::optional<uint32_t> getPdbBlockStreamIndex() const;
45 
46   void explainPdbSuperBlockOffset();
47   void explainPdbFpmBlockOffset();
48   void explainPdbBlockMapOffset();
49   void explainPdbStreamDirectoryOffset();
50   void explainPdbStreamOffset(uint32_t Stream);
51   void explainPdbUnknownBlock();
52 
53   void explainStreamOffset(DbiStream &Stream, uint32_t OffsetInStream);
54   void explainStreamOffset(InfoStream &Stream, uint32_t OffsetInStream);
55 
56   uint32_t pdbBlockIndex() const;
57   uint32_t pdbBlockOffset() const;
58 
59   InputFile &File;
60   const uint64_t FileOffset;
61   LinePrinter P;
62 };
63 } // namespace pdb
64 } // namespace llvm
65 
66 #endif
67