[llvm] r210299 - Fix null dereference with -debug-only=dwarfdebug

Alexey Samsonov vonosmas at gmail.com
Mon Jun 9 12:57:49 PDT 2014


On Mon, Jun 9, 2014 at 11:02 AM, Justin Bogner <mail at justinbogner.com>
wrote:

> Alexey Samsonov <vonosmas at gmail.com> writes:
> > On Mon, Jun 9, 2014 at 9:02 AM, Justin Bogner <mail at justinbogner.com>
> wrote:
> >
> >> Alexey Samsonov <vonosmas at gmail.com> writes:
> >>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> >>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Jun  5
> 18:10:19 2014
> >>> @@ -1220,6 +1220,11 @@ DwarfDebug::collectVariableInfo(SmallPtr
> >>>    if (Begin->getNumOperands() > 1 && Begin->getOperand(0).isReg() &
> >>&
> >>>      !Begin->getOperand(0).getReg())
> >>>     continue;
> >>> +   DEBUG(dbgs() << "DotDebugLoc Pair:\n" << "\t" << *Begin);
> >>> +   if (End != nullptr)
> >>> +    DEBUG(dbgs() << "\t" << *End);
> >>
> >> Missed a newline here?
> >
> > Should be fine, newline is inserted automatically when you print a
> > MachineInstruction.
>
> Ok, then...
>
> >>> +   else
> >>> +    DEBUG(dbgs() << "\tNULL\n");
>
> should we remove the newline here?


Why? If we print MachineInstr, it is followed by a newline automatically.
If we are printing "NULL" manually,
we should print newline ourselves for consistency.


>
> >>>    const MCSymbol *StartLabel = getLabelBeforeInsn(Begin);
> >>>    assert(StartLabel && "Forgot label before DBG_VALUE starting a
> range!");
> >>> @@ -1233,8 +1238,6 @@ DwarfDebug::collectVariableInfo(SmallPtr
> >>>     EndLabel = getLabelBeforeInsn(std::next(I)->first);
> >>>    assert(EndLabel && "Forgot label after instruction ending a
> range!");
> >>>
> >>> -   DEBUG(dbgs() << "DotDebugLoc Pair:\n"
> >>> -          << "\t" << *Begin << "\t" << *End << "\n");
> >>>    DebugLocEntry Loc(StartLabel, EndLabel, getDebugLocValue(Begin),
> TheCU);
> >>>    if (DebugLoc.empty() || !DebugLoc.back().Merge(Loc))
> >>>     DebugLoc.push_back(std::move(Loc));
>



-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140609/b64c712d/attachment.html>


More information about the llvm-commits mailing list