24 using namespace dwarf;
26 void DWARFAbbreviationDeclaration::clear() {
31 AttributeSpecs.clear();
32 FixedAttributeSize.reset();
41 uint64_t* OffsetPtr) {
43 const uint64_t
Offset = *OffsetPtr;
48 CodeByteSize = *OffsetPtr -
Offset;
50 if (
Tag == DW_TAG_null) {
54 uint8_t ChildrenByte = Data.
getU8(OffsetPtr);
59 FixedAttributeSize = FixedSizeInfo();
66 bool IsImplicitConst = (
F == DW_FORM_implicit_const);
67 if (IsImplicitConst) {
77 if (FixedAttributeSize)
78 ++FixedAttributeSize->NumAddrs;
81 case DW_FORM_ref_addr:
82 if (FixedAttributeSize)
83 ++FixedAttributeSize->NumRefAddrs;
87 case DW_FORM_GNU_ref_alt:
88 case DW_FORM_GNU_strp_alt:
89 case DW_FORM_line_strp:
90 case DW_FORM_sec_offset:
91 case DW_FORM_strp_sup:
92 if (FixedAttributeSize)
93 ++FixedAttributeSize->NumDwarfOffsets;
100 if (FixedAttributeSize)
101 FixedAttributeSize->NumBytes += *ByteSize;
107 FixedAttributeSize.
reset();
112 }
else if (A == 0 &&
F == 0) {
129 OS <<
'[' << getCode() <<
"] ";
131 OS <<
"\tDW_CHILDREN_" << (hasChildren() ?
"yes" :
"no") <<
'\n';
133 OS <<
formatv(
"\t{0}\t{1}", Spec.Attr, Spec.Form);
134 if (Spec.isImplicitConst())
135 OS <<
'\t' << Spec.getImplicitConstValue();
143 for (
uint32_t i = 0,
e = AttributeSpecs.size(); i !=
e; ++i) {
144 if (AttributeSpecs[i].Attr == Attr)
161 uint64_t
Offset = DIEOffset + CodeByteSize;
163 for (
const auto &Spec : AttributeSpecs) {
164 if (*MatchAttrIndex == AttrIndex) {
166 if (Spec.isImplicitConst())
168 Spec.getImplicitConstValue());
175 if (
auto FixedSize = Spec.getByteSize(U))
176 Offset += *FixedSize;
185 size_t DWARFAbbreviationDeclaration::FixedSizeInfo::getByteSize(
187 size_t ByteSize = NumBytes;
199 if (isImplicitConst())
201 if (ByteSize.HasByteSize)
202 return ByteSize.ByteSize;
212 if (FixedAttributeSize)
213 return FixedAttributeSize->getByteSize(U);
This class represents lattice values for constants.
Optional< int64_t > getByteSize(const DWARFUnit &U) const
Get the fixed byte size of this Form if possible.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
Optional< size_t > getFixedAttributesByteSize(const DWARFUnit &U) const
uint8_t getRefAddrByteSize() const
Optional< uint32_t > findAttributeIndex(dwarf::Attribute attr) const
Get the index of the specified attribute.
const dwarf::FormParams & getFormParams() const
uint8_t getAddressByteSize() const
DWARFAbbreviationDeclaration()
unsigned getTag(StringRef TagString)
void dump(raw_ostream &OS) const
Optional< DWARFFormValue > getAttributeValue(const uint64_t DIEOffset, const dwarf::Attribute Attr, const DWARFUnit &U) const
Extract a DWARF form value from a DIE specified by DIE offset.
This file contains constants used for implementing Dwarf debug support.
bool extract(DataExtractor Data, uint64_t *OffsetPtr)
static void clear(coro::Shape &Shape)
DWARFDataExtractor getDebugInfoExtractor() const
Optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
This class implements an extremely fast bulk output stream that can only output to a stream...
uint8_t getDwarfOffsetByteSize() const