summaryrefslogtreecommitdiff
path: root/doc/debugging_with_gdb.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/debugging_with_gdb.html')
-rw-r--r--doc/debugging_with_gdb.html15
1 files changed, 11 insertions, 4 deletions
diff --git a/doc/debugging_with_gdb.html b/doc/debugging_with_gdb.html
index b2683913f..b893f931a 100644
--- a/doc/debugging_with_gdb.html
+++ b/doc/debugging_with_gdb.html
@@ -13,7 +13,7 @@ Besides this overview you might want to consult the
<p>
When you compile and link your Go programs with the <code>gc</code> toolchain
-on Linux, Mac OS X or FreeBSD, the resulting binaries contain DWARFv3
+on Linux, Mac OS X, FreeBSD or NetBSD, the resulting binaries contain DWARFv3
debugging information that recent versions (&gt;7.1) of the GDB debugger can
use to inspect a live process or a core dump.
</p>
@@ -23,13 +23,20 @@ Pass the <code>'-s'</code> flag to the linker to omit the debug information
(for example, <code>go build -ldflags "-s" prog.go</code>).
</p>
+<p>
+The code generated by the <code>gc</code> compiler includes inlining of
+function invocations and registerization of variables. These optimizations
+can sometimes make debugging with <code>gdb</code> harder. To disable them
+when debugging, pass the flags <code>-gcflags "-N -l"</code> to the
+<a href="/cmd/go"><code>go</code></a> command used to build the code being
+debugged.
+</p>
<h3 id="Common_Operations">Common Operations</h3>
<ul>
<li>
-Show file and line number for code
-, set breakpoints and disassemble:
+Show file and line number for code, set breakpoints and disassemble:
<pre>(gdb) <b>list</b>
(gdb) <b>list <i>line</i></b>
(gdb) <b>list <i>file.go</i>:<i>line</i></b>
@@ -172,7 +179,7 @@ $ <b>gdb regexp.test -d $GOROOT</b>
If for some reason GDB still can't find that directory or that script, you can load
it by hand by telling gdb (assuming you have the go sources in
<code>~/go/</code>):
-<p>
+</p>
<pre>
(gdb) <b>source ~/go/src/pkg/runtime/runtime-gdb.py</b>