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

Timur Iskhodzhanov timurrrr at google.com
Tue Apr 1 03:07:36 PDT 2014


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.

> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbginfo.patch
Type: text/x-patch
Size: 13259 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140401/122da65e/attachment.bin>


More information about the llvm-commits mailing list