[llvm] r204790 - Fix PR19239 - Add support for generating debug info for functions without lexical scopes and/or debug info at all

Eric Christopher echristo at gmail.com
Tue Apr 1 10:02:38 PDT 2014


On Tue, Apr 1, 2014 at 3:07 AM, Timur Iskhodzhanov <timurrrr at google.com> wrote:
> 2014-04-01 4:12 GMT+04:00 Eric Christopher <echristo at gmail.com>:
>>> -  // Grab the lexical scopes for the function, if we don't have any of those
>>> -  // then we're not going to be able to do anything.
>>> -  LScopes.initialize(*MF);
>>> -  if (LScopes.empty())
>>> -    return;
>>> -
>>>    const Function *GV = MF->getFunction();
>>>    assert(FnDebugInfo.count(GV) == false);
>>>    VisitedFunctions.push_back(GV);
>>> @@ -311,13 +308,12 @@ void WinCodeViewLineTables::endFunction(
>>>    if (!Asm || !CurFn)  // We haven't created any debug info for this function.
>>>      return;
>>>
>>> -  if (CurFn->Instrs.empty())
>>> -    llvm_unreachable("Can this ever happen?");
>>> -
>>> -  // Define end label for subprogram.
>>> -  MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();
>>> -  Asm->OutStreamer.EmitLabel(FunctionEndSym);
>>> -  CurFn->End = FunctionEndSym;
>>> +  if (!CurFn->Instrs.empty()) {
>>> +    // Define end label for subprogram.
>>> +    MCSymbol *FunctionEndSym = Asm->OutStreamer.getContext().CreateTempSymbol();
>>> +    Asm->OutStreamer.EmitLabel(FunctionEndSym);
>>> +    CurFn->End = FunctionEndSym;
>>> +  }
>>>    CurFn = 0;
>>>  }
>>
>> This part doesn't really make sense. You're saying that without any
>> scope we can still generate a line table entry for this?
>
> Yes - I think we can get some minimal required information even if
> there's no lexical scope.
>
>> What's the information contained within and how did it get line information on there?
>> I might be missing something though.
>
> The MI's seem to have DebugLoc available, the IR instructions seem to
> have some minimal debug metadata too.

Then there should be a lexical scope, can you show where it's not?

-eric

>
>> I'm not sure what kind of code this is supposed to be catching (and I looked at the testcases :)
>
> One of the other problems is that we discuss this on a number of
> commits and some stuff and comments already got fixed, improved, etc.
>
> Please see the attached patch that contains all the changes I did and
> tests for them.



More information about the llvm-commits mailing list