https://bugs.llvm.org/show_bug.cgi?id=39002
Bug ID: 39002
Summary: llvm-dwarfdump parses CUs even when not asked to dump
them
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: apra...@apple.com
Reporter: dblai...@gmail.com
CC: llvm-bugs@lists.llvm.org
Looks like offset dumping support added in r313419 caused CUs to be
unconditionally parsed - this seems like a pessimization.
I discovered this when I went to debug something else (dumping only
str_offsets) & broke on the DWARFCompileUnit ctor & found it as being
unconditionally parsed.
Previous to this change, the code looked like:
- if (shouldDump(Explicit, ".debug_info", DIDT_DebugInfo,
- DObj->getInfoSection().Data)) {
- for (const auto &CU : compile_units())
- CU->dump(OS, DumpOpts);
- }
Making the call to "compile_units()" conditional on the "shouldDump" condition.
After the change, the code looks like:
+ auto dumpDebugInfo = [&](bool IsExplicit, const char *Name,
+ DWARFSection Section, cu_iterator_range CUs) {
+ if (shouldDump(IsExplicit, Name, DIDT_ID_DebugInfo, Section.Data)) {
+ for (const auto &CU : CUs)
+ if (DumpOffset)
+ CU->getDIEForOffset(DumpOffset.getValue()).dump(OS, 0);
+ else
+ CU->dump(OS, DumpOpts);
+ }
+ };
+ dumpDebugInfo(Explicit, ".debug_info", DObj->getInfoSection(),
+ compile_units());
Making the compile_units call unconditional.
Perhaps dumpDebugInfo could take a member function pointer to the accessor
instead of taking the result of calling the accessor? That way allowing the
parsing of units to be deferred until after/conditional on the shouldDump call?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs