SymbolDumper.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- SymbolDumper.h - CodeView symbol info dumper ------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
  14. #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
  15. #include "llvm/ADT/ArrayRef.h"
  16. #include "llvm/ADT/StringSet.h"
  17. #include "llvm/DebugInfo/CodeView/CVRecord.h"
  18. #include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
  19. #include "llvm/DebugInfo/CodeView/TypeIndex.h"
  20. namespace llvm {
  21. class ScopedPrinter;
  22. namespace codeview {
  23. class TypeCollection;
  24. /// Dumper for CodeView symbol streams found in COFF object files and PDB files.
  25. class CVSymbolDumper {
  26. public:
  27. CVSymbolDumper(ScopedPrinter &W, TypeCollection &Types,
  28. CodeViewContainer Container,
  29. std::unique_ptr<SymbolDumpDelegate> ObjDelegate, CPUType CPU,
  30. bool PrintRecordBytes)
  31. : W(W), Types(Types), Container(Container),
  32. ObjDelegate(std::move(ObjDelegate)), CompilationCPUType(CPU),
  33. PrintRecordBytes(PrintRecordBytes) {}
  34. /// Dumps one type record. Returns false if there was a type parsing error,
  35. /// and true otherwise. This should be called in order, since the dumper
  36. /// maintains state about previous records which are necessary for cross
  37. /// type references.
  38. Error dump(CVRecord<SymbolKind> &Record);
  39. /// Dumps the type records in Data. Returns false if there was a type stream
  40. /// parse error, and true otherwise.
  41. Error dump(const CVSymbolArray &Symbols);
  42. CPUType getCompilationCPUType() const { return CompilationCPUType; }
  43. private:
  44. ScopedPrinter &W;
  45. TypeCollection &Types;
  46. CodeViewContainer Container;
  47. std::unique_ptr<SymbolDumpDelegate> ObjDelegate;
  48. CPUType CompilationCPUType;
  49. bool PrintRecordBytes;
  50. };
  51. } // end namespace codeview
  52. } // end namespace llvm
  53. #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLDUMPER_H
  54. #ifdef __GNUC__
  55. #pragma GCC diagnostic pop
  56. #endif