Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1296)

Delta Between Two Patch Sets: doc/debugging_with_gdb.html

Issue 5845065: code review 5845065: doc/debugging_with_gdb: format & content update (Closed)
Left Patch Set: diff -r 14c7fd2498d6 https://code.google.com/p/go/ Created 13 years ago
Right Patch Set: diff -r fbc982f5aff1 https://code.google.com/p/go/ Created 13 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 <!--{ 1 <!--{
2 "Title": "Debugging Go Code with GDB", 2 "Title": "Debugging Go Code with GDB",
3 "Path": "/ref/gdb" 3 "Path": "/ref/gdb"
4 }--> 4 }-->
5 5
6 <p><i> 6 <p><i>
7 This applies to the gc toolchain. Gccgo has native gdb support. Besides this 7 This applies to the <code>gc</code> toolchain. Gccgo has native gdb support.
8 overview you might want to consult the 8 Besides this overview you might want to consult the
9 <a href="http://sourceware.org/gdb/current/onlinedocs/gdb/">GDB manual</a>. 9 <a href="http://sourceware.org/gdb/current/onlinedocs/gdb/">GDB manual</a>.
10 </i></p> 10 </i></p>
11 11
12 <h2 id="Introduction">Introduction</h2> 12 <h2 id="Introduction">Introduction</h2>
13 13
14 <p> 14 <p>
15 When you compile and link your Go programs with the 6g/6l or 8g/8l toolchains 15 When you compile and link your Go programs with the <code>gc</code> toolchain
16 on Linux, Mac OS X or FreeBSD, the resulting binaries contain DWARFv3 16 on Linux, Mac OS X or FreeBSD, the resulting binaries contain DWARFv3
17 debugging information that recent versions (&gt;7.1) of the GDB debugger can 17 debugging information that recent versions (&gt;7.1) of the GDB debugger can
18 use to inspect a live process or a core dump. 18 use to inspect a live process or a core dump.
19 </p> 19 </p>
20 20
21 <p> 21 <p>
22 Pass the <code>'-s'</code> flag to the linker to omit the debug information 22 Pass the <code>'-s'</code> flag to the linker to omit the debug information
23 (for example, <code>go build -ldflags "-s" prog.go</code>). 23 (for example, <code>go build -ldflags "-s" prog.go</code>).
24 </p> 24 </p>
25 25
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 $1 = (struct testing.T *) 0xf840688b60 346 $1 = (struct testing.T *) 0xf840688b60
347 (gdb) p t 347 (gdb) p t
348 $1 = (struct testing.T *) 0xf840688b60 348 $1 = (struct testing.T *) 0xf840688b60
349 (gdb) p *t 349 (gdb) p *t
350 $2 = {errors = "", failed = false, ch = 0xf8406f5690} 350 $2 = {errors = "", failed = false, ch = 0xf8406f5690}
351 (gdb) p *t-&gt;ch 351 (gdb) p *t-&gt;ch
352 $3 = struct hchan&lt;*testing.T&gt; 352 $3 = struct hchan&lt;*testing.T&gt;
353 </pre> 353 </pre>
354 354
355 <p> 355 <p>
356 That <code>struct hchan&lt;*testing.T&gt;</code> is the runtime-internal represn tation of a channel. It is currently empty, or gdb would have pretty-printed it 's contents. 356 That <code>struct hchan&lt;*testing.T&gt;</code> is the runtime-internal represe ntation of a channel. It is currently empty, or gdb would have pretty-printed i t's contents.
357 </p> 357 </p>
358 358
359 <p> 359 <p>
360 Stepping forward: 360 Stepping forward:
361 </p> 361 </p>
362 362
363 <pre> 363 <pre>
364 (gdb) <b>n</b> <i># execute next line</i> 364 (gdb) <b>n</b> <i># execute next line</i>
365 149 for _, test := range findTests { 365 149 for _, test := range findTests {
366 (gdb) <i># enter is repeat</i> 366 (gdb) <i># enter is repeat</i>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 <pre> 474 <pre>
475 (gdb) <b>p i</b> 475 (gdb) <b>p i</b>
476 $4 = {str = "cbb"} 476 $4 = {str = "cbb"}
477 (gdb) <b>whatis i</b> 477 (gdb) <b>whatis i</b>
478 type = regexp.input 478 type = regexp.input
479 (gdb) <b>p $dtype(i)</b> 479 (gdb) <b>p $dtype(i)</b>
480 $26 = (struct regexp.inputBytes *) 0xf8400b4930 480 $26 = (struct regexp.inputBytes *) 0xf8400b4930
481 (gdb) <b>iface i</b> 481 (gdb) <b>iface i</b>
482 regexp.input: struct regexp.inputBytes * 482 regexp.input: struct regexp.inputBytes *
483 </pre> 483 </pre>
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b