@@ -317,25 +317,25 @@ <h2 id="debugging">Debugging</h2>
317
317
< p > < strong > How well do debuggers work with Go programs?</ strong > </ p >
318
318
319
319
< 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:
327
327
328
328
< p >
329
329
< pre >
330
- $ go build -gcflags="-N -l"
330
+ $ go build -gcflags=all= "-N -l"
331
331
</ pre >
332
332
</ p>
333
333
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:
339
339
340
340
< p >
341
341
< pre >
0 commit comments