LLVM  6.0.0svn
DWARFDebugLoc.h
Go to the documentation of this file.
1 //===- DWARFDebugLoc.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_DWARFDEBUGLOC_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
12 
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SmallVector.h"
17 #include <cstdint>
18 
19 namespace llvm {
20 class DWARFUnit;
21 class MCRegisterInfo;
22 class raw_ostream;
23 
25 public:
26  /// A single location within a location list.
27  struct Entry {
28  /// The beginning address of the instruction range.
29  uint64_t Begin;
30  /// The ending address of the instruction range.
31  uint64_t End;
32  /// The location of the variable within the specified range.
34  };
35 
36  /// A list of locations that contain one variable.
37  struct LocationList {
38  /// The beginning offset where this location list is stored in the debug_loc
39  /// section.
40  unsigned Offset;
41  /// All the locations in which the variable is stored.
43  /// Dump this list on OS.
44  void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
45  const MCRegisterInfo *MRI, unsigned Indent) const;
46  };
47 
48 private:
50 
51  /// A list of all the variables in the debug_loc section, each one describing
52  /// the locations in which the variable is stored.
53  LocationLists Locations;
54 
55  unsigned AddressSize;
56 
57  bool IsLittleEndian;
58 
59 public:
60  /// Print the location lists found within the debug_loc section.
61  void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo,
63 
64  /// Parse the debug_loc section accessible via the 'data' parameter using the
65  /// address size also given in 'data' to interpret the address ranges.
66  void parse(const DWARFDataExtractor &data);
67 
68  /// Return the location list at the given offset or nullptr.
69  LocationList const *getLocationListAtOffset(uint64_t Offset) const;
70 
72  uint32_t *Offset);
73 };
74 
76 public:
77  struct Entry {
78  uint64_t Start;
81  };
82 
83  struct LocationList {
84  unsigned Offset;
86  void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
87  const MCRegisterInfo *RegInfo, unsigned Indent) const;
88  };
89 
90 private:
92 
93  LocationLists Locations;
94 
95  unsigned AddressSize;
96 
97  bool IsLittleEndian;
98 
99 public:
100  void parse(DataExtractor data);
101  void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo,
102  Optional<uint64_t> Offset) const;
103 
104  /// Return the location list at the given offset or nullptr.
105  LocationList const *getLocationListAtOffset(uint64_t Offset) const;
106 
108  uint32_t *Offset);
109 };
110 
111 } // end namespace llvm
112 
113 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
A list of locations that contain one variable.
Definition: DWARFDebugLoc.h:37
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo, Optional< uint64_t > Offset) const
Print the location lists found within the debug_loc section.
unsigned Offset
The beginning offset where this location list is stored in the debug_loc section. ...
Definition: DWARFDebugLoc.h:40
A single location within a location list.
Definition: DWARFDebugLoc.h:27
SmallVector< char, 4 > Loc
The location of the variable within the specified range.
Definition: DWARFDebugLoc.h:33
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
unsigned const MachineRegisterInfo * MRI
LocationList const * getLocationListAtOffset(uint64_t Offset) const
Return the location list at the given offset or nullptr.
Optional< LocationList > parseOneLocationList(DWARFDataExtractor Data, uint32_t *Offset)
SmallVector< Entry, 2 > Entries
Definition: DWARFDebugLoc.h:85
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
uint64_t Begin
The beginning address of the instruction range.
Definition: DWARFDebugLoc.h:29
SmallVector< char, 4 > Loc
Definition: DWARFDebugLoc.h:80
uint64_t End
The ending address of the instruction range.
Definition: DWARFDebugLoc.h:31
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
SmallVector< Entry, 2 > Entries
All the locations in which the variable is stored.
Definition: DWARFDebugLoc.h:42
void parse(const DWARFDataExtractor &data)
Parse the debug_loc section accessible via the &#39;data&#39; parameter using the address size also given in ...