Deleted Added
full compact
DIContext.h (256281) DIContext.h (263508)
1//===-- DIContext.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//===----------------------------------------------------------------------===//

--- 7 unchanged lines hidden (view full) ---

16#define LLVM_DEBUGINFO_DICONTEXT_H
17
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/SmallString.h"
20#include "llvm/ADT/SmallVector.h"
21#include "llvm/ADT/StringRef.h"
22#include "llvm/Object/ObjectFile.h"
23#include "llvm/Object/RelocVisitor.h"
1//===-- DIContext.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//===----------------------------------------------------------------------===//

--- 7 unchanged lines hidden (view full) ---

16#define LLVM_DEBUGINFO_DICONTEXT_H
17
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/ADT/SmallString.h"
20#include "llvm/ADT/SmallVector.h"
21#include "llvm/ADT/StringRef.h"
22#include "llvm/Object/ObjectFile.h"
23#include "llvm/Object/RelocVisitor.h"
24#include "llvm/Support/Casting.h"
24#include "llvm/Support/DataTypes.h"
25
26namespace llvm {
27
28class raw_ostream;
29
30/// DILineInfo - a format-neutral container for source line information.
31class DILineInfo {
32 SmallString<16> FileName;
33 SmallString<16> FunctionName;
34 uint32_t Line;
35 uint32_t Column;
36public:
37 DILineInfo()
38 : FileName("<invalid>"), FunctionName("<invalid>"),
39 Line(0), Column(0) {}
25#include "llvm/Support/DataTypes.h"
26
27namespace llvm {
28
29class raw_ostream;
30
31/// DILineInfo - a format-neutral container for source line information.
32class DILineInfo {
33 SmallString<16> FileName;
34 SmallString<16> FunctionName;
35 uint32_t Line;
36 uint32_t Column;
37public:
38 DILineInfo()
39 : FileName("<invalid>"), FunctionName("<invalid>"),
40 Line(0), Column(0) {}
40 DILineInfo(const SmallString<16> &fileName,
41 const SmallString<16> &functionName,
42 uint32_t line, uint32_t column)
43 : FileName(fileName), FunctionName(functionName),
44 Line(line), Column(column) {}
41 DILineInfo(StringRef fileName, StringRef functionName, uint32_t line,
42 uint32_t column)
43 : FileName(fileName), FunctionName(functionName), Line(line),
44 Column(column) {}
45
46 const char *getFileName() { return FileName.c_str(); }
47 const char *getFunctionName() { return FunctionName.c_str(); }
48 uint32_t getLine() const { return Line; }
49 uint32_t getColumn() const { return Column; }
50
51 bool operator==(const DILineInfo &RHS) const {
52 return Line == RHS.Line && Column == RHS.Column &&

--- 46 unchanged lines hidden (view full) ---

99 DIDT_Null,
100 DIDT_All,
101 DIDT_Abbrev,
102 DIDT_AbbrevDwo,
103 DIDT_Aranges,
104 DIDT_Frames,
105 DIDT_Info,
106 DIDT_InfoDwo,
45
46 const char *getFileName() { return FileName.c_str(); }
47 const char *getFunctionName() { return FunctionName.c_str(); }
48 uint32_t getLine() const { return Line; }
49 uint32_t getColumn() const { return Column; }
50
51 bool operator==(const DILineInfo &RHS) const {
52 return Line == RHS.Line && Column == RHS.Column &&

--- 46 unchanged lines hidden (view full) ---

99 DIDT_Null,
100 DIDT_All,
101 DIDT_Abbrev,
102 DIDT_AbbrevDwo,
103 DIDT_Aranges,
104 DIDT_Frames,
105 DIDT_Info,
106 DIDT_InfoDwo,
107 DIDT_Types,
107 DIDT_Line,
108 DIDT_Line,
109 DIDT_Loc,
108 DIDT_Ranges,
109 DIDT_Pubnames,
110 DIDT_Ranges,
111 DIDT_Pubnames,
112 DIDT_Pubtypes,
113 DIDT_GnuPubnames,
114 DIDT_GnuPubtypes,
110 DIDT_Str,
111 DIDT_StrDwo,
112 DIDT_StrOffsetsDwo
113};
114
115// In place of applying the relocations to the data we've read from disk we use
116// a separate mapping table to the side and checking that at locations in the
117// dwarf where we expect relocated values. This adds a bit of complexity to the
118// dwarf parsing/extraction at the benefit of not allocating memory for the
119// entire size of the debug info sections.
120typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t> > RelocAddrMap;
121
122class DIContext {
123public:
115 DIDT_Str,
116 DIDT_StrDwo,
117 DIDT_StrOffsetsDwo
118};
119
120// In place of applying the relocations to the data we've read from disk we use
121// a separate mapping table to the side and checking that at locations in the
122// dwarf where we expect relocated values. This adds a bit of complexity to the
123// dwarf parsing/extraction at the benefit of not allocating memory for the
124// entire size of the debug info sections.
125typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t> > RelocAddrMap;
126
127class DIContext {
128public:
129 enum DIContextKind {
130 CK_DWARF
131 };
132 DIContextKind getKind() const { return Kind; }
133
134 DIContext(DIContextKind K) : Kind(K) {}
124 virtual ~DIContext();
125
126 /// getDWARFContext - get a context for binary DWARF data.
127 static DIContext *getDWARFContext(object::ObjectFile *);
128
129 virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) = 0;
130
131 virtual DILineInfo getLineInfoForAddress(uint64_t Address,
132 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
133 virtual DILineInfoTable getLineInfoForAddressRange(uint64_t Address,
134 uint64_t Size, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
135 virtual DIInliningInfo getInliningInfoForAddress(uint64_t Address,
136 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
135 virtual ~DIContext();
136
137 /// getDWARFContext - get a context for binary DWARF data.
138 static DIContext *getDWARFContext(object::ObjectFile *);
139
140 virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) = 0;
141
142 virtual DILineInfo getLineInfoForAddress(uint64_t Address,
143 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
144 virtual DILineInfoTable getLineInfoForAddressRange(uint64_t Address,
145 uint64_t Size, DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
146 virtual DIInliningInfo getInliningInfoForAddress(uint64_t Address,
147 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
148private:
149 const DIContextKind Kind;
137};
138
139}
140
141#endif
150};
151
152}
153
154#endif