[cfe-dev] Optionally suppress debug info for inlined calls?

Robinson, Paul Paul_Robinson at playstation.sony.com
Mon Nov 25 12:55:41 PST 2013


(Sorry about the quoting weirdness, Outlook sucks at HTML.)

Okay, here's some back-story.  The original desire was to suppress inlined scopes for functions that the source code said to inline.  This would include things like methods defined inside the class declaration, functions with the always_inline attribute, and so forth.  Methods and functions marked this way are typically small and typically not inherently interesting; getters and setters, for example.  Constantly stepping into and out of these guys is just noise, from the debugging-experience point of view.
On prior Sony platforms, we achieved this effect by having the compiler omit the inlined scopes; in fact we omit ALL inlined scopes.  So we were asked to do it the same way in Clang/LLVM.  It wasn't hard so we did.  (The easy way to do it is actually in LLVM, not Clang.)  But some teams still wanted the inlined scopes, and prior compilers had a command-line option to permit this, and that's what I'm trying to provide now.
The space savings, while not the immediate goal, turned out to be non-trivial:  In my benchmark I saw a 25% reduction.  Remember that this is for "-O2 -g" not -O0, so LLVM is really trying to do a good job with inlining, and consequently dumping out a pile of DW_TAG_inlined_subroutine DIEs.  It would be hard to give that up that size reduction.  I know there have been a bunch of size improvements over the past year or so and the savings now might not be quite so dramatic, but DW_TAG_inlined_subroutine (and all its nested scopes and local variables) are not always cheap.

In the longer term, it would be nice if (a) Clang/LLVM would emit a DW_AT_inline attribute [which it does] with a fully correct DW_INL_foobar value [which it does not], and (b) our debugger learned to pay attention to that attribute, implicitly suppressing the frame for the case of DW_INL_declared_inlined [for example].  But it can't do that until the attribute is correct, and even after we start emitting it correctly it still has to behave reasonably for older objects.  And I can't see how to make that happen without suppressing the scopes.
What we want right now is a way to let licensees get their inlined frames back, while preserving the current default behavior which is more-or-less consistent with our past practices.
Assuming DW_AT_inline becomes fully correct, then my proposed "-gno-inlined-scopes" would reduce to being a space-saving device, although it is potentially still a big win in those terms.
--paulr

From: David Blaikie [mailto:dblaikie at gmail.com]
Sent: Monday, November 25, 2013 11:22 AM
To: Robinson, Paul; Eric Christopher
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] Optionally suppress debug info for inlined calls?



On Mon, Nov 25, 2013 at 11:18 AM, Robinson, Paul <Paul_Robinson at playstation.sony.com<mailto:Paul_Robinson at playstation.sony.com>> wrote:
I have _already_ turned it off for my target,

Right, I got that - was just trying to understand if/why that was the right choice.

per request from licensees who don't like seeing fake call frames that don't reflect actual calls in the generated code.

Just tossing around ideas to accommodate your licensees/Clang users: would this make more sense as a feature of debuggers/stack trace tools, etc? Are there particular places where this shows up and confuses users?

The size win doesn't hurt but is secondary.

The problem now is that not everybody likes it that way, and so I want to make it optional, and I'd rather have the feature upstream than keep it private.

(While I'm not ready to file any bugs, I did notice some strangeness in the low/hi_pc ranges for some inlined ctors; the ranges mostly or completely overlapped, which didn't seem right but I didn't look into it.  That's not my focus right now.)
--paulr

From: David Blaikie [mailto:dblaikie at gmail.com<mailto:dblaikie at gmail.com>]
Sent: Monday, November 25, 2013 11:02 AM
To: Robinson, Paul
Cc: cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
Subject: Re: [cfe-dev] Optionally suppress debug info for inlined calls?

Why do you want to turn this off?

Is it buggy? Could we fix it?
Is it too big? Could we reduce size in ways that are strict-wins instead?

On Mon, Nov 25, 2013 at 10:57 AM, Robinson, Paul <Paul_Robinson at playstation.sony.com<mailto:Paul_Robinson at playstation.sony.com>> wrote:
In general on our platform we don't want debug info for inlined calls
(messy, awkward things) but some people still like to see them.  Currently
we turn them off unconditionally in our private tree, but we'd like to put
this under command-line control and send it upstream.  Does anyone mind if
I do this?  I was thinking a command-line option along the lines of
      -g[no-]inlined-scopes
We'd default to No on our target, Yes everywhere else.  If you turn these
off, you don't get DW_TAG_inlined_scope, and the source location info for
all the inlined code becomes the call site (single-stepping would act like
it's an external call that you step over).

Thanks,
--paulr



_______________________________________________
cfe-dev mailing list
cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131125/656de097/attachment.html>


More information about the cfe-dev mailing list