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