ModuleDebugStream.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- 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. #ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
  10. #define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
  11. #include "llvm/ADT/iterator_range.h"
  12. #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
  13. #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
  14. #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
  15. #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
  16. #include "llvm/Support/BinaryStreamRef.h"
  17. #include "llvm/Support/Error.h"
  18. #include <cstdint>
  19. #include <memory>
  20. namespace llvm {
  21. namespace pdb {
  22. class DbiModuleDescriptor;
  23. class ModuleDebugStreamRef {
  24. using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
  25. public:
  26. ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
  27. std::unique_ptr<msf::MappedBlockStream> Stream);
  28. ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default;
  29. ModuleDebugStreamRef(const ModuleDebugStreamRef &Other) = default;
  30. ~ModuleDebugStreamRef();
  31. Error reload();
  32. uint32_t signature() const { return Signature; }
  33. iterator_range<codeview::CVSymbolArray::Iterator>
  34. symbols(bool *HadError) const;
  35. const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
  36. BinarySubstreamRef getSymbolsSubstream() const;
  37. BinarySubstreamRef getC11LinesSubstream() const;
  38. BinarySubstreamRef getC13LinesSubstream() const;
  39. BinarySubstreamRef getGlobalRefsSubstream() const;
  40. ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = delete;
  41. iterator_range<DebugSubsectionIterator> subsections() const;
  42. codeview::DebugSubsectionArray getSubsectionsArray() const {
  43. return Subsections;
  44. }
  45. bool hasDebugSubsections() const;
  46. Error commit();
  47. Expected<codeview::DebugChecksumsSubsectionRef>
  48. findChecksumsSubsection() const;
  49. private:
  50. const DbiModuleDescriptor &Mod;
  51. uint32_t Signature;
  52. std::shared_ptr<msf::MappedBlockStream> Stream;
  53. codeview::CVSymbolArray SymbolArray;
  54. BinarySubstreamRef SymbolsSubstream;
  55. BinarySubstreamRef C11LinesSubstream;
  56. BinarySubstreamRef C13LinesSubstream;
  57. BinarySubstreamRef GlobalRefsSubstream;
  58. codeview::DebugSubsectionArray Subsections;
  59. };
  60. } // end namespace pdb
  61. } // end namespace llvm
  62. #endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H