PDBStringTable.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- PDBStringTable.h - PDB String Table -----------------------*- 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_PDB_NATIVE_PDBSTRINGTABLE_H
  14. #define LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLE_H
  15. #include "llvm/ADT/ArrayRef.h"
  16. #include "llvm/ADT/StringRef.h"
  17. #include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
  18. #include "llvm/Support/BinaryStreamArray.h"
  19. #include "llvm/Support/BinaryStreamRef.h"
  20. #include "llvm/Support/Endian.h"
  21. #include "llvm/Support/Error.h"
  22. #include <cstdint>
  23. namespace llvm {
  24. class BinaryStreamReader;
  25. namespace msf {
  26. class MappedBlockStream;
  27. }
  28. namespace pdb {
  29. struct PDBStringTableHeader;
  30. class PDBStringTable {
  31. public:
  32. Error reload(BinaryStreamReader &Reader);
  33. uint32_t getByteSize() const;
  34. uint32_t getNameCount() const;
  35. uint32_t getHashVersion() const;
  36. uint32_t getSignature() const;
  37. Expected<StringRef> getStringForID(uint32_t ID) const;
  38. Expected<uint32_t> getIDForString(StringRef Str) const;
  39. FixedStreamArray<support::ulittle32_t> name_ids() const;
  40. const codeview::DebugStringTableSubsectionRef &getStringTable() const;
  41. private:
  42. Error readHeader(BinaryStreamReader &Reader);
  43. Error readStrings(BinaryStreamReader &Reader);
  44. Error readHashTable(BinaryStreamReader &Reader);
  45. Error readEpilogue(BinaryStreamReader &Reader);
  46. const PDBStringTableHeader *Header = nullptr;
  47. codeview::DebugStringTableSubsectionRef Strings;
  48. FixedStreamArray<support::ulittle32_t> IDs;
  49. uint32_t NameCount = 0;
  50. };
  51. } // end namespace pdb
  52. } // end namespace llvm
  53. #endif // LLVM_DEBUGINFO_PDB_NATIVE_PDBSTRINGTABLE_H
  54. #ifdef __GNUC__
  55. #pragma GCC diagnostic pop
  56. #endif