[cfe-commits] [PATCH] PR14097, no debug info for artificial/'nodebug' methods

Robinson, Paul Paul.Robinson at am.sony.com
Tue Oct 16 17:13:01 PDT 2012


Hi Alexey,

Yes it looks like our patches are at cross-purposes.

I assume that your patch gets the desired effect because there is now a DIE that
points to the subprogram's generated code?  That's not good for me, because if
there's a class method definition DIE, it insists on having a declaration DIE too.
I'm not sure whether the same is true for standalone functions.

I wonder if there is a way we could produce an artificial subprogram DIE, but then
have LLVM not actually emit it to the DWARF.  That is, suppress the excess DWARF
in LLVM rather than in Clang.  If lives long enough to build the address ranges (and
also .debug_line?) it would meet your needs, and then if it doesn't actually get emitted
to .debug_info, it would meet my needs.

--paulr

>From: Alexey Samsonov [samsonov at google.com]
>Sent: Tuesday, October 16, 2012 12:58 PM
>To: Robinson, Paul
>Cc: cfe-commits at cs.uiuc.edu; Eric Christopher
>Subject: Re: [cfe-commits] [PATCH] PR14097, no debug info for artificial/'nodebug' methods
>
>
>Hi Paul,
>
>
>Now this is interesting, I've filed PR13942 and sent a straightforward fix for that 
>to review just today (re-attaching it to this mail in case you're not subscribed for
>cfe-commits). I found it confusing that some functions (like artificial ones)
>lack any debug info entries - it makes it harder for debugger (or other tools)
>to understand which compile unit a given function corresponds to. So, thanks for
>pointing at r158009 :)
>
>
>I don't know what the right solution to this situation is. Probably,
>we can provide debug info for method declarations and drop it
>for method bodies if methods are artificial or have "nodebug" attribute?
>
>
>On Tue, Oct 16, 2012 at 10:51 PM, Robinson, Paul <Paul.Robinson at am.sony.com> wrote:
>
>>Patch #1: Suppress debug info associated with the body of an
>>artificial method. We already suppress debug info for its declaration
>>inside the class description.
>>Fixes PR14097.
>>
>>Patch #2: Suppress debug info for the declaration of a class method
>>marked __attribute__((nodebug)). We already suppress debug info for
>>the body of the method.
>>
>>Here's the story:
>>r158009 suppressed debug-info entries for artificial (compiler
>>generated) methods, typically constructors and destructors, from the
>>debug info for a class. The idea is that these aren't interesting or
>>useful. Which is pretty much true.
>>
>>Unfortunately, the method _definitions_ still get debug info, and if
>>there's no declaration in the class for it to refer to, Clang
>>spontaneously generates debug info for a declaration.  If a ctor has
>>multiple definitions, which they sometimes do (e.g. when there's a
>>virtual base class), each instance produces its own separate
>>declaration.  And so the total debug info size _increases_. Patch #1
>>suppresses debug-info on the definitions as well.
>>
>>While finding the fix, I noticed that the 'nodebug' attribute will
>>suppress debug info for a method definition, but we don't suppress
>>debug info for the corresponding declaration inside a class.
>>(Non-class functions don't have this problem because Clang doesn't
>>emit debug info for a function declaration anyway.)  Patch #2
>>addresses that oversight.
>>
>>I renamed the Sema and CodeGen tests for the 'nodebug' attribute from
>>.c to .cpp and added test points for methods, rather than add whole
>>new test files. Hope that's okay.
>>
>>--paulr
>-- 
>
>Alexey Samsonov, MSK




More information about the cfe-commits mailing list