runtime: use 2*regSize for saved frame pointer check

Previously, we checked for a saved frame pointer by looking for a
2*ptrSize gap between the argument pointer and the locals pointer.
The intent of this check was to look for a two stack slot gap (caller
IP and saved frame pointer), but stack slots are regSize, not ptrSize.

Correct this by checking instead for a 2*regSize gap.

On most platforms, this made no difference because ptrSize==regSize.
However, on amd64p32 (nacl), the saved frame pointer check incorrectly
fired when there was no saved frame pointer because the one stack slot
for the caller IP left an 8 byte gap, which is 2*ptrSize (but not
2*regSize) on amd64p32.

Fixes #9760.

Change-Id: I6eedcf681fe5bf2bf924dde8a8f2d9860a4d758e
Reviewed-on: https://go-review.googlesource.com/3781
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Austin Clements 2015-02-03 09:09:56 -05:00
parent c901bd01c1
commit 67a03fd6a2
2 changed files with 3 additions and 2 deletions

View file

@ -235,7 +235,7 @@ func gentraceback(pc0 uintptr, sp0 uintptr, lr0 uintptr, gp *g, skip int, pcbuf
// If framepointer_enabled and there's a frame, then
// there's a saved bp here.
if GOARCH == "amd64" && frame.varp > frame.sp && framepointer_enabled {
frame.varp -= ptrSize
frame.varp -= regSize
}
// Derive size of arguments.