Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 1 | //===- MinimalSymbolDumper.h ---------------------------------- *- C++ --*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H |
| 10 | #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H |
| 11 | |
| 12 | #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h" |
| 13 | |
| 14 | namespace llvm { |
| 15 | namespace codeview { |
| 16 | class LazyRandomTypeCollection; |
| 17 | } |
| 18 | |
| 19 | namespace pdb { |
| 20 | class LinePrinter; |
Zachary Turner | 6047858 | 2018-01-05 19:12:40 +0000 | [diff] [blame] | 21 | class SymbolGroup; |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 22 | |
| 23 | class MinimalSymbolDumper : public codeview::SymbolVisitorCallbacks { |
| 24 | public: |
| 25 | MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 26 | codeview::LazyRandomTypeCollection &Ids, |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 27 | codeview::LazyRandomTypeCollection &Types) |
Zachary Turner | f401e11 | 2017-08-17 20:04:31 +0000 | [diff] [blame] | 28 | : P(P), RecordBytes(RecordBytes), Ids(Ids), Types(Types) {} |
Zachary Turner | 6047858 | 2018-01-05 19:12:40 +0000 | [diff] [blame] | 29 | MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, |
| 30 | const SymbolGroup &SymGroup, |
| 31 | codeview::LazyRandomTypeCollection &Ids, |
| 32 | codeview::LazyRandomTypeCollection &Types) |
| 33 | : P(P), RecordBytes(RecordBytes), SymGroup(&SymGroup), Ids(Ids), |
| 34 | Types(Types) {} |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 35 | |
| 36 | Error visitSymbolBegin(codeview::CVSymbol &Record) override; |
Zachary Turner | af8c75a | 2017-06-30 21:35:00 +0000 | [diff] [blame] | 37 | Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override; |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 38 | Error visitSymbolEnd(codeview::CVSymbol &Record) override; |
| 39 | |
Zachary Turner | 6047858 | 2018-01-05 19:12:40 +0000 | [diff] [blame] | 40 | void setSymbolGroup(const SymbolGroup *Group) { SymGroup = Group; } |
| 41 | |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 42 | #define SYMBOL_RECORD(EnumName, EnumVal, Name) \ |
| 43 | virtual Error visitKnownRecord(codeview::CVSymbol &CVR, \ |
| 44 | codeview::Name &Record) override; |
| 45 | #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) |
| 46 | #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def" |
| 47 | |
| 48 | private: |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 49 | std::string typeOrIdIndex(codeview::TypeIndex TI, bool IsType) const; |
| 50 | |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 51 | std::string typeIndex(codeview::TypeIndex TI) const; |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 52 | std::string idIndex(codeview::TypeIndex TI) const; |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 53 | |
| 54 | LinePrinter &P; |
Reid Kleckner | a6f6426 | 2018-09-11 22:00:50 +0000 | [diff] [blame] | 55 | |
| 56 | /// Dumping certain records requires knowing what machine this is. The |
| 57 | /// S_COMPILE3 record will tell us, but if we don't see one, default to X64. |
| 58 | codeview::CPUType CompilationCPU = codeview::CPUType::X64; |
| 59 | |
Zachary Turner | f401e11 | 2017-08-17 20:04:31 +0000 | [diff] [blame] | 60 | bool RecordBytes; |
Zachary Turner | 6047858 | 2018-01-05 19:12:40 +0000 | [diff] [blame] | 61 | const SymbolGroup *SymGroup = nullptr; |
Zachary Turner | 59e3ae8 | 2017-08-08 18:34:44 +0000 | [diff] [blame] | 62 | codeview::LazyRandomTypeCollection &Ids; |
Zachary Turner | 6305545 | 2017-06-15 22:24:24 +0000 | [diff] [blame] | 63 | codeview::LazyRandomTypeCollection &Types; |
| 64 | }; |
| 65 | } // namespace pdb |
| 66 | } // namespace llvm |
| 67 | |
Reid Kleckner | a6f6426 | 2018-09-11 22:00:50 +0000 | [diff] [blame] | 68 | #endif |