LLVM  15.0.0git
DWARFDebugLoc.cpp
Go to the documentation of this file.
1 //===- DWARFDebugLoc.cpp --------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/Format.h"
20 #include <algorithm>
21 #include <cinttypes>
22 #include <cstdint>
23 
24 using namespace llvm;
26 
27 namespace llvm {
28 class DWARFObject;
29 }
30 
31 namespace {
32 class DWARFLocationInterpreter {
34  std::function<Optional<object::SectionedAddress>(uint32_t)> LookupAddr;
35 
36 public:
37  DWARFLocationInterpreter(
40  : Base(Base), LookupAddr(std::move(LookupAddr)) {}
41 
43  Interpret(const DWARFLocationEntry &E);
44 };
45 } // namespace
46 
48  return make_error<ResolverError>(Index, (dwarf::LoclistEntries)Kind);
49 }
50 
52 DWARFLocationInterpreter::Interpret(const DWARFLocationEntry &E) {
53  switch (E.Kind) {
54  case dwarf::DW_LLE_end_of_list:
55  return None;
56  case dwarf::DW_LLE_base_addressx: {
57  Base = LookupAddr(E.Value0);
58  if (!Base)
59  return createResolverError(E.Value0, E.Kind);
60  return None;
61  }
62  case dwarf::DW_LLE_startx_endx: {
63  Optional<SectionedAddress> LowPC = LookupAddr(E.Value0);
64  if (!LowPC)
65  return createResolverError(E.Value0, E.Kind);
66  Optional<SectionedAddress> HighPC = LookupAddr(E.Value1);
67  if (!HighPC)
68  return createResolverError(E.Value1, E.Kind);
70  DWARFAddressRange{LowPC->Address, HighPC->Address, LowPC->SectionIndex},
71  E.Loc};
72  }
73  case dwarf::DW_LLE_startx_length: {
74  Optional<SectionedAddress> LowPC = LookupAddr(E.Value0);
75  if (!LowPC)
76  return createResolverError(E.Value0, E.Kind);
78  LowPC->Address + E.Value1,
79  LowPC->SectionIndex},
80  E.Loc};
81  }
82  case dwarf::DW_LLE_offset_pair: {
83  if (!Base) {
85  "Unable to resolve location list offset pair: "
86  "Base address not defined");
87  }
88  DWARFAddressRange Range{Base->Address + E.Value0, Base->Address + E.Value1,
89  Base->SectionIndex};
90  if (Range.SectionIndex == SectionedAddress::UndefSection)
91  Range.SectionIndex = E.SectionIndex;
92  return DWARFLocationExpression{Range, E.Loc};
93  }
94  case dwarf::DW_LLE_default_location:
95  return DWARFLocationExpression{None, E.Loc};
96  case dwarf::DW_LLE_base_address:
97  Base = SectionedAddress{E.Value0, E.SectionIndex};
98  return None;
99  case dwarf::DW_LLE_start_end:
101  DWARFAddressRange{E.Value0, E.Value1, E.SectionIndex}, E.Loc};
102  case dwarf::DW_LLE_start_length:
104  DWARFAddressRange{E.Value0, E.Value0 + E.Value1, E.SectionIndex},
105  E.Loc};
106  default:
107  llvm_unreachable("unreachable locations list kind");
108  }
109 }
110 
111 static void dumpExpression(raw_ostream &OS, DIDumpOptions DumpOpts,
112  ArrayRef<uint8_t> Data, bool IsLittleEndian,
113  unsigned AddressSize, const MCRegisterInfo *MRI,
114  DWARFUnit *U) {
115  DWARFDataExtractor Extractor(Data, IsLittleEndian, AddressSize);
116  // Note. We do not pass any format to DWARFExpression, even if the
117  // corresponding unit is known. For now, there is only one operation,
118  // DW_OP_call_ref, which depends on the format; it is rarely used, and
119  // is unexpected in location tables.
120  DWARFExpression(Extractor, AddressSize).print(OS, DumpOpts, MRI, U);
121 }
122 
125  const MCRegisterInfo *MRI,
126  const DWARFObject &Obj, DWARFUnit *U,
127  DIDumpOptions DumpOpts,
128  unsigned Indent) const {
129  DWARFLocationInterpreter Interp(
130  BaseAddr, [U](uint32_t Index) -> Optional<SectionedAddress> {
131  if (U)
132  return U->getAddrOffsetSectionItem(Index);
133  return None;
134  });
135  OS << format("0x%8.8" PRIx64 ": ", *Offset);
136  Error E = visitLocationList(Offset, [&](const DWARFLocationEntry &E) {
137  Expected<Optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
138  if (!Loc || DumpOpts.DisplayRawContents)
139  dumpRawEntry(E, OS, Indent, DumpOpts, Obj);
140  if (Loc && *Loc) {
141  OS << "\n";
142  OS.indent(Indent);
143  if (DumpOpts.DisplayRawContents)
144  OS << " => ";
145 
146  DIDumpOptions RangeDumpOpts(DumpOpts);
147  RangeDumpOpts.DisplayRawContents = false;
148  if (Loc.get()->Range)
149  Loc.get()->Range->dump(OS, Data.getAddressSize(), RangeDumpOpts, &Obj);
150  else
151  OS << "<default>";
152  }
153  if (!Loc)
154  consumeError(Loc.takeError());
155 
156  if (E.Kind != dwarf::DW_LLE_base_address &&
157  E.Kind != dwarf::DW_LLE_base_addressx &&
158  E.Kind != dwarf::DW_LLE_end_of_list) {
159  OS << ": ";
160  dumpExpression(OS, DumpOpts, E.Loc, Data.isLittleEndian(),
161  Data.getAddressSize(), MRI, U);
162  }
163  return true;
164  });
165  if (E) {
167  return false;
168  }
169  return true;
170 }
171 
173  uint64_t Offset, Optional<SectionedAddress> BaseAddr,
175  function_ref<bool(Expected<DWARFLocationExpression>)> Callback) const {
176  DWARFLocationInterpreter Interp(BaseAddr, std::move(LookupAddr));
177  return visitLocationList(&Offset, [&](const DWARFLocationEntry &E) {
178  Expected<Optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
179  if (!Loc)
180  return Callback(Loc.takeError());
181  if (*Loc)
182  return Callback(**Loc);
183  return true;
184  });
185 }
186 
188  const DWARFObject &Obj, DIDumpOptions DumpOpts,
189  Optional<uint64_t> DumpOffset) const {
190  auto BaseAddr = None;
191  unsigned Indent = 12;
192  if (DumpOffset) {
193  dumpLocationList(&*DumpOffset, OS, BaseAddr, MRI, Obj, nullptr, DumpOpts,
194  Indent);
195  } else {
196  uint64_t Offset = 0;
197  StringRef Separator;
198  bool CanContinue = true;
199  while (CanContinue && Data.isValidOffset(Offset)) {
200  OS << Separator;
201  Separator = "\n";
202 
203  CanContinue = dumpLocationList(&Offset, OS, BaseAddr, MRI, Obj, nullptr,
204  DumpOpts, Indent);
205  OS << '\n';
206  }
207  }
208 }
209 
211  uint64_t *Offset,
212  function_ref<bool(const DWARFLocationEntry &)> Callback) const {
213  DataExtractor::Cursor C(*Offset);
214  while (true) {
215  uint64_t SectionIndex;
217  uint64_t Value1 = Data.getRelocatedAddress(C, &SectionIndex);
218 
220 
221  // The end of any given location list is marked by an end of list entry,
222  // which consists of a 0 for the beginning address offset and a 0 for the
223  // ending address offset. A beginning offset of 0xff...f marks the base
224  // address selection entry.
225  if (Value0 == 0 && Value1 == 0) {
226  E.Kind = dwarf::DW_LLE_end_of_list;
227  } else if (Value0 == (Data.getAddressSize() == 4 ? -1U : -1ULL)) {
228  E.Kind = dwarf::DW_LLE_base_address;
229  E.Value0 = Value1;
230  E.SectionIndex = SectionIndex;
231  } else {
232  E.Kind = dwarf::DW_LLE_offset_pair;
233  E.Value0 = Value0;
234  E.Value1 = Value1;
235  E.SectionIndex = SectionIndex;
236  unsigned Bytes = Data.getU16(C);
237  // A single location description describing the location of the object...
238  Data.getU8(C, E.Loc, Bytes);
239  }
240 
241  if (!C)
242  return C.takeError();
243  if (!Callback(E) || E.Kind == dwarf::DW_LLE_end_of_list)
244  break;
245  }
246  *Offset = C.tell();
247  return Error::success();
248 }
249 
251  raw_ostream &OS, unsigned Indent,
252  DIDumpOptions DumpOpts,
253  const DWARFObject &Obj) const {
254  uint64_t Value0, Value1;
255  switch (Entry.Kind) {
256  case dwarf::DW_LLE_base_address:
257  Value0 = Data.getAddressSize() == 4 ? -1U : -1ULL;
258  Value1 = Entry.Value0;
259  break;
260  case dwarf::DW_LLE_offset_pair:
261  Value0 = Entry.Value0;
262  Value1 = Entry.Value1;
263  break;
264  case dwarf::DW_LLE_end_of_list:
265  return;
266  default:
267  llvm_unreachable("Not possible in DWARF4!");
268  }
269  OS << '\n';
270  OS.indent(Indent);
271  OS << '(' << format_hex(Value0, 2 + Data.getAddressSize() * 2) << ", "
272  << format_hex(Value1, 2 + Data.getAddressSize() * 2) << ')';
273  DWARFFormValue::dumpAddressSection(Obj, OS, DumpOpts, Entry.SectionIndex);
274 }
275 
277  uint64_t *Offset, function_ref<bool(const DWARFLocationEntry &)> F) const {
278 
279  DataExtractor::Cursor C(*Offset);
280  bool Continue = true;
281  while (Continue) {
283  E.Kind = Data.getU8(C);
284  switch (E.Kind) {
285  case dwarf::DW_LLE_end_of_list:
286  break;
287  case dwarf::DW_LLE_base_addressx:
288  E.Value0 = Data.getULEB128(C);
289  break;
290  case dwarf::DW_LLE_startx_endx:
291  E.Value0 = Data.getULEB128(C);
292  E.Value1 = Data.getULEB128(C);
293  break;
294  case dwarf::DW_LLE_startx_length:
295  E.Value0 = Data.getULEB128(C);
296  // Pre-DWARF 5 has different interpretation of the length field. We have
297  // to support both pre- and standartized styles for the compatibility.
298  if (Version < 5)
299  E.Value1 = Data.getU32(C);
300  else
301  E.Value1 = Data.getULEB128(C);
302  break;
303  case dwarf::DW_LLE_offset_pair:
304  E.Value0 = Data.getULEB128(C);
305  E.Value1 = Data.getULEB128(C);
306  E.SectionIndex = SectionedAddress::UndefSection;
307  break;
308  case dwarf::DW_LLE_default_location:
309  break;
310  case dwarf::DW_LLE_base_address:
311  E.Value0 = Data.getRelocatedAddress(C, &E.SectionIndex);
312  break;
313  case dwarf::DW_LLE_start_end:
314  E.Value0 = Data.getRelocatedAddress(C, &E.SectionIndex);
315  E.Value1 = Data.getRelocatedAddress(C);
316  break;
317  case dwarf::DW_LLE_start_length:
318  E.Value0 = Data.getRelocatedAddress(C, &E.SectionIndex);
319  E.Value1 = Data.getULEB128(C);
320  break;
321  default:
322  cantFail(C.takeError());
324  "LLE of kind %x not supported", (int)E.Kind);
325  }
326 
327  if (E.Kind != dwarf::DW_LLE_base_address &&
328  E.Kind != dwarf::DW_LLE_base_addressx &&
329  E.Kind != dwarf::DW_LLE_end_of_list) {
330  unsigned Bytes = Version >= 5 ? Data.getULEB128(C) : Data.getU16(C);
331  // A single location description describing the location of the object...
332  Data.getU8(C, E.Loc, Bytes);
333  }
334 
335  if (!C)
336  return C.takeError();
337  Continue = F(E) && E.Kind != dwarf::DW_LLE_end_of_list;
338  }
339  *Offset = C.tell();
340  return Error::success();
341 }
342 
344  raw_ostream &OS, unsigned Indent,
345  DIDumpOptions DumpOpts,
346  const DWARFObject &Obj) const {
347  size_t MaxEncodingStringLength = 0;
348 #define HANDLE_DW_LLE(ID, NAME) \
349  MaxEncodingStringLength = std::max(MaxEncodingStringLength, \
350  dwarf::LocListEncodingString(ID).size());
351 #include "llvm/BinaryFormat/Dwarf.def"
352 
353  OS << "\n";
354  OS.indent(Indent);
355  StringRef EncodingString = dwarf::LocListEncodingString(Entry.Kind);
356  // Unsupported encodings should have been reported during parsing.
357  assert(!EncodingString.empty() && "Unknown loclist entry encoding");
358  OS << format("%-*s(", MaxEncodingStringLength, EncodingString.data());
359  unsigned FieldSize = 2 + 2 * Data.getAddressSize();
360  switch (Entry.Kind) {
361  case dwarf::DW_LLE_end_of_list:
362  case dwarf::DW_LLE_default_location:
363  break;
364  case dwarf::DW_LLE_startx_endx:
365  case dwarf::DW_LLE_startx_length:
366  case dwarf::DW_LLE_offset_pair:
367  case dwarf::DW_LLE_start_end:
368  case dwarf::DW_LLE_start_length:
369  OS << format_hex(Entry.Value0, FieldSize) << ", "
370  << format_hex(Entry.Value1, FieldSize);
371  break;
372  case dwarf::DW_LLE_base_addressx:
373  case dwarf::DW_LLE_base_address:
374  OS << format_hex(Entry.Value0, FieldSize);
375  break;
376  }
377  OS << ')';
378  switch (Entry.Kind) {
379  case dwarf::DW_LLE_base_address:
380  case dwarf::DW_LLE_start_end:
381  case dwarf::DW_LLE_start_length:
382  DWARFFormValue::dumpAddressSection(Obj, OS, DumpOpts, Entry.SectionIndex);
383  break;
384  default:
385  break;
386  }
387 }
388 
390  raw_ostream &OS, const MCRegisterInfo *MRI,
391  const DWARFObject &Obj,
392  DIDumpOptions DumpOpts) {
393  if (!Data.isValidOffsetForDataOfSize(StartOffset, Size)) {
394  OS << "Invalid dump range\n";
395  return;
396  }
397  uint64_t Offset = StartOffset;
398  StringRef Separator;
399  bool CanContinue = true;
400  while (CanContinue && Offset < StartOffset + Size) {
401  OS << Separator;
402  Separator = "\n";
403 
404  CanContinue = dumpLocationList(&Offset, OS, /*BaseAddr=*/None, MRI, Obj,
405  nullptr, DumpOpts, /*Indent=*/12);
406  OS << '\n';
407  }
408 }
409 
411  OS << format("unable to resolve indirect address %u for: %s", Index,
412  dwarf::LocListEncodingString(Kind).data());
413 }
414 
DWARFFormValue.h
dumpExpression
static void dumpExpression(raw_ostream &OS, DIDumpOptions DumpOpts, ArrayRef< uint8_t > Data, bool IsLittleEndian, unsigned AddressSize, const MCRegisterInfo *MRI, DWARFUnit *U)
Definition: DWARFDebugLoc.cpp:111
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
StringRef.h
llvm::DWARFFormValue::dumpAddressSection
static void dumpAddressSection(const DWARFObject &Obj, raw_ostream &OS, DIDumpOptions DumpOpts, uint64_t SectionIndex)
Definition: DWARFFormValue.cpp:393
llvm::object::SectionedAddress::Address
uint64_t Address
Definition: ObjectFile.h:147
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:329
DWARFAddressRange.h
llvm::DWARFLocationExpression
Represents a single DWARF expression, whose value is location-dependent.
Definition: DWARFLocationExpression.h:22
llvm::Optional
Definition: APInt.h:33
llvm::DWARFExpression::print
void print(raw_ostream &OS, DIDumpOptions DumpOpts, const MCRegisterInfo *RegInfo, DWARFUnit *U, bool IsEH=false) const
Definition: DWARFExpression.cpp:325
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::DWARFDataExtractor
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
Definition: DWARFDataExtractor.h:21
llvm::dwarf::LoclistEntries
LoclistEntries
DWARF v5 loc list entry encoding values.
Definition: Dwarf.h:416
Format.h
llvm::consumeError
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1043
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::object::SectionedAddress::SectionIndex
uint64_t SectionIndex
Definition: ObjectFile.h:148
llvm::DWARFUnit::getAddrOffsetSectionItem
Optional< object::SectionedAddress > getAddrOffsetSectionItem(uint32_t Index) const
Definition: DWARFUnit.cpp:208
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::DWARFDebugLoc::dumpRawEntry
void dumpRawEntry(const DWARFLocationEntry &Entry, raw_ostream &OS, unsigned Indent, DIDumpOptions DumpOpts, const DWARFObject &Obj) const override
Definition: DWARFDebugLoc.cpp:250
llvm::DataExtractor::getULEB128
uint64_t getULEB128(uint64_t *offset_ptr, llvm::Error *Err=nullptr) const
Extract a unsigned LEB128 value from *offset_ptr.
Definition: DataExtractor.cpp:220
llvm::DWARFDataExtractor::getRelocatedAddress
uint64_t getRelocatedAddress(uint64_t *Off, uint64_t *SecIx=nullptr) const
Extracts an address-sized value and applies a relocation to the result if one exists for the given of...
Definition: DWARFDataExtractor.h:72
llvm::DWARFLocationEntry
A single location within a location list.
Definition: DWARFDebugLoc.h:31
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::DataExtractor::getAddressSize
uint8_t getAddressSize() const
Get the address size for this extractor.
Definition: DataExtractor.h:99
llvm::DWARFLocationTable::dumpLocationList
bool dumpLocationList(uint64_t *Offset, raw_ostream &OS, Optional< object::SectionedAddress > BaseAddr, const MCRegisterInfo *MRI, const DWARFObject &Obj, DWARFUnit *U, DIDumpOptions DumpOpts, unsigned Indent) const
Dump the location list at the given Offset.
Definition: DWARFDebugLoc.cpp:123
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
DWARFDebugLoc.h
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
llvm::DWARFObject
Definition: DWARFObject.h:25
llvm::None
const NoneType None
Definition: None.h:24
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::errc::illegal_byte_sequence
@ illegal_byte_sequence
llvm::ResolverError::log
void log(raw_ostream &OS) const override
Print an error message to an output stream.
Definition: DWARFDebugLoc.cpp:410
llvm::StringRef::empty
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
llvm::DWARFLocationTable::visitAbsoluteLocationList
Error visitAbsoluteLocationList(uint64_t Offset, Optional< object::SectionedAddress > BaseAddr, std::function< Optional< object::SectionedAddress >(uint32_t)> LookupAddr, function_ref< bool(Expected< DWARFLocationExpression >)> Callback) const
Definition: DWARFDebugLoc.cpp:172
uint64_t
llvm::DataExtractor::isValidOffsetForDataOfSize
bool isValidOffsetForDataOfSize(uint64_t offset, uint64_t length) const
Test the availability of length bytes of data from offset.
Definition: DataExtractor.h:672
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
DWARFUnit.h
llvm::DWARFExpression
Definition: DWARFExpression.h:24
llvm::DataExtractor::isValidOffset
bool isValidOffset(uint64_t offset) const
Test the validity of offset.
Definition: DataExtractor.h:665
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1675
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:82
llvm::DataExtractor::Cursor
A class representing a position in a DataExtractor, as well as any error encountered during extractio...
Definition: DataExtractor.h:54
llvm::DataExtractor::getU32
uint32_t getU32(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint32_t value from *offset_ptr.
Definition: DataExtractor.cpp:107
llvm::ArrayRef< uint8_t >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
Dwarf.h
llvm::DWARFLocationTable::visitLocationList
virtual Error visitLocationList(uint64_t *Offset, function_ref< bool(const DWARFLocationEntry &)> Callback) const =0
Call the user-provided callback for each entry (including the end-of-list entry) in the location list...
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
if
if(llvm_vc STREQUAL "") set(fake_version_inc "$
Definition: CMakeLists.txt:14
llvm::Expected::get
reference get()
Returns a reference to the stored T value.
Definition: Error.h:567
llvm::cantFail
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition: Error.h:745
uint32_t
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
DWARFLocationExpression.h
llvm::DataExtractor::getU8
uint8_t getU8(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint8_t value from *offset_ptr.
Definition: DataExtractor.cpp:79
llvm::DWARFDebugLoc::dump
void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo, const DWARFObject &Obj, DIDumpOptions DumpOpts, Optional< uint64_t > Offset) const
Print the location lists found within the debug_loc section.
Definition: DWARFDebugLoc.cpp:187
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
DIContext.h
llvm::createStringError
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1239
std
Definition: BitVector.h:851
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:77
llvm::DWARFUnit
Definition: DWARFUnit.h:207
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::DWARFDebugLoc::visitLocationList
Error visitLocationList(uint64_t *Offset, function_ref< bool(const DWARFLocationEntry &)> Callback) const override
Call the user-provided callback for each entry (including the end-of-list entry) in the location list...
Definition: DWARFDebugLoc.cpp:210
llvm::DWARFLocationTable::dumpRawEntry
virtual void dumpRawEntry(const DWARFLocationEntry &Entry, raw_ostream &OS, unsigned Indent, DIDumpOptions DumpOpts, const DWARFObject &Obj) const =0
DWARFExpression.h
llvm::DIDumpOptions::DisplayRawContents
bool DisplayRawContents
Definition: DIContext.h:200
llvm::Expected::takeError
Error takeError()
Take ownership of the stored error.
Definition: Error.h:597
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:496
llvm::DWARFLocationTable::Data
DWARFDataExtractor Data
Definition: DWARFDebugLoc.h:82
llvm::DWARFDebugLoclists::dumpRange
void dumpRange(uint64_t StartOffset, uint64_t Size, raw_ostream &OS, const MCRegisterInfo *MRI, const DWARFObject &Obj, DIDumpOptions DumpOpts)
Dump all location lists within the given range.
Definition: DWARFDebugLoc.cpp:389
llvm::object::SectionedAddress
Definition: ObjectFile.h:144
llvm::StringRef::data
const LLVM_NODISCARD char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:149
llvm::DWARFDebugLoclists::visitLocationList
Error visitLocationList(uint64_t *Offset, function_ref< bool(const DWARFLocationEntry &)> Callback) const override
Call the user-provided callback for each entry (including the end-of-list entry) in the location list...
Definition: DWARFDebugLoc.cpp:276
llvm::DWARFDebugLoclists::dumpRawEntry
void dumpRawEntry(const DWARFLocationEntry &Entry, raw_ostream &OS, unsigned Indent, DIDumpOptions DumpOpts, const DWARFObject &Obj) const override
Definition: DWARFDebugLoc.cpp:343
llvm::DWARFAddressRange
Definition: DWARFAddressRange.h:25
raw_ostream.h
llvm::format_hex
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
Definition: Format.h:186
llvm::ResolverError::ID
static char ID
Definition: DWARFDebugLoc.h:151
llvm::dwarf::LocListEncodingString
StringRef LocListEncodingString(unsigned Encoding)
Definition: Dwarf.cpp:525
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
createResolverError
static Error createResolverError(uint32_t Index, unsigned Kind)
Definition: DWARFDebugLoc.cpp:47
llvm::DataExtractor::getU16
uint16_t getU16(uint64_t *offset_ptr, Error *Err=nullptr) const
Extract a uint16_t value from *offset_ptr.
Definition: DataExtractor.cpp:92
llvm::DIDumpOptions
Container for dump options that control which debug information will be dumped.
Definition: DIContext.h:188
llvm::DIDumpOptions::RecoverableErrorHandler
std::function< void(Error)> RecoverableErrorHandler
Definition: DIContext.h:220