17 using namespace dwarf;
19 void DWARFAbbreviationDeclaration::clear() {
24 AttributeSpecs.clear();
25 FixedAttributeSize.reset();
41 CodeByteSize = *OffsetPtr -
Offset;
43 if (
Tag == DW_TAG_null) {
47 uint8_t ChildrenByte = Data.
getU8(OffsetPtr);
52 FixedAttributeSize = FixedSizeInfo();
60 bool IsImplicitConst = (
F == DW_FORM_implicit_const);
70 if (FixedAttributeSize) {
72 FixedAttributeSize->NumBytes += *V;
76 ++FixedAttributeSize->NumAddrs;
79 case DW_FORM_ref_addr:
80 ++FixedAttributeSize->NumRefAddrs;
84 case DW_FORM_GNU_ref_alt:
85 case DW_FORM_GNU_strp_alt:
86 case DW_FORM_line_strp:
87 case DW_FORM_sec_offset:
88 case DW_FORM_strp_sup:
90 ++FixedAttributeSize->NumDwarfOffsets;
97 FixedAttributeSize.
reset();
102 }
else if (
A == 0 &&
F == 0) {
120 OS <<
'[' << getCode() <<
"] ";
121 if (!tagString.empty())
125 OS <<
"\tDW_CHILDREN_" << (hasChildren() ?
"yes" :
"no") <<
'\n';
129 if (!attrString.empty())
132 OS <<
format(
"DW_AT_Unknown_%x", Spec.Attr);
135 if (!formString.empty())
138 OS <<
format(
"DW_FORM_Unknown_%x", Spec.Form);
139 if (Spec.isImplicitConst())
140 OS <<
'\t' << *Spec.ByteSizeOrValue;
148 for (
uint32_t i = 0, e = AttributeSpecs.size();
i != e; ++
i) {
149 if (AttributeSpecs[
i].Attr == Attr)
168 for (
const auto &Spec : AttributeSpecs) {
169 if (*MatchAttrIndex == AttrIndex) {
172 if (Spec.isImplicitConst()) {
173 FormValue.
setSValue(*Spec.ByteSizeOrValue);
180 if (
auto FixedSize = Spec.getByteSize(U))
181 Offset += *FixedSize;
189 size_t DWARFAbbreviationDeclaration::FixedSizeInfo::getByteSize(
191 size_t ByteSize = NumBytes;
203 if (isImplicitConst())
206 return ByteSizeOrValue;
216 if (FixedAttributeSize)
217 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.
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)
Optional< int64_t > getByteSize(const DWARFUnit &U) const
Get the fixed byte size of this Form if possible.
static void clear(coro::Shape &Shape)
DataExtractor getDebugInfoExtractor() const
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...
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")