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