Page MenuHomePhabricator

DWARF: Don't compute address ranges for type units

Authored by labath on May 21 2019, 12:59 AM.



Type units don't describe any code, so they should never be the result
of any address lookup queries.

Previously, we would compute the address ranges for the type units for
via the line tables they reference because the type units looked a lot
like line-tables-only compile units. However, this is not correct, as
the line tables are only referenced from type units so that other
declarations can use the file names contained in them.

In this patch I make the BuildAddressRangeTable function virtual, and
implement it only for compile units.

Testing this was a bit tricky, because the behavior depends on the order
in which we add things to the address range map. This rarely caused a
problem with DWARF v4 type units, as they are always added after all
CUs. It happened more frequently with DWARF v5, as there clang emits the
type units first. However, this is still not something that it is
required to do, so for testing I've created an assembly file where I've
deliberately sandwiched a compile unit between two type units, which
should isolate us from both changes in how the compiler emits the units
and changes in the order we process them.

Diff Detail


Event Timeline

labath created this revision.May 21 2019, 12:59 AM
clayborg accepted this revision.May 21 2019, 8:13 AM
This revision is now accepted and ready to land.May 21 2019, 8:13 AM
JDevlieghere accepted this revision.May 21 2019, 8:44 AM

LGTM with a few small nits, even though I know you just moved the code.

77 ↗(On Diff #200420)


80 ↗(On Diff #200420)

if (LineTable* line_table = )

105 ↗(On Diff #200420)

Same here

labath updated this revision to Diff 200672.May 22 2019, 2:13 AM
  • rebase and modernize the code as suggested
clayborg accepted this revision.May 22 2019, 10:17 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2019, 2:08 AM