summaryrefslogtreecommitdiff
path: root/doc/debugging_with_gdb.html
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:36 +0100
commit04b08da9af0c450d645ab7389d1467308cfc2db8 (patch)
treedb247935fa4f2f94408edc3acd5d0d4f997aa0d8 /doc/debugging_with_gdb.html
parent917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff)
downloadgolang-upstream/1.1_hg20130304.tar.gz
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
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>