mirror of
https://github.com/golang/go
synced 2024-11-12 02:50:25 -07:00
runtime: make traceback indicate whether _defer was just allocated
Many of the crashes observed in #27993 involve committing the new _defer object at the end of newdefer. It would be helpful to know if the _defer was just allocated or was retrieved from the defer pool. In order to indicate this in the traceback, this CL duplicates the tail of newdefer so that the PC/line number will tell us whether d is new or not. For #27993. Change-Id: Icd3e23dbcf00461877bb082b6f18df701149a607 Reviewed-on: https://go-review.googlesource.com/c/154598 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
3c255e8bc6
commit
db1e8a9e1f
@ -241,6 +241,15 @@ func newdefer(siz int32) *_defer {
|
||||
total := roundupsize(totaldefersize(uintptr(siz)))
|
||||
d = (*_defer)(mallocgc(total, deferType, true))
|
||||
})
|
||||
if debugCachedWork {
|
||||
// Duplicate the tail below so if there's a
|
||||
// crash in checkPut we can tell if d was just
|
||||
// allocated or came from the pool.
|
||||
d.siz = siz
|
||||
d.link = gp._defer
|
||||
gp._defer = d
|
||||
return d
|
||||
}
|
||||
}
|
||||
d.siz = siz
|
||||
d.link = gp._defer
|
||||
|
Loading…
Reference in New Issue
Block a user