aboutsummaryrefslogtreecommitdiff
path: root/src/run.bat
diff options
context:
space:
mode:
authorHector Martin Cantero <hector@marcansoft.com>2014-09-24 13:20:25 -0400
committerRuss Cox <rsc@golang.org>2014-09-24 13:20:25 -0400
commit7283e08cbf06bcd32a391183e26080cff301e7f9 (patch)
treea0badddaa894c277fddbbcab13caf224f3815dff /src/run.bat
parenta69e504a34bb965850cbab6fdc1b4bc687cdd0c5 (diff)
downloadgo-7283e08cbf06bcd32a391183e26080cff301e7f9.tar.gz
go-7283e08cbf06bcd32a391183e26080cff301e7f9.zip
runtime: keep g->syscallsp consistent after cgo->Go callbacks
Normally, the caller to runtime.entersyscall() must not return before calling runtime.exitsyscall(), lest g->syscallsp become a dangling pointer. runtime.cgocallbackg() violates this constraint. To work around this, save g->syscallsp and g->syscallpc around cgo->Go callbacks, then restore them after calling runtime.entersyscall(), which restores the syscall stack frame pointer saved by cgocall. This allows the GC to correctly trace a goroutine that is currently returning from a Go->cgo->Go chain. This also adds a check to proc.c that panics if g->syscallsp is clearly invalid. It is not 100% foolproof, as it will not catch a case where the stack was popped then pushed back beyond g->syscallsp, but it does catch the present cgo issue and makes existing tests fail without the bugfix. Fixes #7978. LGTM=dvyukov, rsc R=golang-codereviews, dvyukov, minux, bradfitz, iant, gobot, rsc CC=golang-codereviews, rsc https://golang.org/cl/131910043
Diffstat (limited to 'src/run.bat')
-rw-r--r--src/run.bat7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/run.bat b/src/run.bat
index 62692acaf2..309e06d507 100644
--- a/src/run.bat
+++ b/src/run.bat
@@ -90,11 +90,18 @@ go run "%GOROOT%\test\run.go" - ..\misc\cgo\stdio
if errorlevel 1 goto fail
echo.
+# cgo tests inspect the traceback for runtime functions
+set OLDGOTRACEBACK=%GOTRACEBACK%
+set GOTRACEBACK=2
+
echo # ..\misc\cgo\test
go test ..\misc\cgo\test
if errorlevel 1 goto fail
echo.
+set GOTRACEBACK=%OLDGOTRACEBACK%
+set OLDGOTRACEBACK=
+
echo # ..\misc\cgo\testso
cd ..\misc\cgo\testso
set FAIL=0