Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:41

0001 //===- DWARFDebugRnglists.h -------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGRNGLISTS_H
0010 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGRNGLISTS_H
0011 
0012 #include "llvm/ADT/STLFunctionalExtras.h"
0013 #include "llvm/BinaryFormat/Dwarf.h"
0014 #include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
0015 #include "llvm/DebugInfo/DWARF/DWARFListTable.h"
0016 #include <cstdint>
0017 
0018 namespace llvm {
0019 
0020 class Error;
0021 class raw_ostream;
0022 class DWARFUnit;
0023 class DWARFDataExtractor;
0024 struct DIDumpOptions;
0025 namespace object {
0026 struct SectionedAddress;
0027 }
0028 
0029 /// A class representing a single range list entry.
0030 struct RangeListEntry : public DWARFListEntryBase {
0031   /// The values making up the range list entry. Most represent a range with
0032   /// a start and end address or a start address and a length. Others are
0033   /// single value base addresses or end-of-list with no values. The unneeded
0034   /// values are semantically undefined, but initialized to 0.
0035   uint64_t Value0;
0036   uint64_t Value1;
0037 
0038   Error extract(DWARFDataExtractor Data, uint64_t *OffsetPtr);
0039   void
0040   dump(raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength,
0041        uint64_t &CurrentBase, DIDumpOptions DumpOpts,
0042        llvm::function_ref<std::optional<object::SectionedAddress>(uint32_t)>
0043            LookupPooledAddress) const;
0044   bool isSentinel() const { return EntryKind == dwarf::DW_RLE_end_of_list; }
0045 };
0046 
0047 /// A class representing a single rangelist.
0048 class DWARFDebugRnglist : public DWARFListType<RangeListEntry> {
0049 public:
0050   /// Build a DWARFAddressRangesVector from a rangelist.
0051   DWARFAddressRangesVector getAbsoluteRanges(
0052       std::optional<object::SectionedAddress> BaseAddr, uint8_t AddressByteSize,
0053       function_ref<std::optional<object::SectionedAddress>(uint32_t)>
0054           LookupPooledAddress) const;
0055 
0056   /// Build a DWARFAddressRangesVector from a rangelist.
0057   DWARFAddressRangesVector
0058   getAbsoluteRanges(std::optional<object::SectionedAddress> BaseAddr,
0059                     DWARFUnit &U) const;
0060 };
0061 
0062 class DWARFDebugRnglistTable : public DWARFListTableBase<DWARFDebugRnglist> {
0063 public:
0064   DWARFDebugRnglistTable()
0065       : DWARFListTableBase(/* SectionName    = */ ".debug_rnglists",
0066                            /* HeaderString   = */ "ranges:",
0067                            /* ListTypeString = */ "range") {}
0068 };
0069 
0070 } // end namespace llvm
0071 
0072 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGRNGLISTS_H