aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/runtime/cgo_gccgo.go4
-rw-r--r--libgo/go/runtime/proc.go3
-rw-r--r--libgo/go/runtime/runtime2.go1
-rw-r--r--libgo/go/runtime/stubs.go4
4 files changed, 12 insertions, 0 deletions
diff --git a/libgo/go/runtime/cgo_gccgo.go b/libgo/go/runtime/cgo_gccgo.go
index aff8130..e4d27e8 100644
--- a/libgo/go/runtime/cgo_gccgo.go
+++ b/libgo/go/runtime/cgo_gccgo.go
@@ -80,6 +80,10 @@ func CgocallBack() {
gp = getg()
mp := gp.m
mp.dropextram = true
+
+ // This is a C-created stack.
+ // Record the outermost Go frame to help stack scan.
+ gp.entrysp = getcallersp()
}
lockOSThread()
diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go
index e937563..1c944d6 100644
--- a/libgo/go/runtime/proc.go
+++ b/libgo/go/runtime/proc.go
@@ -1192,6 +1192,9 @@ func kickoff() {
gp.param = nil
}
+ // Record the entry SP to help stack scan.
+ gp.entrysp = getsp()
+
fv(param)
goexit1()
}
diff --git a/libgo/go/runtime/runtime2.go b/libgo/go/runtime/runtime2.go
index 4cd68da..4f823e0 100644
--- a/libgo/go/runtime/runtime2.go
+++ b/libgo/go/runtime/runtime2.go
@@ -433,6 +433,7 @@ type g struct {
entry func(unsafe.Pointer) // goroutine function to run
entryfn uintptr // function address passed to __go_go
+ entrysp uintptr // the stack pointer of the outermost Go frame
fromgogo bool // whether entered from gogo function
scanningself bool // whether goroutine is scanning its own stack
diff --git a/libgo/go/runtime/stubs.go b/libgo/go/runtime/stubs.go
index 9f5191b..dfdb38e 100644
--- a/libgo/go/runtime/stubs.go
+++ b/libgo/go/runtime/stubs.go
@@ -231,6 +231,10 @@ func getcallerpc() uintptr
//go:noescape
func getcallersp() uintptr // implemented as an intrinsic on all platforms
+// getsp returns the stack pointer (SP) of the caller of getsp.
+//go:noinline
+func getsp() uintptr { return getcallersp() }
+
func asmcgocall(fn, arg unsafe.Pointer) int32 {
throw("asmcgocall")
return 0