News for hackers. Stuff that matters.
Re:A cross-platform debugger for Go by andrewchambers on Monday April 20, 2015 @06:01PM (#9411129)
How does this handle go routines? Can only one be paused at a time?
Re:A cross-platform debugger for Go by jschlatter on Monday April 20, 2015 @06:04PM (#9411147)
Author here. Yes, only one goroutine is paused at a time. I'm planning to add commands to show and jump between goroutines. Still sketching those out, though. Do you think it would be helpful to have multiple goroutines paused by the debugger at once?
Re:A cross-platform debugger for Go by dvirsky on Monday April 20, 2015 @06:22PM (#9411209)
I'd like to be able to completely pause all goroutines and slowly analyze the state of each one. You can probably just add some mutex or waitgroup to your line() method and just lock it when a goroutine pauses, no?
Re:A cross-platform debugger for Go by jschlatter on Monday April 20, 2015 @06:44PM (#9411299)
Yeah, that should be relatively easy to do. We would just skip the "am I the goroutine under the debugger" check here [1] and add some kind of channel communication here [2]. The hardest thing is probably just the UI. How should that functionality work? I'm imagining something like this:

  >>> pause all
  All goroutines paused
  >>> show goroutines
  1: foo.go:16
  2: foo.go:24
  3. bar.go:10 [current]
  >>> next
  -> // some code from goroutine 3
  >>> goroutine 2
  Now tracing goroutine 2. Current location:
  /*
     Code listing from goroutine 2's current location
  */
  >>> next
  -> // some code from goroutine 2
Is this the kind of interface you were imagining?

[1] https://github.com/mailgun/godebug/blob/5c173f56b398bc13fd41... [2] https://github.com/mailgun/godebug/blob/5c173f56b398bc13fd41...

EDIT: formatting

Re:A cross-platform debugger for Go by dvirsky on Tuesday April 21, 2015 @02:00AM (#9412486)
Yep, something like gdb's threads interface.
Re:A cross-platform debugger for Go by andrewchambers on Monday April 20, 2015 @06:49PM (#9411313)
In a well behaved program, all theads should probably be synchronized by mutexes/channels etc, so pausing one thread, should in theory pause all related ones.

I think one is fine for now.