Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- DWARFObject.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_DWARFOBJECT_H
0010 #define LLVM_DEBUGINFO_DWARF_DWARFOBJECT_H
0011 
0012 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
0013 #include "llvm/DebugInfo/DWARF/DWARFSection.h"
0014 #include "llvm/Object/ObjectFile.h"
0015 #include <optional>
0016 
0017 namespace llvm {
0018 // This is responsible for low level access to the object file. It
0019 // knows how to find the required sections and compute relocated
0020 // values.
0021 // The default implementations of the get<Section> methods return dummy values.
0022 // This is to allow clients that only need some of those to implement just the
0023 // ones they need. We can't use unreachable for as many cases because the parser
0024 // implementation is eager and will call some of these methods even if the
0025 // result is not used.
0026 class DWARFObject {
0027   DWARFSection Dummy;
0028 
0029 public:
0030   virtual ~DWARFObject() = default;
0031   virtual StringRef getFileName() const { llvm_unreachable("unimplemented"); }
0032   virtual const object::ObjectFile *getFile() const { return nullptr; }
0033   virtual ArrayRef<SectionName> getSectionNames() const { return {}; }
0034   virtual bool isLittleEndian() const = 0;
0035   virtual uint8_t getAddressSize() const { llvm_unreachable("unimplemented"); }
0036   virtual void
0037   forEachInfoSections(function_ref<void(const DWARFSection &)> F) const {}
0038   virtual void
0039   forEachTypesSections(function_ref<void(const DWARFSection &)> F) const {}
0040   virtual StringRef getAbbrevSection() const { return ""; }
0041   virtual const DWARFSection &getLocSection() const { return Dummy; }
0042   virtual const DWARFSection &getLoclistsSection() const { return Dummy; }
0043   virtual StringRef getArangesSection() const { return ""; }
0044   virtual const DWARFSection &getFrameSection() const { return Dummy; }
0045   virtual const DWARFSection &getEHFrameSection() const { return Dummy; }
0046   virtual const DWARFSection &getLineSection() const { return Dummy; }
0047   virtual StringRef getLineStrSection() const { return ""; }
0048   virtual StringRef getStrSection() const { return ""; }
0049   virtual const DWARFSection &getRangesSection() const { return Dummy; }
0050   virtual const DWARFSection &getRnglistsSection() const { return Dummy; }
0051   virtual const DWARFSection &getMacroSection() const { return Dummy; }
0052   virtual StringRef getMacroDWOSection() const { return ""; }
0053   virtual StringRef getMacinfoSection() const { return ""; }
0054   virtual StringRef getMacinfoDWOSection() const { return ""; }
0055   virtual const DWARFSection &getPubnamesSection() const { return Dummy; }
0056   virtual const DWARFSection &getPubtypesSection() const { return Dummy; }
0057   virtual const DWARFSection &getGnuPubnamesSection() const { return Dummy; }
0058   virtual const DWARFSection &getGnuPubtypesSection() const { return Dummy; }
0059   virtual const DWARFSection &getStrOffsetsSection() const { return Dummy; }
0060   virtual void
0061   forEachInfoDWOSections(function_ref<void(const DWARFSection &)> F) const {}
0062   virtual void
0063   forEachTypesDWOSections(function_ref<void(const DWARFSection &)> F) const {}
0064   virtual StringRef getAbbrevDWOSection() const { return ""; }
0065   virtual const DWARFSection &getLineDWOSection() const { return Dummy; }
0066   virtual const DWARFSection &getLocDWOSection() const { return Dummy; }
0067   virtual const DWARFSection &getLoclistsDWOSection() const { return Dummy; }
0068   virtual StringRef getStrDWOSection() const { return ""; }
0069   virtual const DWARFSection &getStrOffsetsDWOSection() const {
0070     return Dummy;
0071   }
0072   virtual const DWARFSection &getRangesDWOSection() const { return Dummy; }
0073   virtual const DWARFSection &getRnglistsDWOSection() const { return Dummy; }
0074   virtual const DWARFSection &getAddrSection() const { return Dummy; }
0075   virtual const DWARFSection &getAppleNamesSection() const { return Dummy; }
0076   virtual const DWARFSection &getAppleTypesSection() const { return Dummy; }
0077   virtual const DWARFSection &getAppleNamespacesSection() const {
0078     return Dummy;
0079   }
0080   virtual const DWARFSection &getNamesSection() const { return Dummy; }
0081   virtual const DWARFSection &getAppleObjCSection() const { return Dummy; }
0082   virtual StringRef getCUIndexSection() const { return ""; }
0083   virtual StringRef getGdbIndexSection() const { return ""; }
0084   virtual StringRef getTUIndexSection() const { return ""; }
0085   virtual std::optional<RelocAddrEntry> find(const DWARFSection &Sec,
0086                                              uint64_t Pos) const = 0;
0087 };
0088 
0089 } // namespace llvm
0090 #endif