]> git.proxmox.com Git - rustc.git/blame - src/llvm/include/llvm/DebugInfo/DWARFDebugLoc.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / include / llvm / DebugInfo / DWARFDebugLoc.h
CommitLineData
1a4d82fc
JJ
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_LIB_DEBUGINFO_DWARFDEBUGLOC_H
11#define LLVM_LIB_DEBUGINFO_DWARFDEBUGLOC_H
12
1a4d82fc 13#include "llvm/ADT/SmallVector.h"
85aaf69f 14#include "llvm/DebugInfo/DWARFRelocMap.h"
1a4d82fc
JJ
15#include "llvm/Support/DataExtractor.h"
16
17namespace llvm {
18
19class raw_ostream;
20
21class DWARFDebugLoc {
22 /// A single location within a location list.
23 struct Entry {
24 /// The beginning address of the instruction range.
25 uint64_t Begin;
26 /// The ending address of the instruction range.
27 uint64_t End;
28 /// The location of the variable within the specified range.
29 SmallVector<unsigned char, 4> Loc;
30 };
31
32 /// A list of locations that contain one variable.
33 struct LocationList {
34 /// The beginning offset where this location list is stored in the debug_loc
35 /// section.
36 unsigned Offset;
37 /// All the locations in which the variable is stored.
38 SmallVector<Entry, 2> Entries;
39 };
40
41 typedef SmallVector<LocationList, 4> LocationLists;
42
43 /// A list of all the variables in the debug_loc section, each one describing
44 /// the locations in which the variable is stored.
45 LocationLists Locations;
46
47 /// A map used to resolve binary relocations.
48 const RelocAddrMap &RelocMap;
49
50public:
51 DWARFDebugLoc(const RelocAddrMap &LocRelocMap) : RelocMap(LocRelocMap) {}
52 /// Print the location lists found within the debug_loc section.
53 void dump(raw_ostream &OS) const;
54 /// Parse the debug_loc section accessible via the 'data' parameter using the
55 /// specified address size to interpret the address ranges.
56 void parse(DataExtractor data, unsigned AddressSize);
57};
58
59class DWARFDebugLocDWO {
60 struct Entry {
61 uint64_t Start;
62 uint32_t Length;
63 SmallVector<unsigned char, 4> Loc;
64 };
65
66 struct LocationList {
67 unsigned Offset;
68 SmallVector<Entry, 2> Entries;
69 };
70
71 typedef SmallVector<LocationList, 4> LocationLists;
72
73 LocationLists Locations;
74
75public:
76 void parse(DataExtractor data);
77 void dump(raw_ostream &OS) const;
78};
79}
80
81#endif