Support miscelaneous dwarf5 forms.

Most of this is simple, "Read the form, get the data, then
call ProcessAttribute."

Handling DW_FORM_implcit_const is a little trickier, as it
is the only form that stores its value inline in the abbrev
table itself. Add a test for that.

Print errors for supplementary object files.

Change-Id: I0999b039848bded1891998a866e5059acd538a09
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2446627
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Sterling Augustine 2020-10-09 09:56:29 -07:00
parent 9ecccc5512
commit a9afca9c06
4 changed files with 89 additions and 14 deletions

View file

@ -72,8 +72,19 @@ typedef std::map<string, std::pair<const uint8_t*, uint64_t> > SectionMap;
const SectionMap::const_iterator GetSectionByName(const SectionMap&
sections, const char* name);
typedef std::list<std::pair<enum DwarfAttribute, enum DwarfForm> >
AttributeList;
// Most of the time, this struct functions as a simple attribute and form pair.
// However, Dwarf5 DW_FORM_implicit_const means that a form may have its value
// in line in the abbrev table, and that value must be associated with the
// pair until the attr's value is needed.
struct AttrForm {
AttrForm(enum DwarfAttribute attr, enum DwarfForm form, uint64_t value) :
attr_(attr), form_(form), value_(value) { }
enum DwarfAttribute attr_;
enum DwarfForm form_;
uint64_t value_;
};
typedef std::list<AttrForm> AttributeList;
typedef AttributeList::iterator AttributeIterator;
typedef AttributeList::const_iterator ConstAttributeIterator;
@ -527,7 +538,8 @@ class CompilationUnit {
const uint8_t* ProcessAttribute(uint64_t dieoffset,
const uint8_t* start,
enum DwarfAttribute attr,
enum DwarfForm form);
enum DwarfForm form,
uint64_t implicit_const);
// Called when we have an attribute with unsigned data to give to
// our handler. The attribute is for the DIE at OFFSET from the