Commit e676dbbd authored by Hana Kim's avatar Hana Kim Committed by Hyang-Ah Hana Kim

doc/diagnostics: update gc flags recommended for debugging

After 1.10, gcflags apply to only the immediate target.

Change-Id: I3bf331c76041e7b533076cb2f3274e44aafff58a
Reviewed-on: https://go-review.googlesource.com/84775Reviewed-by: default avatarHeschi Kreinick <heschi@google.com>
parent 1a9f27d5
...@@ -317,25 +317,25 @@ create confusion. ...@@ -317,25 +317,25 @@ create confusion.
<p><strong>How well do debuggers work with Go programs?</strong></p> <p><strong>How well do debuggers work with Go programs?</strong></p>
<p> <p>
As of Go 1.9, the DWARF info generated by the gc compiler is not complete The <code>gc</code> compiler performs optimizations such as
and sometimes makes debugging harder. There is an ongoing effort to improve the function inlining and variable registerization. These optimizations
DWARF information to help the debuggers display more accurate information. sometimes make debugging with debuggers harder. There is an ongoing
Until those improvements are in you may prefer to disable compiler effort to improve the quality of the DWARF information generated for
optimizations during development for more accuracy. To disable optimizations, optimized binaries. Until those improvements are available, we recommend
use the "-N -l" compiler flags. For example, the following command builds disabling optimizations when building the code being debugged. The following
a package with no compiler optimizations: command builds a package with no compiler optimizations:
<p> <p>
<pre> <pre>
$ go build -gcflags="-N -l" $ go build -gcflags=all="-N -l"
</pre> </pre>
</p> </p>
<p> As part of the improvement effort, Go 1.10 introduced a new compiler
As of Go 1.10, the Go binaries will have the required DWARF information flag <code>-dwarflocationlists</code>. The flag causes the compiler to
for accurate debugging. To enable the DWARF improvements, use the following add location lists that helps debuggers work with optimized binaries.
compiler flags and use GDB until Delve supports location lists: The following command builds a package with optimizations but with
</p> the DWARF location lists:
<p> <p>
<pre> <pre>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment