LLVM  7.0.0svn
DWARFObject.h
Go to the documentation of this file.
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 
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  virtual ~DWARFObject() = default;
31  virtual StringRef getFileName() const { llvm_unreachable("unimplemented"); }
32  virtual const object::ObjectFile *getFile() const { return nullptr; }
33  virtual ArrayRef<SectionName> getSectionNames() const { return {}; }
34  virtual bool isLittleEndian() const = 0;
35  virtual uint8_t getAddressSize() const { llvm_unreachable("unimplemented"); }
36  virtual const DWARFSection &getInfoSection() const { return Dummy; }
37  virtual void
39  virtual StringRef getAbbrevSection() const { return ""; }
40  virtual const DWARFSection &getLocSection() const { return Dummy; }
41  virtual StringRef getARangeSection() const { return ""; }
42  virtual StringRef getDebugFrameSection() const { return ""; }
43  virtual StringRef getEHFrameSection() const { return ""; }
44  virtual const DWARFSection &getLineSection() const { return Dummy; }
45  virtual StringRef getStringSection() const { return ""; }
46  virtual const DWARFSection &getRangeSection() const { return Dummy; }
47  virtual StringRef getMacinfoSection() const { return ""; }
48  virtual StringRef getPubNamesSection() const { return ""; }
49  virtual StringRef getPubTypesSection() const { return ""; }
50  virtual StringRef getGnuPubNamesSection() const { return ""; }
51  virtual StringRef getGnuPubTypesSection() const { return ""; }
52  virtual const DWARFSection &getStringOffsetSection() const { return Dummy; }
53  virtual const DWARFSection &getInfoDWOSection() const { return Dummy; }
54  virtual void
56  virtual StringRef getAbbrevDWOSection() const { return ""; }
57  virtual const DWARFSection &getLineDWOSection() const { return Dummy; }
58  virtual const DWARFSection &getLocDWOSection() const { return Dummy; }
59  virtual StringRef getStringDWOSection() const { return ""; }
60  virtual const DWARFSection &getStringOffsetDWOSection() const {
61  return Dummy;
62  }
63  virtual const DWARFSection &getRangeDWOSection() const { return Dummy; }
64  virtual const DWARFSection &getAddrSection() const { return Dummy; }
65  virtual const DWARFSection &getAppleNamesSection() const { return Dummy; }
66  virtual const DWARFSection &getAppleTypesSection() const { return Dummy; }
67  virtual const DWARFSection &getAppleNamespacesSection() const {
68  return Dummy;
69  }
70  virtual const DWARFSection &getAppleObjCSection() const { return Dummy; }
71  virtual StringRef getCUIndexSection() const { return ""; }
72  virtual StringRef getGdbIndexSection() const { return ""; }
73  virtual StringRef getTUIndexSection() const { return ""; }
74  virtual Optional<RelocAddrEntry> find(const DWARFSection &Sec,
75  uint64_t Pos) const = 0;
76 };
77 
78 } // namespace llvm
79 #endif
virtual const DWARFSection & getAddrSection() const
Definition: DWARFObject.h:64
virtual void forEachTypesDWOSections(function_ref< void(const DWARFSection &)> F) const
Definition: DWARFObject.h:55
virtual void forEachTypesSections(function_ref< void(const DWARFSection &)> F) const
Definition: DWARFObject.h:38
virtual const DWARFSection & getLocDWOSection() const
Definition: DWARFObject.h:58
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
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:89
This class is the base class for all object file types.
Definition: ObjectFile.h:190
F(f)
virtual StringRef getAbbrevDWOSection() const
Definition: DWARFObject.h:56
virtual ~DWARFObject()=default
virtual const DWARFSection & getAppleTypesSection() const
Definition: DWARFObject.h:66
virtual bool isLittleEndian() const =0
virtual StringRef getGnuPubNamesSection() const
Definition: DWARFObject.h:50
virtual const DWARFSection & getStringOffsetDWOSection() const
Definition: DWARFObject.h:60
virtual StringRef getARangeSection() const
Definition: DWARFObject.h:41
virtual StringRef getPubNamesSection() const
Definition: DWARFObject.h:48
virtual StringRef getMacinfoSection() const
Definition: DWARFObject.h:47
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
virtual StringRef getDebugFrameSection() const
Definition: DWARFObject.h:42
virtual const DWARFSection & getAppleObjCSection() const
Definition: DWARFObject.h:70
virtual uint8_t getAddressSize() const
Definition: DWARFObject.h:35
virtual const DWARFSection & getStringOffsetSection() const
Definition: DWARFObject.h:52
virtual StringRef getTUIndexSection() const
Definition: DWARFObject.h:73
virtual StringRef getFileName() const
Definition: DWARFObject.h:31
virtual const DWARFSection & getLineDWOSection() const
Definition: DWARFObject.h:57
virtual StringRef getStringSection() const
Definition: DWARFObject.h:45
virtual StringRef getStringDWOSection() const
Definition: DWARFObject.h:59
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
virtual StringRef getPubTypesSection() const
Definition: DWARFObject.h:49
virtual StringRef getCUIndexSection() const
Definition: DWARFObject.h:71
virtual StringRef getEHFrameSection() const
Definition: DWARFObject.h:43
virtual const DWARFSection & getAppleNamespacesSection() const
Definition: DWARFObject.h:67
virtual const DWARFSection & getInfoSection() const
Definition: DWARFObject.h:36
virtual const DWARFSection & getLineSection() const
Definition: DWARFObject.h:44
virtual const DWARFSection & getRangeDWOSection() const
Definition: DWARFObject.h:63
virtual StringRef getGnuPubTypesSection() const
Definition: DWARFObject.h:51
virtual const DWARFSection & getAppleNamesSection() const
Definition: DWARFObject.h:65
virtual ArrayRef< SectionName > getSectionNames() const
Definition: DWARFObject.h:33
virtual const DWARFSection & getRangeSection() const
Definition: DWARFObject.h:46
virtual const object::ObjectFile * getFile() const
Definition: DWARFObject.h:32
virtual StringRef getGdbIndexSection() const
Definition: DWARFObject.h:72
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
virtual const DWARFSection & getInfoDWOSection() const
Definition: DWARFObject.h:53