This is an archive of the discontinued LLVM Phabricator instance.

Add a UnitKind field to DWARFUnit so that we can discriminate the unit's origin section.
AbandonedPublic

Authored by friss on Sep 9 2014, 5:53 AM.

Details

Summary

There is no simple way to get the origin section of a DWARFUnit. It is necessary
to know from which section a Unit has been extracted to be able to resolve
cross-unit references (to find the right list to search fo the reference
target).

This patch adds a field and an accessor to the DWARFUnit that indicates where
it originated from. This information will be used in a subsequent patch to
implement a generic version of DWARFContext::getCompilationUnitForOffset()
that will work with arbitrary unit types.

Note that this is nearly implemented like the start of LLVM-style RTTI for
the DWARFUnit, but it seems that we don't need separate classes to represent
the DWO variants of Units as only their origin changes. Thus we only
introduce this discriminant field.

Diff Detail

Event Timeline

friss updated this revision to Diff 13455.Sep 9 2014, 5:53 AM
friss retitled this revision from to Add a UnitKind field to DWARFUnit so that we can discriminate the unit's origin section..
friss added reviewers: dblaikie, samsonov, echristo, aprantl.
friss updated this object.
friss added a subscriber: Unknown Object (MLST).
aprantl edited edge metadata.Sep 9 2014, 2:36 PM

I assume that there will be cross-unit reference testcase for llvm-dwarfdump in a subsequent patch that will exercise this code?
Otherwise this looks simple enough.

friss abandoned this revision.Sep 15 2014, 1:44 AM

Superseded by D5310