Change-Id: I9cbb6d53a8c2302222b13d2f33b081b704208b8a
Reviewed-on: https://go-review.googlesource.com/12932
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
package ssa
-import "log"
+import (
+ "log"
+ "runtime"
+)
// Compile is the main entry point for this package.
// Compile modifies f so that on return:
phaseName := "init"
defer func() {
if phaseName != "" {
- f.Fatalf("panic during %s while compiling %s\n", phaseName, f.Name)
+ err := recover()
+ stack := make([]byte, 16384)
+ n := runtime.Stack(stack, false)
+ stack = stack[:n]
+ f.Fatalf("panic during %s while compiling %s:\n\n%v\n\n%s\n", phaseName, f.Name, err, stack)
}
}()