Golang gdb: Difference between revisions

From wikinotes
(Created page with "Instructions for debugging go with gdb.<br> Instructions vary by compiler = gc = <blockquote> If compiled with <code>gc</code> (default). <syntaxhighlight lang="bash"> go build -ldflags=-w . gdb your-executable </syntaxhighlight> </blockquote><!-- gc -->")
 
Line 4: Line 4:
= gc =
= gc =
<blockquote>
<blockquote>
{{ NOTE |
haven't quite gotten this working yet }}
If compiled with <code>gc</code> (default).
If compiled with <code>gc</code> (default).


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
go build -ldflags=-w .
go build -gcflags "-N"
gdb your-executable
gdb executable
</syntaxhighlight>
 
Then it's regular gdb commands
<syntaxhighlight lang="bash">
run        # begin running code
layout src  # show place in code
bt          # show backtrace
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- gc -->
</blockquote><!-- gc -->

Revision as of 16:16, 26 June 2022

Instructions for debugging go with gdb.
Instructions vary by compiler

gc

NOTE:

haven't quite gotten this working yet

If compiled with gc (default).

go build -gcflags "-N"
gdb executable

Then it's regular gdb commands

run         # begin running code
layout src  # show place in code
bt          # show backtrace