]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306956, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / DWARF / DWARFDebugLoc.h
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/SmallVector.h"
14 #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
15 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
16 #include <cstdint>
17
18 namespace llvm {
19
20 class raw_ostream;
21
22 class DWARFDebugLoc {
23   /// A single location within a location list.
24   struct Entry {
25     /// The beginning address of the instruction range.
26     uint64_t Begin;
27     /// The ending address of the instruction range.
28     uint64_t End;
29     /// The location of the variable within the specified range.
30     SmallVector<unsigned char, 4> Loc;
31   };
32
33   /// A list of locations that contain one variable.
34   struct LocationList {
35     /// The beginning offset where this location list is stored in the debug_loc
36     /// section.
37     unsigned Offset;
38     /// All the locations in which the variable is stored.
39     SmallVector<Entry, 2> Entries;
40   };
41
42   using LocationLists = SmallVector<LocationList, 4>;
43
44   /// A list of all the variables in the debug_loc section, each one describing
45   /// the locations in which the variable is stored.
46   LocationLists Locations;
47
48 public:
49   /// Print the location lists found within the debug_loc section.
50   void dump(raw_ostream &OS) const;
51
52   /// Parse the debug_loc section accessible via the 'data' parameter using the
53   /// address size also given in 'data' to interpret the address ranges.
54   void parse(const DWARFDataExtractor &data);
55 };
56
57 class DWARFDebugLocDWO {
58   struct Entry {
59     uint64_t Start;
60     uint32_t Length;
61     SmallVector<unsigned char, 4> Loc;
62   };
63
64   struct LocationList {
65     unsigned Offset;
66     SmallVector<Entry, 2> Entries;
67   };
68
69   using LocationLists = SmallVector<LocationList, 4>;
70
71   LocationLists Locations;
72
73 public:
74   void parse(DataExtractor data);
75   void dump(raw_ostream &OS) const;
76 };
77
78 } // end namespace llvm
79
80 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H