mirror of
https://github.com/golang/go
synced 2024-11-18 10:54:40 -07:00
runtime: fix dumpgoroutine() to deal with open-coded defers
_defer.fn can be nil, so we need to add a check when dumping _defer.fn.fn. Fixes #35172 Change-Id: Ic1138be5ec9dce915a87467cfa51ff83acc6e3a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/203697 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
22d377077c
commit
1f3339f441
@ -371,7 +371,12 @@ func dumpgoroutine(gp *g) {
|
||||
dumpint(uint64(d.sp))
|
||||
dumpint(uint64(d.pc))
|
||||
dumpint(uint64(uintptr(unsafe.Pointer(d.fn))))
|
||||
dumpint(uint64(uintptr(unsafe.Pointer(d.fn.fn))))
|
||||
if d.fn == nil {
|
||||
// d.fn can be nil for open-coded defers
|
||||
dumpint(uint64(0))
|
||||
} else {
|
||||
dumpint(uint64(uintptr(unsafe.Pointer(d.fn.fn))))
|
||||
}
|
||||
dumpint(uint64(uintptr(unsafe.Pointer(d.link))))
|
||||
}
|
||||
for p := gp._panic; p != nil; p = p.link {
|
||||
|
@ -824,10 +824,10 @@ type _defer struct {
|
||||
// defers. We have only one defer record for the entire frame (which may
|
||||
// currently have 0, 1, or more defers active).
|
||||
openDefer bool
|
||||
sp uintptr // sp at time of defer
|
||||
pc uintptr // pc at time of defer
|
||||
fn *funcval
|
||||
_panic *_panic // panic that is running defer
|
||||
sp uintptr // sp at time of defer
|
||||
pc uintptr // pc at time of defer
|
||||
fn *funcval // can be nil for open-coded defers
|
||||
_panic *_panic // panic that is running defer
|
||||
link *_defer
|
||||
|
||||
// If openDefer is true, the fields below record values about the stack
|
||||
|
Loading…
Reference in New Issue
Block a user