mirror of
https://github.com/golang/go
synced 2024-11-19 02:04:42 -07:00
go.tools/ssa/interp: improve print() on interfaces, and log message for panic.
R=gri CC=golang-dev https://golang.org/cl/21960043
This commit is contained in:
parent
ce321e34d0
commit
d84d338a42
@ -547,7 +547,7 @@ func runFrame(fr *frame) {
|
|||||||
fr.panicking = true
|
fr.panicking = true
|
||||||
fr.panic = recover()
|
fr.panic = recover()
|
||||||
if fr.i.mode&EnableTracing != 0 {
|
if fr.i.mode&EnableTracing != 0 {
|
||||||
fmt.Fprintf(os.Stderr, "Panicking: %s.\n", fr.panic)
|
fmt.Fprintf(os.Stderr, "Panicking: %T %v.\n", fr.panic, fr.panic)
|
||||||
}
|
}
|
||||||
fr.runDefers()
|
fr.runDefers()
|
||||||
fr.block = fr.fn.Recover // recovered panic
|
fr.block = fr.fn.Recover // recovered panic
|
||||||
|
@ -23,6 +23,10 @@ type targetPanic struct {
|
|||||||
v value
|
v value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p targetPanic) String() string {
|
||||||
|
return toString(p.v)
|
||||||
|
}
|
||||||
|
|
||||||
// If the target program calls exit, the interpreter panics with this type.
|
// If the target program calls exit, the interpreter panics with this type.
|
||||||
type exitPanic int
|
type exitPanic int
|
||||||
|
|
||||||
|
@ -395,7 +395,9 @@ func toWriter(w io.Writer, v value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case iface:
|
case iface:
|
||||||
|
fmt.Fprintf(w, "(%s, ", v.t)
|
||||||
toWriter(w, v.v)
|
toWriter(w, v.v)
|
||||||
|
io.WriteString(w, ")")
|
||||||
|
|
||||||
case structure:
|
case structure:
|
||||||
io.WriteString(w, "{")
|
io.WriteString(w, "{")
|
||||||
|
Loading…
Reference in New Issue
Block a user