Skip to content

Commit

Permalink
go-weave/amb: print stack trace on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
aclements committed Nov 6, 2017
1 parent e460ab2 commit 0eeb2f1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions go-weave/amb/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package amb
import (
"errors"
"fmt"
"os"
"runtime"
)

// A Strategy describes how to explore a space of ambiguous values.
Expand Down Expand Up @@ -87,6 +89,15 @@ func (s *Scheduler) run1(root func()) {
if err != nil {
// TODO: Report path.
fmt.Println("failure:", err)
var buf []byte
for i := 1 << 10; i < 1<<20; i *= 2 {
buf = make([]byte, i)
buf = buf[:runtime.Stack(buf, false)]
if len(buf) < i {
break
}
}
os.Stdout.Write(buf)
}
}()
root()
Expand Down

0 comments on commit 0eeb2f1

Please sign in to comment.