llvm-dwarfdump.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //===-- llvm-dwarfdump - Debug info dumping utility -------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_TOOLS_LLVM_DWARFDUMP_LLVM_DWARFDUMP_H
  9. #define LLVM_TOOLS_LLVM_DWARFDUMP_LLVM_DWARFDUMP_H
  10. #include "llvm/ADT/Twine.h"
  11. #include "llvm/DebugInfo/DWARF/DWARFContext.h"
  12. #include "llvm/Object/ObjectFile.h"
  13. #include "llvm/Support/raw_ostream.h"
  14. namespace llvm {
  15. namespace dwarfdump {
  16. /// Holds cumulative section sizes for an object file.
  17. struct SectionSizes {
  18. /// Map of .debug section names and their sizes across all such-named
  19. /// sections.
  20. StringMap<uint64_t> DebugSectionSizes;
  21. /// Total number of bytes of all sections.
  22. uint64_t TotalObjectSize = 0;
  23. /// Total number of bytes of all debug sections.
  24. uint64_t TotalDebugSectionsSize = 0;
  25. };
  26. /// Calculate the section sizes.
  27. void calculateSectionSizes(const object::ObjectFile &Obj, SectionSizes &Sizes,
  28. const Twine &Filename);
  29. bool collectStatsForObjectFile(object::ObjectFile &Obj, DWARFContext &DICtx,
  30. const Twine &Filename, raw_ostream &OS);
  31. bool collectObjectSectionSizes(object::ObjectFile &Obj, DWARFContext &DICtx,
  32. const Twine &Filename, raw_ostream &OS);
  33. } // namespace dwarfdump
  34. } // namespace llvm
  35. #endif