<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 25, 2016 at 11:03 AM, Dehao Chen <span dir="ltr"><<a href="mailto:dehao@google.com" target="_blank">dehao@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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?</div></blockquote><div><br>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)<br><br>Basically we test by writing assembly or LLVM IR, generating an object, dwarfdumping the result and checking the dump shows what we want.<br><br>- Dave</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Thanks,</div><div>Dehao</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 25, 2016 at 10:56 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Test case?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 22, 2016 at 2:31 PM, Dehao Chen via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dehao<br>
Date: Fri Apr 22 16:31:18 2016<br>
New Revision: 267226<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=267226&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=267226&view=rev</a><br>
Log:<br>
Update discriminator assignment algorithm in clang assembler.<br>
<br>
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.<br>
<br>
Reviewers: dnovillo, davidxl, echristo<br>
<br>
Subscribers: echristo, llvm-commits<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D19436" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19436</a><br>
<br>
Modified:<br>
llvm/trunk/lib/MC/MCDwarf.cpp<br>
<br>
Modified: llvm/trunk/lib/MC/MCDwarf.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=267226&r1=267225&r2=267226&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=267226&r1=267225&r2=267226&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCDwarf.cpp Fri Apr 22 16:31:18 2016<br>
@@ -112,6 +112,12 @@ EmitDwarfLineTable(MCObjectStreamer *MCO<br>
ie = LineEntries.end();<br>
it != ie; ++it) {<br>
<br>
+ int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;<br>
+<br>
+ // Discriminator will be cleared if there is line change.<br>
+ if (LineDelta != 0)<br>
+ Discriminator = 0;<br>
+<br>
if (FileNum != it->getFileNum()) {<br>
FileNum = it->getFileNum();<br>
MCOS->EmitIntValue(dwarf::DW_LNS_set_file, 1);<br>
@@ -146,7 +152,6 @@ EmitDwarfLineTable(MCObjectStreamer *MCO<br>
if (it->getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)<br>
MCOS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);<br>
<br>
- int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;<br>
MCSymbol *Label = it->getLabel();<br>
<br>
// At this point we want to emit/create the sequence to encode the delta in<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>