diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-10-06 20:24:34 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-10-06 20:24:34 +0000 |
commit | 59f30b887455b3db82b52f5e51a388f307c6a4b7 (patch) | |
tree | 90d4637ef01f387e500c309c360434040a106464 /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | |
parent | 8ad23dcd8b526c9b98566e95d631bcff15290752 (diff) | |
download | bcm5719-llvm-59f30b887455b3db82b52f5e51a388f307c6a4b7.tar.gz bcm5719-llvm-59f30b887455b3db82b52f5e51a388f307c6a4b7.zip |
llvm-dwarfdump: Add an option to collect debug info quality metrics.
At the last LLVM dev meeting we had a debug info for optimized code
BoF session. In that session I presented some graphs that showed how
the quality of the debug info produced by LLVM changed over the last
couple of years. This is a cleaned up version of the patch I used to
collect the this data. It is implemented as an extension of
llvm-dwarfdump, adding a new --statistics option. The intended
use-case is to automatically run this on the debug info produced by,
e.g., our bots, to identify eyebrow-raising changes or regressions
introduced by new transformations that we could act on.
In the current form, two kinds of data are being collected:
- The number of variables that have a debug location versus the number
of variables in total (this takes into account inlined instances of
the same function, so if a variable is completely missing form only
one instance it will be found).
- The PC range covered by variable location descriptions versus the PC
range of all variables' containing lexical scopes.
The output format is versioned and extensible, so I'm looking forward
to both bug fixes and ideas for other data that would be interesting
to track.
Differential Revision: https://reviews.llvm.org/D36627
llvm-svn: 315101
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r-- | llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 9e6fc773139..0bd6ca73b1b 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -201,6 +201,10 @@ static opt<bool> SummarizeTypes("summarize-types", desc("Abbreviate the description of type unit entries"), cat(DwarfDumpCategory)); +static cl::opt<bool> + Statistics("statistics", + cl::desc("Emit JSON-formatted debug info quality metrics."), + cat(DwarfDumpCategory)); static opt<bool> Verify("verify", desc("Verify the DWARF debug info"), cat(DwarfDumpCategory)); static opt<bool> Quiet("quiet", desc("Use with -verify to not emit to STDOUT."), @@ -301,6 +305,9 @@ static void filterByName(const StringSet<> &Names, } } +bool collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx, + Twine Filename, raw_ostream &OS); + static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename, raw_ostream &OS) { logAllUnhandledErrors(DICtx.loadRegisterInfo(Obj), errs(), @@ -536,7 +543,10 @@ int main(int argc, char **argv) { return handleFile(Object, verifyObjectFile, OS); })) exit(1); - } else + } else if (Statistics) + for (auto Object : Objects) + handleFile(Object, collectStatsForObjectFile, OS); + else for (auto Object : Objects) handleFile(Object, dumpObjectFile, OS); |