aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2025-07-01 15:29:12 -0700
committerKeith Randall <khr@golang.org>2025-07-25 11:26:30 -0700
commit08376e1a9c57d4b07a77d156810d3fec46caba79 (patch)
tree7dc2fa6229a2719747e6364d2d7286d8857c7464 /src/runtime/panic.go
parentc76c3abc5426ab3d183514c834bcd7d6a653ae89 (diff)
downloadgo-08376e1a9c57d4b07a77d156810d3fec46caba79.tar.xz
runtime: iterate through inlinings when processing recover()
We care about the wrapper-ness of logical frames, not physical frames. Fixes #73916 Fixes #73917 Fixex #73920 Change-Id: Ia17c8390e71e6c0e13e23dcbb7bc7273ef25da90 Reviewed-on: https://go-review.googlesource.com/c/go/+/685375 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/panic.go')
-rw-r--r--src/runtime/panic.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index 1e61c90aef..bf79b6518e 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -1142,18 +1142,21 @@ func gorecover(_ uintptr) any {
nonWrapperFrames := 0
loop:
for ; u.valid(); u.next() {
- switch u.frame.fn.funcID {
- case abi.FuncIDWrapper:
- continue
- case abi.FuncID_gopanic:
- if u.frame.fp == uintptr(p.gopanicFP) && nonWrapperFrames > 0 {
- canRecover = true
- }
- break loop
- default:
- nonWrapperFrames++
- if nonWrapperFrames > 1 {
+ for iu, f := newInlineUnwinder(u.frame.fn, u.symPC()); f.valid(); f = iu.next(f) {
+ sf := iu.srcFunc(f)
+ switch sf.funcID {
+ case abi.FuncIDWrapper:
+ continue
+ case abi.FuncID_gopanic:
+ if u.frame.fp == uintptr(p.gopanicFP) && nonWrapperFrames > 0 {
+ canRecover = true
+ }
break loop
+ default:
+ nonWrapperFrames++
+ if nonWrapperFrames > 1 {
+ break loop
+ }
}
}
}