[llvm] r210221 - DebugInfo: Reapply r209984 (reverted in r210143), asserting that abstract DbgVariables have DIEs.
Kuba Břečka
kuba.brecka at gmail.com
Mon Jun 16 13:11:47 PDT 2014
I'm experiencing a heap use-after-free memory issue after this patch. Is
this change (more context provided) intented?
// Construct abstract scopes.
for (LexicalScope *AScope : LScopes.getAbstractScopesList()) {
DISubprogram SP(AScope->getScopeNode());
if (!SP.isSubprogram())
continue;
// Collect info for variables that were optimized out.
DIArray Variables = SP.getVariables();
for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) {
DIVariable DV(Variables.getElement(i));
assert(DV && DV.isVariable());
if (!ProcessedVars.insert(DV))
continue;
- findAbstractVariable(DV, DV.getContext());
+ getOrCreateAbstractVariable(DV, DV.getContext());
}
constructAbstractSubprogramScopeDIE(TheCU, AScope);
}
It seems like getOrCreateAbstractVariable
calls LScopes.getOrCreateAbstractScope which can cause the
AbstractScopesList member vector to be resized (via push_back), introducing
a modify-container-while-iterating-it bug.
Unfortunately, I don't have a test case for this, any ideas how could I
create one?
Kuba
> Author: dblaikie
> Date: Wed Jun 4 18:50:52 2014
> New Revision: 210221
> URL: http://llvm.org/viewvc/llvm-project?rev=210221&view=rev
> Log:
> DebugInfo: Reapply r209984 (reverted in r210143), asserting that abstract
> DbgVariables have DIEs.
> Abstract variables within abstract scopes that are entirely optimized
> away in their first inlining are omitted because their scope is not
> present so the variable is never created. Instead, we should ensure the
> scope is created so the variable can be added, even if it's been
> optimized away in its first inlining.
> This fixes the incorrect debug info in missing-abstract-variable.ll
> (added in r210143) and passes an asserts self-hosting build, so
> hopefully there's not more of these issues left behind... *fingers
> crossed*.
> Modified:
> llvm/trunk/include/llvm/CodeGen/LexicalScopes.h
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
> llvm/trunk/test/DebugInfo/missing-abstract-variable.ll
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140616/eeb45343/attachment.html>
More information about the llvm-commits
mailing list