23 using namespace dwarf;
24 using namespace syntax;
27 uint8_t getRefAddrSize(uint8_t AddrSize, uint16_t
Version) {
29 return (Version == 2) ? AddrSize : 4;
32 template <u
int8_t AddrSize, u
int8_t RefAddrSize>
34 static const uint8_t sizes[] = {
68 uint8_t RefAddrSize = getRefAddrSize(AddrSize, Version);
69 if (AddrSize == 4 && RefAddrSize == 4)
70 return makeFixedFormSizesArrayRef<4, 4>();
71 if (AddrSize == 4 && RefAddrSize == 8)
72 return makeFixedFormSizesArrayRef<4, 8>();
73 if (AddrSize == 8 && RefAddrSize == 4)
74 return makeFixedFormSizesArrayRef<8, 4>();
75 if (AddrSize == 8 && RefAddrSize == 8)
76 return makeFixedFormSizesArrayRef<8, 8>();
120 return (FC == FC_Reference);
122 return (FC == FC_Address);
125 return (FC == FC_String);
131 FC == FC_SectionOffset;
136 bool indirect =
false;
137 bool is_block =
false;
138 Value.data =
nullptr;
154 const std::pair<uint8_t, int64_t> &R = AI->second;
193 Value.uval += AI->second.second;
225 Value.uval += AI->second.second;
245 Value.data =
nullptr;
247 Value.data =
reinterpret_cast<const uint8_t *
>(str.
data());
248 *offset_ptr +=
Value.uval;
263 uint32_t *offset_ptr,
const DWARFUnit *cu) {
264 bool indirect =
false;
276 uint8_t
size = debug_info_data.
getU8(offset_ptr);
281 uint16_t
size = debug_info_data.
getU16(offset_ptr);
286 uint32_t
size = debug_info_data.
getU32(offset_ptr);
293 debug_info_data.
getCStr(offset_ptr);
346 form = debug_info_data.
getULEB128(offset_ptr);
366 uint64_t uvalue =
Value.uval;
367 bool cu_relative_offset =
false;
372 OS <<
format(
" indexed (%8.8x) address = ", (uint32_t)uvalue);
375 OS <<
format(
"0x%016" PRIx64, Address);
377 OS <<
"<no .debug_addr section>";
407 const uint8_t* data_ptr =
Value.data;
410 const uint8_t* end_data_ptr = data_ptr + uvalue;
411 while (data_ptr < end_data_ptr) {
412 OS <<
format(
"%2.2x ", *data_ptr);
424 OS <<
format(
" .debug_str[0x%8.8x] = ", (uint32_t)uvalue);
429 OS <<
format(
" indexed (%8.8x) string = ", (uint32_t)uvalue);
434 OS <<
format(
"alt indirect string, offset: 0x%" PRIx64
"", uvalue);
439 OS <<
format(
"0x%016" PRIx64, uvalue);
442 cu_relative_offset =
true;
443 OS <<
format(
"cu + 0x%2.2x", (uint8_t)uvalue);
446 cu_relative_offset =
true;
447 OS <<
format(
"cu + 0x%4.4x", (uint16_t)uvalue);
450 cu_relative_offset =
true;
451 OS <<
format(
"cu + 0x%4.4x", (uint32_t)uvalue);
454 cu_relative_offset =
true;
455 OS <<
format(
"cu + 0x%8.8" PRIx64, uvalue);
458 cu_relative_offset =
true;
459 OS <<
format(
"cu + 0x%" PRIx64, uvalue);
462 OS <<
format(
"<alt 0x%" PRIx64
">", uvalue);
468 OS <<
"DW_FORM_indirect";
473 OS <<
format(
"0x%08x", (uint32_t)uvalue);
481 if (cu_relative_offset) {
500 if (!isFormClass(FC_String))
507 uint32_t Offset =
Value.uval;
521 if (!isFormClass(FC_Address))
524 uint32_t Index =
Value.uval;
534 if (!isFormClass(FC_Reference))
554 if (!isFormClass(FC_SectionOffset))
560 if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag))
567 if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag)) ||
572 return int32_t(
Value.uval);
574 return int16_t(
Value.uval);
576 return int8_t(
Value.uval);
585 if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc))
llvm::raw_ostream & get()
StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
bool getStringOffsetSectionItem(uint32_t Index, uint32_t &Result) const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
const T & getValue() const LLVM_LVALUE_FUNCTION
uint16_t getVersion() const
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
const RelocAddrMap * getRelocMap() const
DataExtractor getStringExtractor() const
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '', ' ', '"', and anything that doesn't satisfy std::isprint into an escape...
bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const
iterator find(const KeyT &Val)
uint32_t getOffset() const
uint8_t getAddressByteSize() const
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
An RAII object that temporarily switches an output stream to a specific color.
bool empty() const
empty - Check if the string is empty.