LLVM  9.0.0svn
DWARFObject.h
Go to the documentation of this file.
1 //===- DWARFObject.h --------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===-----------------------------------------------------------------------===/
8 
9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFOBJECT_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFOBJECT_H
11 
14 #include "llvm/Object/ObjectFile.h"
15 
16 namespace llvm {
17 // This is responsible for low level access to the object file. It
18 // knows how to find the required sections and compute relocated
19 // values.
20 // The default implementations of the get<Section> methods return dummy values.
21 // This is to allow clients that only need some of those to implement just the
22 // ones they need. We can't use unreachable for as many cases because the parser
23 // implementation is eager and will call some of these methods even if the
24 // result is not used.
25 class DWARFObject {
26  DWARFSection Dummy;
27 
28 public:
29  virtual ~DWARFObject() = default;
30  virtual StringRef getFileName() const { llvm_unreachable("unimplemented"); }
31  virtual const object::ObjectFile *getFile() const { return nullptr; }
32  virtual ArrayRef<SectionName> getSectionNames() const { return {}; }
33  virtual bool isLittleEndian() const = 0;
34  virtual uint8_t getAddressSize() const { llvm_unreachable("unimplemented"); }
35  virtual void
37  virtual void
39  virtual StringRef getAbbrevSection() const { return ""; }
40  virtual const DWARFSection &getLocSection() const { return Dummy; }
41  virtual const DWARFSection &getLoclistsSection() const { return Dummy; }
42  virtual StringRef getARangeSection() const { return ""; }
43  virtual StringRef getDebugFrameSection() const { return ""; }
44  virtual StringRef getEHFrameSection() const { return ""; }
45  virtual const DWARFSection &getLineSection() const { return Dummy; }
46  virtual StringRef getLineStringSection() const { return ""; }
47  virtual StringRef getStringSection() const { return ""; }
48  virtual const DWARFSection &getRangeSection() const { return Dummy; }
49  virtual const DWARFSection &getRnglistsSection() const { return Dummy; }
50  virtual StringRef getMacinfoSection() const { return ""; }
51  virtual const DWARFSection &getPubNamesSection() const { return Dummy; }
52  virtual const DWARFSection &getPubTypesSection() const { return Dummy; }
53  virtual const DWARFSection &getGnuPubNamesSection() const { return Dummy; }
54  virtual const DWARFSection &getGnuPubTypesSection() const { return Dummy; }
55  virtual const DWARFSection &getStringOffsetSection() const { return Dummy; }
56  virtual void
58  virtual void
60  virtual StringRef getAbbrevDWOSection() const { return ""; }
61  virtual const DWARFSection &getLineDWOSection() const { return Dummy; }
62  virtual const DWARFSection &getLocDWOSection() const { return Dummy; }
63  virtual StringRef getStringDWOSection() const { return ""; }
64  virtual const DWARFSection &getStringOffsetDWOSection() const {
65  return Dummy;
66  }
67  virtual const DWARFSection &getRangeDWOSection() const { return Dummy; }
68  virtual const DWARFSection &getRnglistsDWOSection() const { return Dummy; }
69  virtual const DWARFSection &getAddrSection() const { return Dummy; }
70  virtual const DWARFSection &getAppleNamesSection() const { return Dummy; }
71  virtual const DWARFSection &getAppleTypesSection() const { return Dummy; }
72  virtual const DWARFSection &getAppleNamespacesSection() const {
73  return Dummy;
74  }
75  virtual const DWARFSection &getDebugNamesSection() const { return Dummy; }
76  virtual const DWARFSection &getAppleObjCSection() const { return Dummy; }
77  virtual StringRef getCUIndexSection() const { return ""; }
78  virtual StringRef getGdbIndexSection() const { return ""; }
79  virtual StringRef getTUIndexSection() const { return ""; }
80  virtual Optional<RelocAddrEntry> find(const DWARFSection &Sec,
81  uint64_t Pos) const = 0;
82 };
83 
84 } // namespace llvm
85 #endif
virtual const DWARFSection & getAddrSection() const
Definition: DWARFObject.h:69
virtual void forEachTypesDWOSections(function_ref< void(const DWARFSection &)> F) const
Definition: DWARFObject.h:59
virtual const DWARFSection & getGnuPubNamesSection() const
Definition: DWARFObject.h:53
virtual void forEachTypesSections(function_ref< void(const DWARFSection &)> F) const
Definition: DWARFObject.h:38
virtual const DWARFSection & getLocDWOSection() const
Definition: DWARFObject.h:62
This class represents lattice values for constants.
Definition: AllocatorList.h:23
virtual Optional< RelocAddrEntry > find(const DWARFSection &Sec, uint64_t Pos) const =0
virtual StringRef getAbbrevSection() const
Definition: DWARFObject.h:39
virtual const DWARFSection & getLocSection() const
Definition: DWARFObject.h:40
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLExtras.h:116
This class is the base class for all object file types.
Definition: ObjectFile.h:225
virtual StringRef getLineStringSection() const
Definition: DWARFObject.h:46
virtual const DWARFSection & getGnuPubTypesSection() const
Definition: DWARFObject.h:54
F(f)
virtual const DWARFSection & getRnglistsDWOSection() const
Definition: DWARFObject.h:68
virtual StringRef getAbbrevDWOSection() const
Definition: DWARFObject.h:60
virtual ~DWARFObject()=default
virtual void forEachInfoSections(function_ref< void(const DWARFSection &)> F) const
Definition: DWARFObject.h:36
virtual const DWARFSection & getAppleTypesSection() const
Definition: DWARFObject.h:71
virtual bool isLittleEndian() const =0
virtual const DWARFSection & getStringOffsetDWOSection() const
Definition: DWARFObject.h:64
virtual StringRef getARangeSection() const
Definition: DWARFObject.h:42
virtual StringRef getMacinfoSection() const
Definition: DWARFObject.h:50
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
virtual StringRef getDebugFrameSection() const
Definition: DWARFObject.h:43
virtual const DWARFSection & getAppleObjCSection() const
Definition: DWARFObject.h:76
virtual uint8_t getAddressSize() const
Definition: DWARFObject.h:34
virtual const DWARFSection & getStringOffsetSection() const
Definition: DWARFObject.h:55
virtual StringRef getTUIndexSection() const
Definition: DWARFObject.h:79
virtual void forEachInfoDWOSections(function_ref< void(const DWARFSection &)> F) const
Definition: DWARFObject.h:57
virtual StringRef getFileName() const
Definition: DWARFObject.h:30
virtual const DWARFSection & getLineDWOSection() const
Definition: DWARFObject.h:61
virtual StringRef getStringSection() const
Definition: DWARFObject.h:47
virtual StringRef getStringDWOSection() const
Definition: DWARFObject.h:63
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual StringRef getCUIndexSection() const
Definition: DWARFObject.h:77
virtual const DWARFSection & getRnglistsSection() const
Definition: DWARFObject.h:49
virtual StringRef getEHFrameSection() const
Definition: DWARFObject.h:44
virtual const DWARFSection & getAppleNamespacesSection() const
Definition: DWARFObject.h:72
virtual const DWARFSection & getLineSection() const
Definition: DWARFObject.h:45
virtual const DWARFSection & getDebugNamesSection() const
Definition: DWARFObject.h:75
virtual const DWARFSection & getPubTypesSection() const
Definition: DWARFObject.h:52
virtual const DWARFSection & getRangeDWOSection() const
Definition: DWARFObject.h:67
virtual const DWARFSection & getAppleNamesSection() const
Definition: DWARFObject.h:70
virtual ArrayRef< SectionName > getSectionNames() const
Definition: DWARFObject.h:32
virtual const DWARFSection & getRangeSection() const
Definition: DWARFObject.h:48
virtual const object::ObjectFile * getFile() const
Definition: DWARFObject.h:31
virtual StringRef getGdbIndexSection() const
Definition: DWARFObject.h:78
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
virtual const DWARFSection & getLoclistsSection() const
Definition: DWARFObject.h:41
virtual const DWARFSection & getPubNamesSection() const
Definition: DWARFObject.h:51