>
https://go-review.googlesource.com/c/41770 supplies better debugging
> information for optimized code, so that users can (in theory) observe
> variables even when they've been allocated to registers. Technically it
> meets the rules for inclusion into 1.9, if we can finish a problematic merge
> soon.
It might technically qualify for 1.9, but it's a fairly substantive
change, and we're pretty close to the first beta.
> Unfortunately, right now it also slows down compilebench by 50%. That might
> be a problem for some people.
I'd love to see better debug data, but 50% is really a lot. For
context, that would undo well over a years' worth of collective work
to improve compile times.
It also appears to double binary sizes, which is also a pretty big
deal. DWARF compression might help with that, but that's yet another
big change to add during the freeze.
Also, have we tested thoroughly to make sure that it doesn't alter any
generated code, just DWARF?
Also, I'd like to take a close look from a concurrency-safety
perspective, and my time is fairly limited this week.
> We could put this off till 1.10, but:
>
> - it's a large CL and will certainly go stale if we don't have tests checked
> in to help keep it alive;
There shouldn't be many changes between now and release. If it's a
major concern and we want to continue to work on it during the freeze,
maybe a dev branch is called for.
> - it's a prerequisite for allocating function/method arguments into
> registers, which we'd like to do for 1.10 but that's its own large job;
> - we'd like to work with Delve and any other debugger developers to see if
> we can make this really work so we can run what we debug and debug what we
> run (and debug what we crash-dump);
Again, maybe these needs could be addressed with a dev branch.
> - it's almost certain that we need user feedback.
> - it's unclear (unlikely?) that it will run much faster then, in which case
> we'll have the very same problem.
Maybe. Although we'd have a lot more time to make sure. And add DWARF
compression. And fix whatever other downstream issue crop us. E.g.
does the debug/dwarf package work with DWARF 4? Should it, if we emit
DWARF 4? And I'm sure there'll be more such items.
> So, since we're sure that a 50% slowdown in compile time is not likely to be
> popular but still want to expose the possibility to many people, we'd like
> to guard it with a flag.
> Happily, the traditional "-g" (go build/install -gcflags -g ... ) is
> available for use.
> That lets us write tests easily even if it's not on by default, allows
> debugger developers to play with it easily, and provides a low barrier to
> any users who want to play with it.
An alternative here is to change the -dwarf flag from a bool to a
string, and allow values like "off", "default", and "full". The -dwarf
flag was added during the 1.9 cycle, so it is still open for easy
change. This should make changing defaults etc easier.
We would also want to consider whether the DWARF scopes work should
also be guarded by such a flag, instead of "-N -l".
> The problem with adding this flag is what we do a few releases down the
> road. If we decide this is such a great idea that it should be on by
> default always, we've grown a semi-useless flag. One option in that future
> is to change the -g=0 meaning of the flag to "don't emit debugging
> information (at all)". Another is to reclaim the flag.
Compiler flags aren't sacrosanct.
The one advantage not mentioned that I see to putting this in 1.9 is
that 1.9 should have significant compilation speed improvements, so
from a user perspective, there won't be as big a net slowdown. IIRC we
did this with write barriers when they were first introduced. But on
balance, I think putting it in now would be a mistake.
-josh