This is my first experience of debugging in Go. I am trying to debug this code: http://play.golang.org/p/8WxRtpWgk- (it implements, so far incorrectly, a generic puzzle solver with an application to the Pancake puzzle).
I use gdb (have not heard of a better tool for Go, but please tell me if there is one).
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
OP- Aren't structures and interfaces scattered among many file in Go as well?Structures possibly - depending on your coding style. Interfaces not so much. One of the nice things about go is that you don't have to tell the compiler that something satisfies an interface. Once you define your interface (in one place) the compiler figures out what types meet it and if they do - you can just use them. Takes a little getting used to if you're coming from the C++ world but in practice its a really useful feature.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/YG-APRPwkZc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
(1) Does "generally useful" imply "convenient and sufficient"?
(2) Unit tests are not an invention of Go.
Nonetheless, solid debugging tools exist for other languages. In particular, good IDEs make sure to provide strong debugging capabilities. I believe that there are good reasons for that.
(3) In particular, unit tests do not help with debugging a function that implements a really intricate algorithm, especially one that involves recursion (think of adversarial search with Alpha-Beta pruning)...
I think we will have one for Go and it won't be gdb (the model is wrong). I don't know when that will be, though.
Unit tests are extremely important, but they are not “debugging”.
If you are using print statements to debug, then either you are doing something wrong, or you are working around something that the language creator did wrong/overlooked. In the case of Go, we are currently stuck due to the latter. With a proper debugger, print statements for nearly all debugging purposes are obsolete because you can attach to a running process and insert a tracepoint (breakpoint that prints a message at a specific location and continues execution rather than halting) without recompiling the code or even relaunching the application.
Sam
From: golan...@googlegroups.com [mailto:golan...@googlegroups.com]
On Behalf Of chris dollin
Sent: Thursday, April 3, 2014 1:46 PM
To: Meir
Cc: golang-nuts
Subject: Re: [go-nuts] Debugging in Go seems to be a very difficult task to accomplish
On 3 April 2014 19:26, Meir <mgol...@gmail.com> wrote:
This is my first experience of debugging in Go. I am trying to debug this code: http://play.golang.org/p/8WxRtpWgk- (it implements, so far incorrectly, a generic puzzle solver with an application to the Pancake puzzle).
I use gdb (have not heard of a better tool for Go, but please tell me if there is one).
Debugging need not necessarily involve a special tool called
a "debugger".
Unit tests and print statements are generally useful.
Chris
--
Chris "allusive" Dollin
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
Debugging with goroutines and channels is particularly interesting. I assume such a functionality is (like) 45 deg orthogonal with printlines.
When I worked with the occam debugger on transputers (in the early nineties) one could follow a channel from one process to the other. That was nice, and since occam was a language with distributed or shared memory model in the bottom, one could all of a sudden find oneself single-stepping on another processor. It was quite impressive.
In the early eighties I worked with the MPP Pascal (Micro Processor Pascal) debugger from Texas Instruments. The language was built on the world's first (?) concurrent language, Concurrent Pascal by Per Brinch Hansen (around 1975). The debugger would let me see the context (and stop on any line) in any concurrent process. Even instance "n" of an array of equal processes (give me 90% confidence on the last matter). It also had a control language, enabling me to "build my own" debugger.
The only problem I remember with the occam on transputer debugger was that it couldn't follow a channel that was not "connected" (in an ALT/select or input/output, I don't remember how that was treated if it were waiting for a timeout or an EVENT/hw/sw interrupt). I assume this would be a basic problem for Go as well. I don't think occam-pi has a debugger. Both occam-pi and Go would have sending channels over channels, making this even more complex. To support all this in a debugger would be a challenge.
If I were to write a debugger I would have used the fact that channels have scope out of the goroutines. They are global handles for safe (if used correctly) access of shared data. The scheduler knows about all of them; but not before they are created. But I would like to have a breakpoint when there is data on a channel (presented, waited for or sent) if it's not in scope yet. And it shall never become "optimized away" as my present debugger often brushes me off with.
But a Go debugger should enable me to see the world from the scheduler as well as from the code.
I recommend that the Go debugger designers look into older concurrent debuggers as well. Some of the early designers were very smart.
/Øyvind
Any more hints about this potential future Go debugger of which you speak?
I guess a debugger is a debugger is a debugger, but do you know anything about the project so far?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.