
* Extend the "frame" command to set the current frame. Command frame 3 sets up so that subsequent "print", "set", "whatis" command will operate on frame 3. frame 3 print foo continues to work. Added "up", "down". They move the current frame up or down. Implementation note: This changes removes "scopePrefix" mode from the terminal/command.go and instead have the command examine the goroutine/frame value to see if it is invoked in a scoped context. * Rename Command.Frame -> Command.frame.
48 lines
610 B
Go
48 lines
610 B
Go
package main
|
|
|
|
import "runtime"
|
|
|
|
const N = 10
|
|
|
|
func agoroutine(started chan<- struct{}, done chan<- struct{}, i int) {
|
|
started <- struct{}{}
|
|
done <- struct{}{}
|
|
}
|
|
|
|
var dummy int
|
|
|
|
func stacktraceme() {
|
|
dummy++
|
|
return
|
|
}
|
|
|
|
func main() {
|
|
done := make(chan struct{})
|
|
started := make(chan struct{})
|
|
for i := 0; i < N; i++ {
|
|
go agoroutine(started, done, i)
|
|
}
|
|
for i := 0; i < N; i++ {
|
|
<-started
|
|
}
|
|
runtime.Gosched()
|
|
stacktraceme()
|
|
for i := 0; i < N; i++ {
|
|
<-done
|
|
}
|
|
n := 0
|
|
func1(n + 1)
|
|
}
|
|
|
|
func func1(n int) {
|
|
func2(n + 1)
|
|
}
|
|
|
|
func func2(n int) {
|
|
func3(n + 1)
|
|
}
|
|
|
|
func func3(n int) {
|
|
stacktraceme()
|
|
}
|