<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 14, 2016 at 8:55 AM, Evgenii Stepanov via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Mon, Mar 14, 2016 at 8:48 AM, Benjamin Kramer <<a href="mailto:benny.kra@gmail.com">benny.kra@gmail.com</a>> wrote:<br>
> On Mon, Mar 14, 2016 at 3:59 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>> Yeah - how are they relying on them in a non-asserts build anyway? (were we<br>
>> naming certain things regardless of +/-Asserts? (well, I know we were naming<br>
>> some things, but mostly down in LLVM, I thought Clang generally used the<br>
>> IRBuilder & thus didn't name things in non-Asserts builds))<br>
><br>
> Allocas used to always have names as a debugging feature, see r246991.<br>
><br>
>> On Mon, Mar 14, 2016 at 6:36 AM, Chandler Carruth via cfe-commits<br>
>> <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> A long time ago I argued that the sanitizers should be using debug info<br>
>>> instead of alloca names for this, and I really thought that they had<br>
>>> implemented this... Is that not the case?<br>
>>><br>
>>> It is really bad that the sanitizers are relying on this stuff...<br>
<br>
</span>We've never implemented this though I think Alexey looked into it at<br>
one point. We'd need to refactor the handling of debug options<br>
(-g/-gline-tables-only) so that debug metadata is emitted with ASan<br>
even without -g and then discarded in the backend.<br></blockquote><div><br></div><div>Right, but it was a while ago, and it's a shame it wasn't completed properly :-/</div><div>I've reopened <a href="https://llvm.org/bugs/show_bug.cgi?id=17303">https://llvm.org/bugs/show_bug.cgi?id=17303</a>, but I think the changes</div><div>were abandoned long before Kostya's last comment in that bug.</div><div><br></div><div>IIRC the approach for "trimming" debug info used to implement remarks is way too</div><div>clumsy for ASan: we just delete the link to the root of DIE tree if necessary, thus dropping all the</div><div>debug info. "Lowering" the amount of emitted debug info from full debug info (that would contain names for</div><div>local variables ASan/MSan is interested in) to -gline-tables-only in the backend would be harder.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><div class="h5"><br>
>>><br>
>>> On Mon, Mar 14, 2016 at 2:28 PM Benjamin Kramer via cfe-commits<br>
>>> <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
>>>><br>
>>>> Author: d0k<br>
>>>> Date: Mon Mar 14 08:23:58 2016<br>
>>>> New Revision: 263429<br>
>>>><br>
>>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=263429&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=263429&view=rev</a><br>
>>>> Log:<br>
>>>> [Frontend] Disable value name discarding for all sanitizers.<br>
>>>><br>
>>>> ASan also relies on names on allocas and will emit unhelpful output if<br>
>>>> they're not present. Just force-enable value names for now. Should<br>
>>>> unbreak release builds of asan.<br>
>>>><br>
>>>> Modified:<br>
>>>>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
>>>><br>
>>>> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
>>>> URL:<br>
>>>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=263429&r1=263428&r2=263429&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=263429&r1=263428&r2=263429&view=diff</a><br>
>>>><br>
>>>> ==============================================================================<br>
>>>> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br>
>>>> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Mar 14 08:23:58<br>
>>>> 2016<br>
>>>> @@ -541,6 +541,7 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
>>>>    Opts.DisableFPElim =<br>
>>>>        (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));<br>
>>>>    Opts.DisableFree = Args.hasArg(OPT_disable_free);<br>
>>>> +  Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names);<br>
>>>>    Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);<br>
>>>>    Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);<br>
>>>>    if (Arg *A = Args.getLastArg(OPT_meabi)) {<br>
>>>> @@ -793,12 +794,6 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
>>>>    Opts.CudaGpuBinaryFileNames =<br>
>>>>        Args.getAllArgValues(OPT_fcuda_include_gpubinary);<br>
>>>><br>
>>>> -  // DiscardValueNames is set here so that it can depend (perhaps<br>
>>>> temporarily)<br>
>>>> -  // on other options.<br>
>>>> -  // We check SanitizeMemoryTrackOrigins here because the backend pass<br>
>>>> depends<br>
>>>> -  // on the name of the alloca in order to print out names.<br>
>>>> -  Opts.DiscardValueNames =<br>
>>>> -      Args.hasArg(OPT_discard_value_names) &&<br>
>>>> !Opts.SanitizeMemoryTrackOrigins;<br>
>>>>    return Success;<br>
>>>>  }<br>
>>>><br>
>>>> @@ -2158,6 +2153,12 @@ bool CompilerInvocation::CreateFromArgs(<br>
>>>>      if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)<br>
>>>>        Res.getLangOpts()->ObjCExceptions = 1;<br>
>>>>    }<br>
>>>> +<br>
>>>> +  // FIXME: Override value name discarding when sanitizers are used<br>
>>>> because the<br>
>>>> +  // backend passes depend on the name of the alloca in order to print<br>
>>>> out<br>
>>>> +  // names.<br>
>>>> +  Res.getCodeGenOpts().DiscardValueNames &=<br>
>>>> Res.getLangOpts()->Sanitize.empty();<br>
>>>> +<br>
>>>>    // FIXME: ParsePreprocessorArgs uses the FileManager to read the<br>
>>>> contents of<br>
>>>>    // PCH file and find the original header name. Remove the need to do<br>
>>>> that in<br>
>>>>    // ParsePreprocessorArgs and remove the FileManager<br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> cfe-commits mailing list<br>
>>>> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
>>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> cfe-commits mailing list<br>
>>> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
>>><br>
>><br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>