llvm-dwarfdump.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/MapVector.h"
  11. #include "llvm/ADT/StringMap.h"
  12. #include "llvm/ADT/Twine.h"
  13. #include "llvm/DebugInfo/DWARF/DWARFContext.h"
  14. #include "llvm/Object/ObjectFile.h"
  15. #include "llvm/Support/raw_ostream.h"
  16. namespace llvm {
  17. namespace dwarfdump {
  18. /// Holds cumulative section sizes for an object file.
  19. struct SectionSizes {
  20. /// Map of .debug section names and their sizes across all such-named
  21. /// sections.
  22. MapVector<std::string, uint64_t, StringMap<uint64_t>> DebugSectionSizes;
  23. /// Total number of bytes of all sections.
  24. uint64_t TotalObjectSize = 0;
  25. /// Total number of bytes of all debug sections.
  26. uint64_t TotalDebugSectionsSize = 0;
  27. };
  28. /// Calculate the section sizes.
  29. void calculateSectionSizes(const object::ObjectFile &Obj, SectionSizes &Sizes,
  30. const Twine &Filename);
  31. bool collectStatsForObjectFile(object::ObjectFile &Obj, DWARFContext &DICtx,
  32. const Twine &Filename, raw_ostream &OS);
  33. bool collectObjectSectionSizes(object::ObjectFile &Obj, DWARFContext &DICtx,
  34. const Twine &Filename, raw_ostream &OS);
  35. } // namespace dwarfdump
  36. } // namespace llvm
  37. #endif