r236059 - Debug Info: Represent local anonymous unions as anonymous unions

Adrian Prantl aprantl at apple.com
Wed Apr 29 11:35:10 PDT 2015


> On Apr 29, 2015, at 11:15 AM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Wed, Apr 29, 2015 at 10:48 AM, Adrian Prantl <aprantl at apple.com <mailto:aprantl at apple.com>> wrote:
> 
>> On Apr 29, 2015, at 10:04 AM, Eric Christopher <echristo at gmail.com <mailto:echristo at gmail.com>> wrote:
>> 
>> 
>> 
>> On Wed, Apr 29, 2015 at 9:58 AM Eric Christopher <echristo at gmail.com <mailto:echristo at gmail.com>> wrote:
>> On Wed, Apr 29, 2015 at 8:20 AM Adrian Prantl <aprantl at apple.com <mailto:aprantl at apple.com>> wrote:
>> 
>> > On Apr 28, 2015, at 6:26 PM, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
>> 
>> > Could you revert & I'll look into getting you a reduced test case/demonstration of the issue? (can you run GDB 7.5? Perhaps a simple test case would demonstrate the issue if you're lucky, otherwise I can reduce one from the failing test case)
>> 
>> I reverted the commit in r236110. I probably won’t need a reduction — my guess from the log is that gdb expects a local variable to be present.
>> 
>> My suggestion is to emit local artificial shadow variables and then weaken the Verifier to not verify artificial variables. In a next step, we could use the new debugger tuning target feature to make the artificial local variables and the weakened verifier a gdb-specific behavior, file a bug against gdb, and eventually remove it altogether.
>> 
>> 
>> FWIW I don't want to use the "tuning" parameters to also affect correctness.
>> 
>> OK. Dave and I debated this a little in person, here's a proposal:
>> 
>> by default it will have the gdb specific behavior, but if you're tuning for lldb (or any other debugger I guess?) it won't be there.
>> 
>> Thoughts?
> 
> I think it’s a fair assumption that many debuggers won’t deal very well with anonymous local variables, from that perspective this is the right decision.
> (Nitpick: If it is only needed for GDB then it doesn’t seem right to make it the global default, because tuning for gdb will be the default on all non-lldb/sce platforms anyway.)
> 
> I really want to push towards making the debug info handling stricter, so I’m unhappy about having the frontend willfully emit broken IR at the moment. But, I also haven’t found a way to emit the local shadow variables in a way that makes the verifier happy and isn’t entirely gross in other respects. I’ll keep looking for a better way to emit this without having to relax the verifier.
> 
> Im curious though - why is this harder to support than, say, ASan's habit of smooshing all the variables into a single alloca? They seem rather similar to me, but I'm probably missing something.

When ASan puts variables int the middle of a large alloca it creates a pointer to the variable’s storage deep inside the alloca. It then emits a dbg.declare describing the pointer (with the correct type) rather than the alloca so it does never emit illegal IR.

-- adrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150429/c695e4fd/attachment.html>


More information about the cfe-commits mailing list