1 //===- DWARFDebugLoc.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
16 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
26 /// A single location within a location list.
28 /// The beginning address of the instruction range.
30 /// The ending address of the instruction range.
32 /// The location of the variable within the specified range.
33 SmallVector<char, 4> Loc;
36 /// A list of locations that contain one variable.
38 /// The beginning offset where this location list is stored in the debug_loc
41 /// All the locations in which the variable is stored.
42 SmallVector<Entry, 2> Entries;
43 /// Dump this list on OS.
44 void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
45 const MCRegisterInfo *MRI, uint64_t BaseAddress,
46 unsigned Indent) const;
50 using LocationLists = SmallVector<LocationList, 4>;
52 /// A list of all the variables in the debug_loc section, each one describing
53 /// the locations in which the variable is stored.
54 LocationLists Locations;
61 /// Print the location lists found within the debug_loc section.
62 void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo,
63 Optional<uint64_t> Offset) const;
65 /// Parse the debug_loc section accessible via the 'data' parameter using the
66 /// address size also given in 'data' to interpret the address ranges.
67 void parse(const DWARFDataExtractor &data);
69 /// Return the location list at the given offset or nullptr.
70 LocationList const *getLocationListAtOffset(uint64_t Offset) const;
72 Optional<LocationList> parseOneLocationList(DWARFDataExtractor Data,
76 class DWARFDebugLocDWO {
81 SmallVector<char, 4> Loc;
86 SmallVector<Entry, 2> Entries;
87 void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
88 const MCRegisterInfo *RegInfo, unsigned Indent) const;
92 using LocationLists = SmallVector<LocationList, 4>;
94 LocationLists Locations;
101 void parse(DataExtractor data);
102 void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo,
103 Optional<uint64_t> Offset) const;
105 /// Return the location list at the given offset or nullptr.
106 LocationList const *getLocationListAtOffset(uint64_t Offset) const;
108 static Optional<LocationList> parseOneLocationList(DataExtractor Data,
112 } // end namespace llvm
114 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H