Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does any golang interactive debugger exist? [closed]

Tags:

debugging

go

The title pretty much sums it up. I am trying out Go and I really miss being able to set breakpoints and step in/over/out as much as I want within an interactive environment. I know I can use gdb to debug Go but that is quite annoying compared to using an IDE that can plug into gdb for breakpointing.

I tried searching for one and could only find plugins or small IDEs that have syntax highlighting but no debugging.

like image 986
Daniel Williams Avatar asked May 11 '13 00:05

Daniel Williams


People also ask

What is DLV DAP?

The Go extension allows you to launch or attach to Go programs for debugging. You can inspect variables and stacks, setting breakpoints, and do other debugging activities using VS Code's Debugging UI. These debugging features are possible by using Delve, the Go debugger.

How do I use Golang debugger?

To debug a program, execute the dlv debug command. Attach the filename at the end of this command, and debugging will start. For example, if you want to debug the main.go file, run the command dlv debug main.go . It is also known as “delve server” because this is a running process waiting for instructions.


2 Answers

Update: Personally, while GDB works I'm not a fan of using it in Go and it will make you spit some blood. Check out some of the other answers for good alternatives.


Yes, of course :)

Go has a debugger (GDB)

Here is the official tutorial on how to use it.

If you'd like 'graphical debugging' (that is, setting breakpoints in the editor) some IDEs let you do that (with GDB in the background).

In specific, Eclipse, LiteIDE and Zeus all let you set breakpoints and debug from your coding environment (source). Here is a video on how to do it with Zeus.

like image 165
Benjamin Gruenbaum Avatar answered Sep 19 '22 06:09

Benjamin Gruenbaum


GDB support for go has lots of issues that won't be fixed by the go team.

For more information, read the post by Rob Pike:

Although we will endeavor to keep basic gdb functionality (stack traces, printing values) working on supported platforms, the ability to use the debugger to understand a Go program's full environment will likely never work, and improving gdb support is not a priority for the team.

They are looking for other debugging options but have no concrete plans by now. The documentation is outdated and the runtime-gdb.pyscript coming with go 1.2 does not work for a GDB that was compiled with python3 support (current Ubuntu for example).

like image 27
metakeule Avatar answered Sep 20 '22 06:09

metakeule