aboutsummaryrefslogtreecommitdiff
path: root/test/recover.go
AgeCommit message (Collapse)Author
2016-05-02all: make copyright headers consistent with one space after periodEmmanuel Odeke
Follows suit with https://go-review.googlesource.com/#/c/20111. Generated by running $ grep -R 'Go Authors. All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go Authors. All/Go Authors. All/g' $F;done The code in cmd/internal/unvendor wasn't changed. Fixes #15213 Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f Reviewed-on: https://go-review.googlesource.com/21819 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2014-10-22test: add more cases to recover.goIan Lance Taylor
test16 used to fail with gccgo. The withoutRecoverRecursive test would have failed in some possible implementations. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/151630043
2014-09-06runtime: fix panic/wrapper/recover mathRuss Cox
The gp->panicwrap adjustment is just fatally flawed. Now that there is a Panic.argp field, update that instead. That can be done on entry only, so that unwinding doesn't need to worry about undoing anything. The wrappers emit a few more instructions in the prologue but everything else in the system gets much simpler. It also fixes (without trying) a broken test I never checked in. Fixes #7491. LGTM=khr R=khr CC=dvyukov, golang-codereviews, iant, r https://golang.org/cl/135490044
2013-09-18test: disable failing tests under ssa/interp.Alan Donovan
R=gri CC=golang-dev https://golang.org/cl/13471045
2013-09-12runtime, cmd/gc, cmd/ld: ignore method wrappers in recoverRuss Cox
Bug #1: Issue 5406 identified an interesting case: defer iface.M() may end up calling a wrapper that copies an indirect receiver from the iface value and then calls the real M method. That's two calls down, not just one, and so recover() == nil always in the real M method, even during a panic. [For the purposes of this entire discussion, a wrapper's implementation is a function containing an ordinary call, not the optimized tail call form that is somtimes possible. The tail call does not create a second frame, so it is already handled correctly.] Fix this bug by introducing g->panicwrap, which counts the number of bytes on current stack segment that are due to wrapper calls that should not count against the recover check. All wrapper functions must now adjust g->panicwrap up on entry and back down on exit. This adds slightly to their expense; on the x86 it is a single instruction at entry and exit; on the ARM it is three. However, the alternative is to make a call to recover depend on being able to walk the stack, which I very much want to avoid. We have enough problems walking the stack for garbage collection and profiling. Also, if performance is critical in a specific case, it is already faster to use a pointer receiver and avoid this kind of wrapper entirely. Bug #2: The old code, which did not consider the possibility of two calls, already contained a check to see if the call had split its stack and so the panic-created segment was one behind the current segment. In the wrapper case, both of the two calls might split their stacks, so the panic-created segment can be two behind the current segment. Fix this by propagating the Stktop.panic flag forward during stack splits instead of looking backward during recover. Fixes #5406. R=golang-dev, iant CC=golang-dev https://golang.org/cl/13367052
2013-02-21exp/ssa/interp: (#6 of 5): test interpretation of SSA form of $GOROOT/test/*.go.Alan Donovan
The interpreter's os.Exit now triggers a special panic rather than kill the test process. (It's semantically dubious, since it will run deferred routines.) Interpret now returns its exit code rather than calling os.Exit. Also: - disabled parts of a few $GOROOT/tests via os.Getenv("GOSSAINTERP"). - remove unnecessary 'slots' param to external functions; they are never closures. Most of the tests are disabled until go/types supports shifts. They can be reenabled if you patch this workaround: https://golang.org/cl/7312068 R=iant, bradfitz CC=golang-dev, gri https://golang.org/cl/7313062
2012-03-01test: add test of calling recover in a varargs functionIan Lance Taylor
gccgo did not handle this correctly. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5714050
2012-02-16test: use testlib (final 61)Russ Cox
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5671080
2010-04-01runtime: turn run time errors checks into panicsRuss Cox
R=ken2, r CC=golang-dev https://golang.org/cl/871042
2010-03-31test for panic and recoverRuss Cox
R=r, adg CC=golang-dev https://golang.org/cl/869041