Programming Site Updates

Debugging Go Programs with QtCreator

Debugging Go is a pain. I am not sure why the designers of this language did not include a debugger in the toolchain.

In any case, GDB can be used to debug this wonderful language and I discovered that QtCreator is an alright frontend.

There a few steps needed to set this up:

  1. Configure gdb to load the go bindings
    1. In ~/.gdbinit add this:
      source /usr/share/go/src/runtime/runtime-gdb.py
    2. In QtCreator go to Tool->Options->Text Editor; Generic Highlighter clock Download Definitions… and get “Go”
    3. Configure a project with your Go sources as New Project->Import Project->Import Existing Project
    4. In the run configuration set the path and the arguments for your built go binary program

Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.