<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - llvm-dwarfdump parses CUs even when not asked to dump them"
href="https://bugs.llvm.org/show_bug.cgi?id=39002">39002</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-dwarfdump parses CUs even when not asked to dump them
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>DebugInfo
</td>
</tr>
<tr>
<th>Assignee</th>
<td>aprantl@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dblaikie@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>