blob: 033e193cee6c1c3e58743b08e197d85674d8516e [file] [log] [blame]
Zachary Turner7e5d31e2017-06-15 22:24:24 +00001//===- 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
15namespace llvm {
16namespace codeview {
17class LazyRandomTypeCollection;
18}
19
20namespace pdb {
21class LinePrinter;
Zachary Turnerd9e5a1f2018-01-05 19:12:40 +000022class SymbolGroup;
Zachary Turner7e5d31e2017-06-15 22:24:24 +000023
24class MinimalSymbolDumper : public codeview::SymbolVisitorCallbacks {
25public:
26 MinimalSymbolDumper(LinePrinter &P, bool RecordBytes,
Zachary Turnere87e5c32017-08-08 18:34:44 +000027 codeview::LazyRandomTypeCollection &Ids,
Zachary Turner7e5d31e2017-06-15 22:24:24 +000028 codeview::LazyRandomTypeCollection &Types)
Zachary Turner54e28fe2017-08-17 20:04:31 +000029 : P(P), RecordBytes(RecordBytes), Ids(Ids), Types(Types) {}
Zachary Turnerd9e5a1f2018-01-05 19:12:40 +000030 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 Turner7e5d31e2017-06-15 22:24:24 +000036
37 Error visitSymbolBegin(codeview::CVSymbol &Record) override;
Zachary Turnerd36e1552017-06-30 21:35:00 +000038 Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override;
Zachary Turner7e5d31e2017-06-15 22:24:24 +000039 Error visitSymbolEnd(codeview::CVSymbol &Record) override;
40
Zachary Turnerd9e5a1f2018-01-05 19:12:40 +000041 void setSymbolGroup(const SymbolGroup *Group) { SymGroup = Group; }
42
Zachary Turner7e5d31e2017-06-15 22:24:24 +000043#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
49private:
Zachary Turnere87e5c32017-08-08 18:34:44 +000050 std::string typeOrIdIndex(codeview::TypeIndex TI, bool IsType) const;
51
Zachary Turner7e5d31e2017-06-15 22:24:24 +000052 std::string typeIndex(codeview::TypeIndex TI) const;
Zachary Turnere87e5c32017-08-08 18:34:44 +000053 std::string idIndex(codeview::TypeIndex TI) const;
Zachary Turner7e5d31e2017-06-15 22:24:24 +000054
55 LinePrinter &P;
Reid Klecknerb73f47d2018-09-11 22:00:50 +000056
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 Turner54e28fe2017-08-17 20:04:31 +000061 bool RecordBytes;
Zachary Turnerd9e5a1f2018-01-05 19:12:40 +000062 const SymbolGroup *SymGroup = nullptr;
Zachary Turnere87e5c32017-08-08 18:34:44 +000063 codeview::LazyRandomTypeCollection &Ids;
Zachary Turner7e5d31e2017-06-15 22:24:24 +000064 codeview::LazyRandomTypeCollection &Types;
65};
66} // namespace pdb
67} // namespace llvm
68
Reid Klecknerb73f47d2018-09-11 22:00:50 +000069#endif