<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I don’t think there was a driver patch so far, was there?<div class=""><br class=""></div><div class="">-- adrian</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 6, 2015, at 1:19 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" class="">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Does the patch do all of this?<br class=""><br class="">-eric<br class=""></div><br class=""><div class="gmail_quote">On Wed, May 6, 2015 at 1:18 PM Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com" class="">Paul_Robinson@playstation.sony.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple" class="">
<div class=""><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">I just skimmed through the thread again, and I *think* all the main questions have been answered…<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">It feels like the consensus is "reluctant agreement," with the specific design points being:<u class=""></u><u class=""></u></span></p><p class=""><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class=""><span class="">-<span style="font:7.0pt "Times New Roman"" class="">       
</span></span></span><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">a "debugger tuning" option would have some sort of target-based default<u class=""></u><u class=""></u></span></p><p class=""><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class=""><span class="">-<span style="font:7.0pt "Times New Roman"" class="">       
</span></span></span><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">the "debugger tuning" option would unpack into defaults for individual feature flags<u class=""></u><u class=""></u></span></p><p class=""><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class=""><span class="">-<span style="font:7.0pt "Times New Roman"" class="">       
</span></span></span><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">emitting actual DWARF would test the feature flags not the tuning option<u class=""></u><u class=""></u></span></p><p class=""><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class=""><span class="">-<span style="font:7.0pt "Times New Roman"" class="">       
</span></span></span><u class=""></u><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">any command-line options for feature flags would override the tuning-based defaults<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class=""><u class=""></u> <u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">If I missed anything, let me know, otherwise I'll go back go pinging the patch.<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">Thanks,<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class="">--paulr<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><a name="msg-f:1500453035452317154__MailEndCompose" class=""><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" class=""><u class=""></u> <u class=""></u></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt" class="">
<div class="">
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in" class=""><p class="MsoNormal"><b class=""><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" class="">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"" class=""> <a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank" class="">llvmdev-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvmdev-bounces@cs.uiuc.edu" target="_blank" class="">llvmdev-bounces@cs.uiuc.edu</a>]
<b class="">On Behalf Of </b>David Blaikie<br class="">
<b class="">Sent:</b> Tuesday, May 05, 2015 8:21 PM<br class="">
<b class="">To:</b> Adrian Prantl<br class="">
<b class="">Cc:</b> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank" class="">lldb-dev@cs.uiuc.edu</a>; Greg Clayton; <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank" class="">cfe-dev@cs.uiuc.edu</a> Developers (<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank" class="">cfe-dev@cs.uiuc.edu</a>); LLVM Developers Mailing List (<a href="mailto:llvmdev@cs.uiuc.edu" target="_blank" class="">llvmdev@cs.uiuc.edu</a>)<br class="">
<b class="">Subject:</b> Re: [LLVMdev] [cfe-dev] [lldb-dev] What does "debugger tuning" mean?<u class=""></u><u class=""></u></span></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple" class=""><div class=""><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt" class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class=""><p class="MsoNormal">On Tue, May 5, 2015 at 8:16 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>> wrote:<u class=""></u><u class=""></u></p>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class="">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt" class="">
<div class=""><p class="MsoNormal">On May 5, 2015, at 8:12 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:<u class=""></u><u class=""></u></p>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class=""><p class="MsoNormal"><br class="">
<br class="">
<u class=""></u><u class=""></u></p>
<div class=""><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"LucidaGrande","serif"" class="">On Tue, May 5, 2015 at 4:04 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>> wrote:<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"LucidaGrande","serif"" class=""><br class="">
> On May 1, 2015, at 2:18 PM, Greg Clayton <<a href="mailto:gclayton@apple.com" target="_blank" class="">gclayton@apple.com</a>> wrote:<br class="">
><br class="">
><br class="">
>> On May 1, 2015, at 2:00 PM, Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank" class="">Paul_Robinson@playstation.sony.com</a>> wrote:<br class="">
>><br class="">
>>> A few more things that vote for debugger tuning:<br class="">
>>><br class="">
>>> - LLDB doesn't like to have DWARF that has a class A that inherits from<br class="">
>>> class B, but only a forward declaration of class B is provided.<br class="">
>><br class="">
>> Hmm do we emit that kind of thing today?  In a naïve test, I'm seeing<br class="">
>> the full description of class B.<br class="">
><br class="">
> by default for darwin, it doesn't do this. For others you must specify -fno-limit-debug-info or some flag like that.<br class="">
<br class="">
I think the option is -f(no-)standalone-debug-info<u class=""></u><u class=""></u></span></p>
<div class=""><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"LucidaGrande","serif"" class=""><br class="">
-fno-limit-debug-info == -fstandalone-debug<br class="">
(limit-debug-info was the old name & we had a long discussion and decided standalone-debug more aptly described what it should mean/how it should generalize)<u class=""></u><u class=""></u></span></p>
</div>
</div>
</div>
</blockquote>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div><p class="MsoNormal">And if my memory serves correctly, what adds to the confusion is that -flimit-debug-info used to do more than just this particular optimization, but we decided that most of the other optimizations weren’t really helpful, so they were removed.<u class=""></u><u class=""></u></p>
</div>
</div>
<div class=""><p class="MsoNormal"><br class="">
Not quite - I refactored the existing optimizations once I figured out what they did & how it generalized, they are still controlled by the same (both) flags. There are 3 main optimizations:<br class="">
<br class="">
1) requires complete type (if a type is referenced, use a declaration unless the type is required to be complete (eg: it was dereferenced somewhere, etc))<br class="">
2) vtable (if a type is dynamic, only emit its definition where the vtable is emitted)<br class="">
3) explicit template instantiation (if a type has an explicit template instantiation declaration, only emit the definition where the explicit template instantiation definition is)<br class="">
<br class="">
I really should write a blog post about all this. Seems to create endless confusion. (so far as I know, GCC only does (2), perhaps it does some other things that we don't do, but I haven't seen it)<br class="">
 <u class=""></u><u class=""></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in" class="">
