24 using namespace dwarf;
26 void DWARFAbbreviationDeclaration::clear() {
31 AttributeSpecs.clear();
32 FixedAttributeSize.reset();
48 CodeByteSize = *OffsetPtr -
Offset;
50 if (
Tag == DW_TAG_null) {
54 uint8_t ChildrenByte = Data.
getU8(OffsetPtr);
59 FixedAttributeSize = FixedSizeInfo();
67 bool IsImplicitConst = (
F == DW_FORM_implicit_const);
68 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;
102 if (FixedAttributeSize)
103 FixedAttributeSize->NumBytes += *V;
109 FixedAttributeSize.
reset();
114 }
else if (
A == 0 &&
F == 0) {
132 OS <<
'[' << getCode() <<
"] ";
133 if (!tagString.empty())
137 OS <<
"\tDW_CHILDREN_" << (hasChildren() ?
"yes" :
"no") <<
'\n';
141 if (!attrString.empty())
144 OS <<
format(
"DW_AT_Unknown_%x", Spec.Attr);
147 if (!formString.empty())
150 OS <<
format(
"DW_FORM_Unknown_%x", Spec.Form);
151 if (Spec.isImplicitConst())
152 OS <<
'\t' << *Spec.ByteSizeOrValue;
160 for (
uint32_t i = 0, e = AttributeSpecs.size(); i != e; ++i) {
161 if (AttributeSpecs[i].Attr == Attr)
180 for (
const auto &Spec : AttributeSpecs) {
181 if (*MatchAttrIndex == AttrIndex) {
184 if (Spec.isImplicitConst()) {
185 FormValue.
setSValue(*Spec.ByteSizeOrValue);
192 if (
auto FixedSize = Spec.getByteSize(U))
193 Offset += *FixedSize;
202 size_t DWARFAbbreviationDeclaration::FixedSizeInfo::getByteSize(
204 size_t ByteSize = NumBytes;
216 if (isImplicitConst())
219 return ByteSizeOrValue;
230 if (FixedAttributeSize)
231 return FixedAttributeSize->getByteSize(U);
uint8_t getDwarfOffsetByteSize() const
bool extract(DataExtractor Data, uint32_t *OffsetPtr)
uint8_t getRefAddrByteSize() const
Optional< DWARFFormValue > getAttributeValue(const uint32_t DIEOffset, const dwarf::Attribute Attr, const DWARFUnit &U) const
Extract a DWARF form value from a DIE specified by DIE offset.
DWARFDataExtractor getDebugInfoExtractor() const
Optional< size_t > getFixedAttributesByteSize(const DWARFUnit &U) const
StringRef FormEncodingString(unsigned Encoding)
StringRef AttributeString(unsigned Attribute)
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
void dump(raw_ostream &OS) const
DWARFAbbreviationDeclaration()
unsigned getTag(StringRef TagString)
const DWARFFormParams & getFormParams() const
Optional< int64_t > getByteSize(const DWARFUnit &U) const
Get the fixed byte size of this Form if possible.
static void clear(coro::Shape &Shape)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
StringRef TagString(unsigned Tag)
Optional< uint32_t > findAttributeIndex(dwarf::Attribute attr) const
Get the index of the specified attribute.
uint8_t getAddressByteSize() const
This class implements an extremely fast bulk output stream that can only output to a stream...