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 9 #ifndef LLVM_TOOLS_LLVM_DWARFDUMP_LLVM_DWARFDUMP_H 10 #define LLVM_TOOLS_LLVM_DWARFDUMP_LLVM_DWARFDUMP_H 11 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 17 namespace llvm { 18 namespace dwarfdump { 19 20 /// Holds cumulative section sizes for an object file. 21 struct SectionSizes { 22 /// Map of .debug section names and their sizes across all such-named 23 /// sections. 24 StringMap<uint64_t> DebugSectionSizes; 25 /// Total number of bytes of all sections. 26 uint64_t TotalObjectSize = 0; 27 /// Total number of bytes of all debug sections. 28 uint64_t TotalDebugSectionsSize = 0; 29 }; 30 31 /// Calculate the section sizes. 32 void calculateSectionSizes(const object::ObjectFile &Obj, SectionSizes &Sizes, 33 const Twine &Filename); 34 35 bool collectStatsForObjectFile(object::ObjectFile &Obj, DWARFContext &DICtx, 36 const Twine &Filename, raw_ostream &OS); 37 bool collectObjectSectionSizes(object::ObjectFile &Obj, DWARFContext &DICtx, 38 const Twine &Filename, raw_ostream &OS); 39 40 } // namespace dwarfdump 41 } // namespace llvm 42 43 #endif 44