[lldb-dev] [cfe-dev] [LLVMdev] What does "debugger tuning" mean?
Daniel Berlin
dberlin at dberlin.org
Mon May 4 13:24:29 PDT 2015
On Mon, May 4, 2015 at 11:11 AM, Robinson, Paul
<Paul_Robinson at playstation.sony.com> wrote:
> Hi Daniel, your post came across as snarkier than that, apologies for the
> mis-interpretation.
Sorry if it came off as snarky, as I said, i was just trying to
understand the rationale.
>
>
>
> My design tries to improve on a not-very-smooth situation today, where there
> is already "tuning" but it is based largely on the target—even though we
> know for a fact that target is not always a good proxy for choosing the
> expected debugger. By making the expected debugger explicit, we separate
> these concerns, and clarify the intent. The existing tuning has default
> behavior clearly intended to support GDB, LLDB, and now the SCE (PS4)
> debugger; therefore, my proposal made those three cases explicit. If you
> have examples of other debuggers on other target, where emitting different
> subsets of DWARF would be beneficial, and those subsets don't align with
> GDB, LLDB, or SCE debugger, then more cases might be appropriate. I am not
> inclined to propose hypothetical cases, but if you have actual examples then
> that would be very helpful.
>
> Note that we are not talking about whether the debugger is different. We
> are talking about whether the debug-info ought to be different.
I understand. For background, I used to maintain DWARF2/3 debug info
generation for GCC, and at one point, DWARF reading and C++ support
for GDB :)
So i am sadly, quite familiar with the state of the world here.
> Saying that
> some target has a different debugger is not sufficient.
Sure, I understand.
Targets do not have debuggers. People have debuggers :)
> If HP's wacky GDB,
> or OpenVMS Debug, or whatever, are happy with the DWARF we provide now, then
> there's no point to defining a new debugger-tuning case for them.
You've already said GDB isn't, and SCE's debugger isn't. Do you
expect SCE's debugger will stay the same forever in terms of what
DWARF it wants?
(As i've said, repeatedly, GDB hasn't. I am happy to provide specific
examples if you like).
If not, what exactly does --debugger-tuning=sce actually mean?
Past that, as long as you are implementing this in terms of underlying
feature-controls, instead of
if (debuggertuning == SCE)
do this
*in the debug info generation code*
instead of something like
if (debuggertuning == SCE)
set these DWARF generation flags
in the driver code
if (DWARF generation flag set)
generate DWARF that looks one way
else
generate DWARF that looks another.
>
>
> Regarding fine-grained feature-oriented command-line control, I thought I
> had said that in fact most of the specific cases already have that, although
> the naming isn't as consistent as one might like.
I actually am not as concerned with the command line, as I am with how
this gets actually implemented.
> All of that folds down
> into individual feature-flags within the DwarfDebug class, whose constructor
> currently bases its defaults on the target and in my design would base its
> defaults on the debugger-tuning parameter. Then the methods that actually
> emit DWARF look at the feature flags, not at the tuning parameter.
>
This was the part i really wanted to know :)
> This situation is very close to what Sean said, where the debugger-tuning
> parameter provides a prepackaged set of feature-flags defaults. Any of these
> (that have their own command-line option) would be superseded by the
> explicit command-line option.
Sounds reasonable to me then :)
>
> In some cases these individual features are exposed all the way out to the
> user command line. This is especially true when you're talking about
> emitting or omitting entire sections, or a major less-well-supported feature
> like type units. I am not eager to expose the more fiddly-bit things on the
> command line, because it's hard to envision any real value to it.
>
>
>
> So, in those terms, what would the initial state of things be?
>
> GDB = -generate-dwarf-pub-sections; (no command-line option) UseGNUTLSOpcode
>
> LLDB = -dwarf-accel-tables
>
> SCE = (none of the above)
>
>
>
> I anticipate adding a new feature-flag, something like
> "-dwarf-linkage-names" to GDB and LLDB but not SCE, because SCE has no use
> for them.
>
> I anticipate adding a new feature-flag to control the DW_AT_APPLE_*
> attributes, although whether its default should be target-based or
> tuning-based is TBD (I don't know the intended consumer of these
> attributes).
>
> I anticipate changing the default for "-generate-arange-section" from
> always-false to Target==PS4CPU. This is not under tuning control because
> the consumer of it on PS4 is not the debugger. In fact the default might end
> up being set in the driver, because there is an existing user command-line
> option for this.
>
> If somebody wanted a command-line flag for UseGNUTLSOpcode, patches welcome.
>
>
>
> If people want to bikeshed the backend command-line option names, that's a
> different discussion. There are more existing options than the ones I've
> mentioned here; the others are default-off and under user command-line
> control. Harmonizing all of them would be its own mini-project.
>
>
>
> Does that help?
Yes, tremendously.
Thanks for walking through this and explaining it to me ;)
>
> --paulr
>
>
>
> From: Sean Silva [mailto:chisophugis at gmail.com]
> Sent: Friday, May 01, 2015 6:21 PM
> To: Robinson, Paul
> Cc: Daniel Berlin; lldb-dev at cs.uiuc.edu; cfe-dev at cs.uiuc.edu Developers
> (cfe-dev at cs.uiuc.edu); LLVM Developers Mailing List (llvmdev at cs.uiuc.edu)
> Subject: Re: [cfe-dev] [LLVMdev] What does "debugger tuning" mean?
>
>
>
>
>
>
>
> On Fri, May 1, 2015 at 4:57 PM, Robinson, Paul
> <Paul_Robinson at playstation.sony.com> wrote:
>
>> -----Original Message-----
>> From: Daniel Berlin [mailto:dberlin at dberlin.org]
>> Sent: Friday, May 01, 2015 3:15 PM
>> To: Robinson, Paul
>> Cc: cfe-dev at cs.uiuc.edu Developers (cfe-dev at cs.uiuc.edu); LLVM Developers
>> Mailing List (llvmdev at cs.uiuc.edu); lldb-dev at cs.uiuc.edu
>> Subject: Re: [LLVMdev] What does "debugger tuning" mean?
>>
>> On Fri, May 1, 2015 at 1:06 PM, Robinson, Paul
>> <Paul_Robinson at playstation.sony.com> wrote:
>>
>> >
>> > LLVM already emits DWARF slightly differently for different *targets*;
>> > primarily Darwin, in a few cases PS4. But in at least some cases, the
>> > target is just a (somewhat unreliable) proxy for which *debugger* the
>> > compiler expects to be consuming the DWARF. The most instructive case
>> > is the exact DWARF expression used to describe the location of a thread-
>> > local variable. DWARF v3 defined an operator to find the base address
>> > of the thread-local storage area; however, GDB has never learned to
>> > recognize it. Therefore, for targets where we "know" GDB isn't used,
>> > we can emit the standard operator; for targets where GDB *might* be
>> > used, we need to emit the equivalent (non-standard) GNU operator.
>> >
>> > It would be semantically more meaningful to base decisions like this on
>> > whether we expected the debugger to be X or Y or Z.
>>
>> How is this not actually "we expect the debugger to want his described
>> as X, Y, and Z" instead of "we expect the debugger to by X or Y or Z".
>
> Different ways of describing things let us reason about them in different
> ways. Are Cartesian coordinates a reason to reject polar coordinates?
>
>> Debuggers change over time.
>
> Well, they're software too. They're allowed.
>
>> GDB 4's level of support != GDB 5 != GDB6 != GDB7.
>>
>> Heck, the same version of GDB on different platforms can be very
>> different (HP's GDB was very different, as was Apple's).
>>
>> Do you plan on having "debugger tuning" flags for each of these?
>
> Are all of these current supported Clang/LLVM environments? Are they
> suffering because Clang currently emits DWARF in ways that cause them
> problems, or that bloats the debug info unnecessarily? Are vendors
> carrying a pile of private patches to get LLVM to emit DWARF that looks
> like what their debugger wants? If the answer to these questions is
> Yes then my answer to your question is Sure, we could, if we find
> those differences to be important.
>
> I promise you that these things are true at Sony, and I would be
> astounded if it wasn't true for Apple. Guess what? LLDB and SCE are
> two of the debugger-tuning options for a reason.
>
> Show me another _real_ case of _real_ differences that matter to the
> community, and we can talk about another debugger tuning option.
>
>> I am having a lot of trouble understanding how this is about what
>> debuggers expect and not "ways of representing things".
>
> Sometimes there's not much difference in the result, although there
> is a difference in how we think about it.
>
>> Otherwise, i see you getting stuck introducing tons and tons of
>> debugger tunings, instead of people who want it to work a certain way
>> building an option profile consisting of
>> "--debugging-feature=use-tls-operator
>> --debugging-feature=explicit-anonymous-namespace", and getting exactly
>> what they want.
>
> (That sort of alternate proposal is way more useful than the straw-man
> stuff you started out with. Just sayin'.)
>
> (Also incidentally, I see gcc 4.8.2 is emitting an explicit import of
> anonymous namespaces, so that's becoming _less_ different over time.)
>
> In fact this is more or less how DwarfDebug operates now; there is a
> pile (small pile, but still a pile) of individual feature flags that
> get set various ways depending on target or command-line options.
> The problem I'm looking at is that the defaults for a lot of these
> things are based on target, which AFAICT is based on an out-of-date
> assumption about how target correlates to debugger.
>
> I'm proposing to package up known sets of stuff that we're having to
> contend with _today_ in a way that's easier to talk about and do
> something about than the target-oriented mish-mash we have now.
>
> It's a whole lot simpler to say something like "FreeBSD implies LLDB"
> instead of "FreeBSD implies accelerator tables and standard TLS opcode
> and no pubnames or pubtypes."
>
> Or would you rather say "--lang-feature=auto --lang-feature=rvalue-ref
> --lang-feature=move_ctor ..." than "-std=c++11"?
>
>
>
> Is there a reason that we couldn't implement "--debugger-target=lldb" as
> syntax sugar for "--debugger-feature=acceleratortables
> --debugger-feature=standardtlsopcode --debugger-feature=no-pubnames
> --debugger-feature=no-pubtypes"?
>
>
>
> I'm not strongly convinced that we would necessarily need to expose the
> --debugger-feature flag to users (or at all on the command line), if that's
> what is bothering you. But at some point inside the code there needs to be
> an explicit factorization of the different "debugger targets" into what
> would be individual --debugger-feature options, so that it is easy to
> describe new debugger targets.
>
>
>
> -- Sean Silva
>
>
>
>
>
>> IE a year from now, somebody comes along with a version of GDB that
>> doesn't match what your current "tuning profile" is, and asks for it
>> to change.
>
> If it's meaningfully different, i.e. makes enough of a functional and/or
> size difference, and it's an environment we collectively want to support,
> and it's unreasonable to get the necessary effect some other way, then
> sure, maybe we would want to invent a new tuning profile.
>
> But, if it doesn't meet that bar, I don't see why we'd want to.
>
> --paulr
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
More information about the lldb-dev
mailing list