News for hackers. Stuff that matters.
Re:A cross-platform debugger for Go by skybrian on Monday April 20, 2015 @08:43PM (#9411709)
I think you're right that it's going to introduce bugs in concurrent code. For example, it's legal to send a pointer through a channel as a way of transferring ownership and never access the object again. If the debugger rewrites the code so that "never accesses it again" is no longer true, it's created a data race.

On the other hand, godebug generates straightforward single-threaded code that creates pointers to locals in a shadow data structure and accesses them later. There's no reason it shouldn't work if you're not using goroutines.

In particular, a previous call to godebug.Declare("x", &x) will add a pointer to what was previously a local variable to a data structure. This effectively moves all locals to a heap representation of the goroutine's stack, to be accessed later. It's going to kill performance, but it's legal to do.

Re:A cross-platform debugger for Go by DannyBee on Monday April 20, 2015 @09:44PM (#9411860)
"It's going to kill performance, but it's legal to do."

Sure, but it's going to cause the optimizer to do different things than it would have to that variable. As I said, this essentially changes what the compiler is allowed to do, and will expose or hide bugs (usually hide if it hurts the optimizer) :)

One only has to look at the bugzilla's of gcc and llvm to discover all sorts of fun things that barriers hide/expose.

Re:A cross-platform debugger for Go by skybrian on Tuesday April 21, 2015 @12:11AM (#9412239)
It's clearly not useful for tracking down compiler bugs, but might still be useful for more ordinary bugs in single-threaded user code.