diff options
| author | qmuntal <quimmuntal@gmail.com> | 2023-05-18 14:46:20 +0200 |
|---|---|---|
| committer | Quim Muntal <quimmuntal@gmail.com> | 2023-05-22 11:50:24 +0000 |
| commit | 4859392cc29a35a0126e249ecdedbd022c755b20 (patch) | |
| tree | df3541f5fe4d84d21229829b8727bb9948e8929f /src/runtime/export_windows_test.go | |
| parent | 3afbca5c5ff91b1b577b77cde6aecbfaac5881e5 (diff) | |
| download | go-4859392cc29a35a0126e249ecdedbd022c755b20.tar.xz | |
runtime: fix TestSehUnwind
This CL fixes two problems:
- NewContextStub initialize a context with the wrong FP. That
function should dereference the FP returned by getcallerfp, as it
returns the callers's FP instead of the caller's caller FP.
CL 494857 will rename getcallerfp to getfp to make this fact clearer.
- sehCallers skips the bottom frame when it should.
Fixes #60053
Change-Id: I7d59b0175fc95281fcc7dd565ced9293064df3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/496140
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/runtime/export_windows_test.go')
| -rw-r--r-- | src/runtime/export_windows_test.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/runtime/export_windows_test.go b/src/runtime/export_windows_test.go index 8e7662da6e..cf0db576b8 100644 --- a/src/runtime/export_windows_test.go +++ b/src/runtime/export_windows_test.go @@ -29,10 +29,15 @@ func (c ContextStub) GetPC() uintptr { return c.ip() } -func NewContextStub() ContextStub { +func NewContextStub() *ContextStub { var ctx context ctx.set_ip(getcallerpc()) ctx.set_sp(getcallersp()) - ctx.set_fp(getfp()) - return ContextStub{ctx} + fp := getfp() + // getfp is not implemented on windows/386 and windows/arm, + // in which case it returns 0. + if fp != 0 { + ctx.set_fp(*(*uintptr)(unsafe.Pointer(fp))) + } + return &ContextStub{ctx} } |