<div class="">
<div class="">
<div class="">
<div class=""><p class="MsoNormal"><br class="">
<br class="">
<u class=""></u><u class=""></u></p>
<div class="">
<div class="">
<div class=""><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"LucidaGrande","serif"" class=""> <u class=""></u><u class=""></u></span></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in" class=""><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"LucidaGrande","serif"" class="">which only emits full definitions of classes in the object file that holds and object’s vtable.<br class="">
<span style="color:#888888" class=""><br class="">
-- adrian</span><u class=""></u><u class=""></u></span></p>
<div class="">
<div class=""><p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:9.0pt;font-family:"LucidaGrande","serif"" class="">><br class="">
>>> - LLDB wants the .apple_XXX accelerator tables, GDB wants<br class="">
>>> .debug_pubnames/.debug_pubtypes<br class="">
>><br class="">
>> Agreed.<br class="">
>><br class="">
>>> So it would be great to have a "-debugger" flag that could be specified<br class="">
>>><br class="">
>>> -debugger=lldb<br class="">
>>> -debugger=gdb<br class="">
>>><br class="">
>>> Not sure on the option name, but I do like the idea.<br class="">
>><br class="">
>> We'll bikeshed the name later but yes, that's the plan.<br class="">
>> Thanks,<br class="">
>> --paulr<br class="">
>><br class="">
>>><br class="">
>>> Greg<br class="">
>>><br class="">
>>>> On May 1, 2015, at 1:06 PM, Robinson, Paul<br class="">
>>> <<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank" class="">Paul_Robinson@playstation.sony.com</a>> wrote:<br class="">
>>>><br class="">
>>>> This is basically a reboot of the previous thread titled<br class="">
>>>> About the "debugger target"<br class="">
>>>> except that "target" was really too strong a term for what I had<br class="">
>>> intended<br class="">
>>>> to use this feature for.  "Debugger tuning" is more like it.  You don't<br class="">
>>>> need to have read the previous thread, I'll recap here.<br class="">
>>>><br class="">
>>>> Fundamentally, Clang/LLVM uses DWARF as the specification for the<br class="">
>>> _format_<br class="">
>>>> of information provided by the compiler to a variety of "consumers,"<br class="">
>>> which<br class="">
>>>> primarily means debuggers (but not exclusively).  [For a long time it<br class="">
>>> was<br class="">
>>>> the only format supported by LLVM. Lately, Microsoft debug info has<br class="">
>>> started<br class="">
>>>> appearing, but being a less widely used format, the issues that DWARF<br class="">
>>> runs<br class="">
>>>> into aren't a concern for that format.  So "debugger tuning" is unlikely<br class="">
>>>> to be an issue for Microsoft debug info.]<br class="">
>>>><br class="">
>>>> DWARF is a permissive standard, meaning that it does not rigidly require<br class="">
>>>> that source-language construct X must be described using the DWARF<br class="">
>>>> construct Y.  Instead, DWARF says something more like, "If you have a<br class="">
>>>> source construct that means something like X, here's a mechanism Y that<br class="">
>>>> you could use to describe it."  While this gives compilers a lot of nice<br class="">
>>>> flexibility, it does mean that there's a lot of wiggle room for how a<br class="">
>>>> compiler describes something and in how a debugger interprets that<br class="">
>>>> description.  Compilers and debuggers therefore need to do a bit of<br class="">
>>>> negotiation in determining how the debug-info "contract" will work, when<br class="">
>>>> it comes to nitty-gritty details.  DWARF itself (the standard, as well<br class="">
>>>> as the committee that owns the standard) refuses to get involved in this<br class="">
>>>> negotiation, referring to all that as "quality of implementation<br class="">
>>> issues."<br class="">
>>>><br class="">
>>>> It is readily apparent that different debuggers have different ideas<br class="">
>>>> about certain DWARF features, for example whether they are useful or<br class="">
>>>> irrelevant, or whether a certain source construct should be described<br class="">
>>>> this way or that way.  As these generally fall into the QOI realm, the<br class="">
>>>> DWARF spec itself is no help, and it comes down to a matter of opinion<br class="">
>>>> about whether "the debugger should just know this" or "the compiler<br class="">
>>>> really ought to just emit it that way."<br class="">
>>>><br class="">
>>>> Clang/LLVM is in the position of being a compiler that wants to support<br class="">
>>>> several different debuggers, all of which have slightly different ideas<br class="">
>>>> about what they want from the DWARF info for a program.  Our first line<br class="">
>>>> of defense of course is the DWARF standard itself, but as we've seen,<br class="">
>>>> that is not a universally definitive reference.<br class="">
>>>><br class="">
>>>> LLVM already emits DWARF slightly differently for different *targets*;<br class="">
>>>> primarily Darwin, in a few cases PS4.  But in at least some cases, the<br class="">
>>>> target is just a (somewhat unreliable) proxy for which *debugger* the<br class="">
>>>> compiler expects to be consuming the DWARF.  The most instructive case<br class="">
>>>> is the exact DWARF expression used to describe the location of a thread-<br class="">
>>>> local variable.  DWARF v3 defined an operator to find the base address<br class="">
>>>> of the thread-local storage area; however, GDB has never learned to<br class="">
>>>> recognize it.  Therefore, for targets where we "know" GDB isn't used,<br class="">
>>>> we can emit the standard operator; for targets where GDB *might* be<br class="">
>>>> used, we need to emit the equivalent (non-standard) GNU operator.<br class="">
>>>><br class="">
>>>> It would be semantically more meaningful to base decisions like this on<br class="">
>>>> whether we expected the debugger to be X or Y or Z.  Therefore I've<br class="">
>>>> proposed (<a href="http://reviews.llvm.org/D8506" target="_blank" class="">http://reviews.llvm.org/D8506</a>) a "debugger tuning" option that<br class="">
>>>> will make the reasoning behind these choices more obvious, and<br class="">
>>> ultimately<br class="">
>>>> give users a way to control the tuning themselves, when the platform's<br class="">
>>>> default isn't what they want. (I'll have a follow-up patch exposing the<br class="">
>>>> tuning option to the Clang driver.)<br class="">
>>>><br class="">
>>>> So, what kinds of things should be based on the debugger tuning option?<br class="">
>>>> Are there still things that should be based on the target platform?<br class="">
>>>> Simplest to consider these questions together, because it is often clear<br class="">
>>>> which criterion is important if you consider (a) the same debugger run<br class="">
>>>> on different targets, versus (b) different debuggers running on the same<br class="">
>>>> target.  Basically, if the same debugger on different targets wants to<br class="">
>>>> have something a certain way, that's probably a debugger-tuning thing.<br class="">
>>>> And if different debuggers on the same target doesn't mean you should<br class="">
>>>> change how the DWARF looks, that's likely a platform-specific thing.<br class="">
>>>><br class="">
>>>> The most obvious example of a debugger-tuning consideration is the TLS<br class="">
>>>> operator mentioned above. That's something that GDB insists on having.<br class="">
>>>> (It turns out that the standard operator was defined in DWARF 3, so we<br class="">
>>>> also have to emit the GNU operator if we're producing DWARF 2.  Tuning<br class="">
>>>> considerations don't trump what the standard says.)<br class="">
>>>><br class="">
>>>> Another example would be .debug_pubnames and .debug_pubtypes sections.<br class="">
>>>> Currently these default to omitted for Darwin and PS4, but included<br class="">
>>>> everywhere else. My initial patch for "tuning" changes the PS4 platform<br class="">
>>>> criterion to the SCE debugger predicate; quite likely the "not Darwin"<br class="">
>>>> criterion ought to be "not LLDB" or in other words "on for GDB only."<br class="">
>>>> And having the code actually reflect the correct semantic purpose seems<br class="">
>>>> like an overall goodness.<br class="">
>>>><br class="">
>>>> An example of a target-dependent feature might be the .debug_aranges<br class="">
>>>> section. As it happens, we don't emit this section by default, because<br class="">
>>>> apparently no debugger finds it useful, although there's a command-line<br class="">
>>>> option (-gdwarf-aranges) for it.  But, for PS4 we do want to emit it,<br class="">
>>>> because we have non-debugger tools that find it useful.  We haven't yet<br class="">
>>>> done the work to make that change on <a href="http://llvm.org/" target="_blank" class="">llvm.org</a>, but it's on the list.<br class="">
>>>> I would conditionalize this on the target, not the debugger, because<br class="">
>>>> the debugger is not why we want to generate the section.<br class="">
>>>><br class="">
>>>> Okay, so I've been pretty long-winded about all this, can I possibly<br class="">
>>>> codify it all into a reasonably succinct set of guidelines?  (which<br class="">
>>>> ought to be committed to the repo somewhere, although whether it's as<br class="">
>>>> a lump of text in a docs webpage or a lump of commentary in some source<br class="">
>>>> file is not clear; opinions welcome.)<br class="">
>>>><br class="">
>>>> o Emit standard DWARF if possible.<br class="">
>>>> o Omitting standard DWARF features that nobody uses is fine.<br class="">
>>>> (example: DW_AT_sibling)<br class="">
>>>> o Extensions are okay, but think about the circumstances where they<br class="">
>>>> would be useful (versus just wasting space).  These are probably a<br class="">
>>>> debugger tuning decision, but might be a target-based decision.<br class="">
>>>> (example: DW_AT_APPLE_* attributes)<br class="">
>>>> o If some debugger can't tolerate some piece of standard DWARF, that's<br class="">
>>>> a missing feature or a bug in the debugger.  Accommodating that in<br class="">
>>>> the compiler is a debugger tuning decision.<br class="">
>>>> (example: DW_OP_form_tls_address not understood by GDB)<br class="">
>>>> o If some debugger has no use for some piece of standard DWARF, and<br class="">
>>>> it saves space to omit it, that's a debugger tuning decision.<br class="">
>>>> (example: .debug_pubnames/.debug_pubtypes sections)<br class="">
>>>> o If a debugger wants things a certain way regardless of the target,<br class="">
>>>> that's probably a debugger tuning decision.<br class="">
>>>> o If "system" software on a target (other than the debugger) wants<br class="">
>>>> things a certain way regardless of which debugger you're using,<br class="">
>>>> that's NOT a debugger tuning decision, but a target-based decision.<br class="">
>>>> (example: .debug_aranges section)<br class="">
>>>><br class="">
>>>> Let me know if this all seems reasonable, and especially if you have<br class="">
>>>> a good idea where to keep the guidelines.<br class="">
>>>> Thanks,<br class="">
>>>> --paulr<br class="">
>>>><br class="">
>>>><br class="">
>>>> _______________________________________________<br class="">
>>>> lldb-dev mailing list<br class="">
>>>> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank" class="">lldb-dev@cs.uiuc.edu</a><br class="">
>>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br class="">
>><br class="">
><br class="">
><br class="">
> _______________________________________________<br class="">
> LLVM Developers mailing list<br class="">
> <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank" class="">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank" class="">http://llvm.cs.uiuc.edu</a><br class="">
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class="">
<br class="">
<u class=""></u><u class=""></u></span></p>
</div>
</div>
<div class="">
<div class=""><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"LucidaGrande","serif"" class="">_______________________________________________<br class="">
cfe-dev mailing list<br class="">
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank" class="">cfe-dev@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><u class=""></u><u class=""></u></span></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
</blockquote>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
</div>
</div></div></div>

_______________________________________________<br class="">
lldb-dev mailing list<br class="">
<a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank" class="">lldb-dev@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>