<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 10:12 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@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 class="HOEnZb"><div class="h5">On Mon, Oct 7, 2013 at 10:00 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>

><br>
><br>
><br>
> On Mon, Oct 7, 2013 at 9:53 AM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br>
>><br>
>> On Sat, Oct 5, 2013 at 6:07 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>> ><br>
>> ><br>
>> ><br>
>> > On Sat, Oct 5, 2013 at 5:45 PM, Richard Mitton <<a href="mailto:richard@codersnotes.com">richard@codersnotes.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> It's better without the *user in the switch, as the code that calls it<br>
>> >> will then just print 'invalid opcode %x' or whatever, as opposed to<br>
>> >> right<br>
>> >> now, where it knows about DW_OP_lo_user+0, but not any other user OPs<br>
>> >> (DW_OP_lo_user+N), which is silly.<br>
>> >><br>
>> >> I don't think there's anything that really uses this much already, but<br>
>> >> I'll see if I can figure something out to test it with and the update<br>
>> >> the<br>
>> >> patch<br>
>> ><br>
>> ><br>
>> > When we print assembly (rather than the usual debug info of emitting an<br>
>> > object file and then using llvm-dwarfdump) we annotate the assembly with<br>
>> > comments - but thinking about it, I don't think we annotate DWARF<br>
>> > expressions/operators/etc, so this probably isn't visible. I wonder if<br>
>> > we<br>
>> > call the OperationEncodingString at all.<br>
>> ><br>
>><br>
>> We may not, but it'll be nice to do so. It's handy to use when debugging<br>
>> anyhow.<br>
><br>
><br>
> Guessing: I suspect we can't really do it easily at the moment because the<br>
> dumping code would have to get a lot smarter. The form doesn't imply whether<br>
> or not the bytes are a DWARF expression or not, does it? (ie: data1 may or<br>
> may not be a DWARF expression, it might instead be a file/line number,<br>
> etc... ) so we might end up annotating things that aren't DWARF expressions<br>
> as though they are. I guess maybe we could have a table of attribute kind +<br>
> form to decide whether to annotate the bytes as DWARF expressions or not.<br>
><br>
<br>
</div></div>Oh sure, I actually meant when debugging though. "Please print this<br>
random number as a DW_OP string" :)<br></blockquote><div><br></div><div>Ah, sure. Just untestable (short of a rather trivial unit test) - so I'll go ahead and commit this patch as-is.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
>><br>
>><br>
>> -eric<br>
>><br>
>> >><br>
>> >> .<br>
>> >><br>
>> >><br>
>> >> Eric Christopher wrote:<br>
>> >>><br>
>> >>> Should dump differently I'd have thought. Also don't want to delete<br>
>> >>> the DW_OP_*_user text I'd think.<br>
>> >>><br>
>> >>> -eric<br>
>> >>><br>
>> >>> On Sat, Oct 5, 2013 at 2:33 PM, Richard<br>
>> >>> Mitton<<a href="mailto:richard@codersnotes.com">richard@codersnotes.com</a>><br>
>> >>> wrote:<br>
>> >>><br>
>> >>>>><br>
>> >>>>> No functionality change.<br>
>> >>>>><br>
>> >>>><br>
>> >>>> Nothing to test! :)<br>
>> >>>><br>
>> >>>><br>
>> >>>><br>
>> >>>> Eric Christopher wrote:<br>
>> >>>><br>
>> >>>>><br>
>> >>>>> Testcase? :)<br>
>> >>>>><br>
>> >>>>> -eric<br>
>> >>>>><br>
>> >>>>> On Sat, Oct 5, 2013 at 11:19 AM, Richard<br>
>> >>>>> Mitton<<a href="mailto:richard@codersnotes.com">richard@codersnotes.com</a>><br>
>> >>>>> wrote:<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>><br>
>> >>>>>> Formally added an explicit enum for DWARF TLS support. No<br>
>> >>>>>> functionality<br>
>> >>>>>> change.<br>
>> >>>>>><br>
>> >>>>>><br>
>> >>>>>> <a href="http://llvm-reviews.chandlerc.com/D1845" target="_blank">http://llvm-reviews.chandlerc.com/D1845</a><br>
>> >>>>>><br>
>> >>>>>> Files:<br>
>> >>>>>>     include/llvm/Support/Dwarf.h<br>
>> >>>>>>     lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
>> >>>>>>     lib/Support/Dwarf.cpp<br>
>> >>>>>><br>
>> >>>>>> Index: include/llvm/Support/Dwarf.h<br>
>> >>>>>> ===================================================================<br>
>> >>>>>> --- include/llvm/Support/Dwarf.h<br>
>> >>>>>> +++ include/llvm/Support/Dwarf.h<br>
>> >>>>>> @@ -486,6 +486,9 @@<br>
>> >>>>>>      DW_OP_lo_user = 0xe0,<br>
>> >>>>>>      DW_OP_hi_user = 0xff,<br>
>> >>>>>><br>
>> >>>>>> +  // Extensions for GNU-style thread-local storage.<br>
>> >>>>>> +  DW_OP_GNU_push_tls_address = 0xe0,<br>
>> >>>>>> +<br>
>> >>>>>>      // Extensions for Fission proposal.<br>
>> >>>>>>      DW_OP_GNU_addr_index = 0xfb,<br>
>> >>>>>>      DW_OP_GNU_const_index = 0xfc,<br>
>> >>>>>> Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
>> >>>>>> ===================================================================<br>
>> >>>>>> --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
>> >>>>>> +++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
>> >>>>>> @@ -1513,14 +1513,15 @@<br>
>> >>>>>>            // 1) Start with a constNu of the appropriate pointer<br>
>> >>>>>> size<br>
>> >>>>>>            addUInt(Block, 0, dwarf::DW_FORM_data1,<br>
>> >>>>>>                    PointerSize == 4 ? dwarf::DW_OP_const4u :<br>
>> >>>>>> dwarf::DW_OP_const8u);<br>
>> >>>>>> -        // 2) containing the (relocated) address of the TLS<br>
>> >>>>>> variable<br>
>> >>>>>> +        // 2) containing the (relocated) offset of the TLS<br>
>> >>>>>> variable<br>
>> >>>>>> +        //    within the module's TLS block.<br>
>> >>>>>>            addExpr(Block, 0, dwarf::DW_FORM_udata, Expr);<br>
>> >>>>>>          } else {<br>
>> >>>>>>            addUInt(Block, 0, dwarf::DW_FORM_data1,<br>
>> >>>>>> dwarf::DW_OP_GNU_const_index);<br>
>> >>>>>>            addUInt(Block, 0, dwarf::DW_FORM_udata,<br>
>> >>>>>> DU->getAddrPoolIndex(Expr));<br>
>> >>>>>>          }<br>
>> >>>>>> -      // 3) followed by a custom OP to tell the debugger about TLS<br>
>> >>>>>> (presumably)<br>
>> >>>>>> -      addUInt(Block, 0, dwarf::DW_FORM_data1,<br>
>> >>>>>> dwarf::DW_OP_lo_user);<br>
>> >>>>>> +      // 3) followed by a custom OP to make the debugger do a TLS<br>
>> >>>>>> lookup.<br>
>> >>>>>> +      addUInt(Block, 0, dwarf::DW_FORM_data1,<br>
>> >>>>>> dwarf::DW_OP_GNU_push_tls_address);<br>
>> >>>>>>        } else<br>
>> >>>>>>          addOpAddress(Block, Sym);<br>
>> >>>>>>        // Do not create specification DIE if context is either<br>
>> >>>>>> compile<br>
>> >>>>>> unit<br>
>> >>>>>> Index: lib/Support/Dwarf.cpp<br>
>> >>>>>> ===================================================================<br>
>> >>>>>> --- lib/Support/Dwarf.cpp<br>
>> >>>>>> +++ lib/Support/Dwarf.cpp<br>
>> >>>>>> @@ -456,10 +456,11 @@<br>
>> >>>>>>      case DW_OP_bit_piece:                  return<br>
>> >>>>>> "DW_OP_bit_piece";<br>
>> >>>>>>      case DW_OP_implicit_value:             return<br>
>> >>>>>> "DW_OP_implicit_value";<br>
>> >>>>>>      case DW_OP_stack_value:                return<br>
>> >>>>>> "DW_OP_stack_value";<br>
>> >>>>>> -  case DW_OP_lo_user:                    return "DW_OP_lo_user";<br>
>> >>>>>> -  case DW_OP_hi_user:                    return "DW_OP_hi_user";<br>
>> >>>>>><br>
>> >>>>>> -    // DWARF5 Fission Proposal Op Extensions<br>
>> >>>>>> +  // GNU thread-local storage<br>
>> >>>>>> +  case DW_OP_GNU_push_tls_address:       return<br>
>> >>>>>> "DW_OP_GNU_push_tls_address";<br>
>> >>>>>> +<br>
>> >>>>>> +  // DWARF5 Fission Proposal Op Extensions<br>
>> >>>>>>      case DW_OP_GNU_addr_index:             return<br>
>> >>>>>> "DW_OP_GNU_addr_index";<br>
>> >>>>>>      case DW_OP_GNU_const_index:            return<br>
>> >>>>>> "DW_OP_GNU_const_index";<br>
>> >>>>>>      }<br>
>> >>>>>><br>
>> >>>>>> _______________________________________________<br>
>> >>>>>> llvm-commits mailing list<br>
>> >>>>>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> >>>>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>> >>>>>><br>
>> >>>>>><br>
>> >>>>>><br>
>> >>>><br>
>> >>>> _______________________________________________<br>
>> >>>> llvm-commits mailing list<br>
>> >>>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> >>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>> >>>><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> llvm-commits mailing list<br>
>> >> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > llvm-commits mailing list<br>
>> > <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>