pkg/proc: tolerate absence of stack barriers in Go 1.9 (#762)

Stack barriers were removed in Go 1.9, and thus code that
expected various stack-barrier-related symbols to exist
does not find them.  Check for their absence and do not
crash when they are missing.  Disable stack-barrier-handling
test for 1.9 and beyond.

Fixes #754.
This commit is contained in:
dr2chase
2017-03-13 13:53:16 -04:00
committed by Derek Parker
parent 97e3fc261c
commit bd48358de3
3 changed files with 19 additions and 6 deletions

View File

@ -130,8 +130,10 @@ type savedLR struct {
}
func newStackIterator(dbp *Process, pc, sp, bp uint64, stkbar []savedLR, stkbarPos int) *stackIterator {
stackBarrierPC := dbp.goSymTable.LookupFunc(runtimeStackBarrier).Entry
if stkbar != nil {
stackBarrierFunc := dbp.goSymTable.LookupFunc(runtimeStackBarrier) // stack barriers were removed in Go 1.9
var stackBarrierPC uint64
if stackBarrierFunc != nil && stkbar != nil {
stackBarrierPC = stackBarrierFunc.Entry
fn := dbp.goSymTable.PCToFunc(pc)
if fn != nil && fn.Name == runtimeStackBarrier {
// We caught the goroutine as it's executing the stack barrier, we must