[llvm] r267226 - Update discriminator assignment algorithm in clang assembler.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 17:13:48 PDT 2016


On Mon, Apr 25, 2016 at 11:03 AM, Dehao Chen <dehao at google.com> wrote:

> I have a test x86 assembly in the internal bug database. But I'm not sure
> how to write a test for MCDwarf as its output is object file. Could you
> point me to an example?
>

Tests in llvm's test/DebugInfo generally check debug info of all kinds,
including the line table (check previous commits to the discriminators for
specific examples, or just search test/DebugInfo for discriminator and I'm
sure you'll find a few)

Basically we test by writing assembly or LLVM IR, generating an object,
dwarfdumping the result and checking the dump shows what we want.

- Dave


>
> Thanks,
> Dehao
>
> On Mon, Apr 25, 2016 at 10:56 AM, David Blaikie <dblaikie at gmail.com>
> wrote:
>
>> Test case?
>>
>> On Fri, Apr 22, 2016 at 2:31 PM, Dehao Chen via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: dehao
>>> Date: Fri Apr 22 16:31:18 2016
>>> New Revision: 267226
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=267226&view=rev
>>> Log:
>>> Update discriminator assignment algorithm in clang assembler.
>>>
>>> Summary: The clang assembler assumes that the discriminator remains the
>>> same when there is source line change. The correct behavior is that when
>>> there is line change, discriminator will automatically reset to 0.
>>>
>>> Reviewers: dnovillo, davidxl, echristo
>>>
>>> Subscribers: echristo, llvm-commits
>>>
>>> Differential Revision: http://reviews.llvm.org/D19436
>>>
>>> Modified:
>>>     llvm/trunk/lib/MC/MCDwarf.cpp
>>>
>>> Modified: llvm/trunk/lib/MC/MCDwarf.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=267226&r1=267225&r2=267226&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/MC/MCDwarf.cpp (original)
>>> +++ llvm/trunk/lib/MC/MCDwarf.cpp Fri Apr 22 16:31:18 2016
>>> @@ -112,6 +112,12 @@ EmitDwarfLineTable(MCObjectStreamer *MCO
>>>              ie = LineEntries.end();
>>>         it != ie; ++it) {
>>>
>>> +    int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;
>>> +
>>> +    // Discriminator will be cleared if there is line change.
>>> +    if (LineDelta != 0)
>>> +      Discriminator = 0;
>>> +
>>>      if (FileNum != it->getFileNum()) {
>>>        FileNum = it->getFileNum();
>>>        MCOS->EmitIntValue(dwarf::DW_LNS_set_file, 1);
>>> @@ -146,7 +152,6 @@ EmitDwarfLineTable(MCObjectStreamer *MCO
>>>      if (it->getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)
>>>        MCOS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
>>>
>>> -    int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;
>>>      MCSymbol *Label = it->getLabel();
>>>
>>>      // At this point we want to emit/create the sequence to encode the
>>> delta in
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160425/59c80048/attachment.html>


More information about the llvm-commits mailing list