blob: 215da2e2b522dd17bf6a0939ac4aa61c7e2d82b1 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- SymbolDumper.h - CodeView symbol info dumper ------------*- 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_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
11#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
12
13#include "llvm/ADT/ArrayRef.h"
14#include "llvm/ADT/StringSet.h"
15#include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
16#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
17#include "llvm/DebugInfo/CodeView/TypeIndex.h"
18
19namespace llvm {
20class ScopedPrinter;
21
22namespace codeview {
23class TypeCollection;
24
25/// Dumper for CodeView symbol streams found in COFF object files and PDB files.
26class CVSymbolDumper {
27public:
28 CVSymbolDumper(ScopedPrinter &W, TypeCollection &Types,
29 CodeViewContainer Container,
Andrew Scull0372a572018-11-16 15:47:06 +000030 std::unique_ptr<SymbolDumpDelegate> ObjDelegate, CPUType CPU,
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010031 bool PrintRecordBytes)
32 : W(W), Types(Types), Container(Container),
Andrew Scull0372a572018-11-16 15:47:06 +000033 ObjDelegate(std::move(ObjDelegate)), CompilationCPUType(CPU),
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010034 PrintRecordBytes(PrintRecordBytes) {}
35
36 /// Dumps one type record. Returns false if there was a type parsing error,
37 /// and true otherwise. This should be called in order, since the dumper
38 /// maintains state about previous records which are necessary for cross
39 /// type references.
40 Error dump(CVRecord<SymbolKind> &Record);
41
42 /// Dumps the type records in Data. Returns false if there was a type stream
43 /// parse error, and true otherwise.
44 Error dump(const CVSymbolArray &Symbols);
45
Andrew Scull0372a572018-11-16 15:47:06 +000046 CPUType getCompilationCPUType() const { return CompilationCPUType; }
47
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010048private:
49 ScopedPrinter &W;
50 TypeCollection &Types;
51 CodeViewContainer Container;
52 std::unique_ptr<SymbolDumpDelegate> ObjDelegate;
Andrew Scull0372a572018-11-16 15:47:06 +000053 CPUType CompilationCPUType;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010054 bool PrintRecordBytes;
55};
56} // end namespace codeview
57} // end namespace llvm
58
59#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H