Page MenuHomePhabricator

llvm-dwarfdump: Add dwo parsing to --statistics.
ClosedPublic

Authored by cmtice on May 9 2019, 1:08 PM.

Details

Reviewers
dblaikie
aprantl
Summary

Add check for, and add parsing of, .dwo files to Statistics.cpp; create a new getNonSkeletonUnitDie function in DWARFUnit.h

Diff Detail

Event Timeline

cmtice created this revision.May 9 2019, 1:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2019, 1:08 PM
dblaikie accepted this revision.May 9 2019, 2:00 PM

Looks good - thanks!

include/llvm/DebugInfo/DWARF/DWARFUnit.h
390–394

LLVM style tends to omit {} on single line scopes, and to avoid using 'else' after a return or similar ( https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return ).

So this could be modified to:

if (DWO)
  return DWO->getUnitDIE
return getUnitDIE...

Alternatively, could use the conditional operator, ala:

return (DWO ? *DWO : *this).getUnitDIE(...);

(similar to the other use of parseDWO/pick-the-right-unit in DWARFUnit::getInlinedChainForAddress)

test/tools/llvm-dwarfdump/X86/statistics-dwo.test
11

(I'd generally suggest smaller/more targeted tests - rather than "here's a bunch of code and the statistics we expect for it" (a test that's small enough that most of the stats (the ones that aren't related to instruction counts) could be eyeballed/manually computed/verified easily enough - for instance the first test for statistics (test/tools/llvm-dwarfdump/X86/statistics.ll) explains the values of the various variable statistics)

Having a test with features designed for particular functionality makes test intentions easier to follow (for me, at least) - if bugs are found and numbers change or new statistics are added, it'll be easier to tell which parts of the behavior are intentional and which parts might've been accidentally over-fitted etc.)

But no worries in this instance - thoughts for future work.

This revision is now accepted and ready to land.May 9 2019, 2:00 PM
cmtice closed this revision.May 13 2019, 10:07 AM

Committed in r360380.