Line data Source code
1 : //===- DWARFObject.h --------------------------------------------*- C++ -*-===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===-----------------------------------------------------------------------===/
9 :
10 : #ifndef LLVM_DEBUGINFO_DWARF_DWARFOBJECT_H
11 : #define LLVM_DEBUGINFO_DWARF_DWARFOBJECT_H
12 :
13 : #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
14 : #include "llvm/DebugInfo/DWARF/DWARFSection.h"
15 : #include "llvm/Object/ObjectFile.h"
16 :
17 : namespace llvm {
18 : // This is responsible for low level access to the object file. It
19 : // knows how to find the required sections and compute relocated
20 : // values.
21 : // The default implementations of the get<Section> methods return dummy values.
22 : // This is to allow clients that only need some of those to implement just the
23 : // ones they need. We can't use unreachable for as many cases because the parser
24 : // implementation is eager and will call some of these methods even if the
25 : // result is not used.
26 : class DWARFObject {
27 : DWARFSection Dummy;
28 :
29 : public:
30 0 : virtual ~DWARFObject() = default;
31 0 : virtual StringRef getFileName() const { llvm_unreachable("unimplemented"); }
32 0 : virtual const object::ObjectFile *getFile() const { return nullptr; }
33 0 : virtual ArrayRef<SectionName> getSectionNames() const { return {}; }
34 : virtual bool isLittleEndian() const = 0;
35 0 : virtual uint8_t getAddressSize() const { llvm_unreachable("unimplemented"); }
36 0 : virtual const DWARFSection &getInfoSection() const { return Dummy; }
37 : virtual void
38 197 : forEachTypesSections(function_ref<void(const DWARFSection &)> F) const {}
39 0 : virtual StringRef getAbbrevSection() const { return ""; }
40 0 : virtual const DWARFSection &getLocSection() const { return Dummy; }
41 0 : virtual StringRef getARangeSection() const { return ""; }
42 0 : virtual StringRef getDebugFrameSection() const { return ""; }
43 0 : virtual StringRef getEHFrameSection() const { return ""; }
44 0 : virtual const DWARFSection &getLineSection() const { return Dummy; }
45 0 : virtual StringRef getLineStringSection() const { return ""; }
46 0 : virtual StringRef getStringSection() const { return ""; }
47 0 : virtual const DWARFSection &getRangeSection() const { return Dummy; }
48 1 : virtual const DWARFSection &getRnglistsSection() const { return Dummy; }
49 0 : virtual StringRef getMacinfoSection() const { return ""; }
50 0 : virtual StringRef getPubNamesSection() const { return ""; }
51 0 : virtual StringRef getPubTypesSection() const { return ""; }
52 0 : virtual StringRef getGnuPubNamesSection() const { return ""; }
53 0 : virtual StringRef getGnuPubTypesSection() const { return ""; }
54 197 : virtual const DWARFSection &getStringOffsetSection() const { return Dummy; }
55 0 : virtual const DWARFSection &getInfoDWOSection() const { return Dummy; }
56 : virtual void
57 0 : forEachTypesDWOSections(function_ref<void(const DWARFSection &)> F) const {}
58 0 : virtual StringRef getAbbrevDWOSection() const { return ""; }
59 0 : virtual const DWARFSection &getLineDWOSection() const { return Dummy; }
60 0 : virtual const DWARFSection &getLocDWOSection() const { return Dummy; }
61 0 : virtual StringRef getStringDWOSection() const { return ""; }
62 0 : virtual const DWARFSection &getStringOffsetDWOSection() const {
63 0 : return Dummy;
64 : }
65 0 : virtual const DWARFSection &getRangeDWOSection() const { return Dummy; }
66 0 : virtual const DWARFSection &getRnglistsDWOSection() const { return Dummy; }
67 197 : virtual const DWARFSection &getAddrSection() const { return Dummy; }
68 0 : virtual const DWARFSection &getAppleNamesSection() const { return Dummy; }
69 0 : virtual const DWARFSection &getAppleTypesSection() const { return Dummy; }
70 0 : virtual const DWARFSection &getAppleNamespacesSection() const {
71 0 : return Dummy;
72 : }
73 0 : virtual const DWARFSection &getDebugNamesSection() const { return Dummy; }
74 0 : virtual const DWARFSection &getAppleObjCSection() const { return Dummy; }
75 0 : virtual StringRef getCUIndexSection() const { return ""; }
76 0 : virtual StringRef getGdbIndexSection() const { return ""; }
77 0 : virtual StringRef getTUIndexSection() const { return ""; }
78 : virtual Optional<RelocAddrEntry> find(const DWARFSection &Sec,
79 : uint64_t Pos) const = 0;
80 : };
81 :
82 : } // namespace llvm
83 : #endif
|