Skip to content

Commit e676dbb

Browse files
committed
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/84775 Reviewed-by: Heschi Kreinick <[email protected]>
1 parent 1a9f27d commit e676dbb

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

doc/diagnostics.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -317,25 +317,25 @@ <h2 id="debugging">Debugging</h2>
317317
<p><strong>How well do debuggers work with Go programs?</strong></p>
318318

319319
<p>
320-
As of Go 1.9, the DWARF info generated by the gc compiler is not complete
321-
and sometimes makes debugging harder. There is an ongoing effort to improve the
322-
DWARF information to help the debuggers display more accurate information.
323-
Until those improvements are in you may prefer to disable compiler
324-
optimizations during development for more accuracy. To disable optimizations,
325-
use the "-N -l" compiler flags. For example, the following command builds
326-
a package with no compiler optimizations:
320+
The <code>gc</code> compiler performs optimizations such as
321+
function inlining and variable registerization. These optimizations
322+
sometimes make debugging with debuggers harder. There is an ongoing
323+
effort to improve the quality of the DWARF information generated for
324+
optimized binaries. Until those improvements are available, we recommend
325+
disabling optimizations when building the code being debugged. The following
326+
command builds a package with no compiler optimizations:
327327

328328
<p>
329329
<pre>
330-
$ go build -gcflags="-N -l"
330+
$ go build -gcflags=all="-N -l"
331331
</pre>
332332
</p>
333333

334-
<p>
335-
As of Go 1.10, the Go binaries will have the required DWARF information
336-
for accurate debugging. To enable the DWARF improvements, use the following
337-
compiler flags and use GDB until Delve supports location lists:
338-
</p>
334+
As part of the improvement effort, Go 1.10 introduced a new compiler
335+
flag <code>-dwarflocationlists</code>. The flag causes the compiler to
336+
add location lists that helps debuggers work with optimized binaries.
337+
The following command builds a package with optimizations but with
338+
the DWARF location lists:
339339

340340
<p>
341341
<pre>

0 commit comments

Comments
 (0)