//===- DWARFUnitIndex.h -----------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_DEBUGINFO_DWARF_DWARFUNITINDEX_H #define LLVM_DEBUGINFO_DWARF_DWARFUNITINDEX_H #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include <cstdint> #include <memory> namespace llvm { class raw_ostream; class DataExtractor; /// The enum of section identifiers to be used in internal interfaces. /// /// Pre-standard implementation of package files defined a number of section /// identifiers with values that clash definitions in the DWARFv5 standard. /// See https://gcc.gnu.org/wiki/DebugFissionDWP and Section 7.3.5.3 in DWARFv5. /// /// The following identifiers are the same in the proposal and in DWARFv5: /// - DW_SECT_INFO = 1 (.debug_info.dwo) /// - DW_SECT_ABBREV = 3 (.debug_abbrev.dwo) /// - DW_SECT_LINE = 4 (.debug_line.dwo) /// - DW_SECT_STR_OFFSETS = 6 (.debug_str_offsets.dwo) /// /// The following identifiers are defined only in DWARFv5: /// - DW_SECT_LOCLISTS = 5 (.debug_loclists.dwo) /// - DW_SECT_RNGLISTS = 8 (.debug_rnglists.dwo) /// /// The following identifiers are defined only in the GNU proposal: /// - DW_SECT_TYPES = 2 (.debug_types.dwo) /// - DW_SECT_LOC = 5 (.debug_loc.dwo) /// - DW_SECT_MACINFO = 7 (.debug_macinfo.dwo) /// /// DW_SECT_MACRO for the .debug_macro.dwo section is defined in both standards, /// but with different values, 8 in GNU and 7 in DWARFv5. /// /// This enum defines constants to represent the identifiers of both sets. /// For DWARFv5 ones, the values are the same as defined in the standard. /// For pre-standard ones that correspond to sections being deprecated in /// DWARFv5, the values are chosen arbitrary and a tag "_EXT_" is added to /// the names. /// /// The enum is for internal use only. The user should not expect the values /// to correspond to any input/output constants. Special conversion functions, /// serializeSectionKind() and deserializeSectionKind(), should be used for /// the translation. enum DWARFSectionKind { … }; inline const char *toString(DWARFSectionKind Kind) { … } /// Convert the internal value for a section kind to an on-disk value. /// /// The conversion depends on the version of the index section. /// IndexVersion is expected to be either 2 for pre-standard GNU proposal /// or 5 for DWARFv5 package file. uint32_t serializeSectionKind(DWARFSectionKind Kind, unsigned IndexVersion); /// Convert a value read from an index section to the internal representation. /// /// The conversion depends on the index section version, which is expected /// to be either 2 for pre-standard GNU proposal or 5 for DWARFv5 package file. DWARFSectionKind deserializeSectionKind(uint32_t Value, unsigned IndexVersion); class DWARFUnitIndex { … }; } // end namespace llvm #endif // LLVM_DEBUGINFO_DWARF_DWARFUNITINDEX_H